Add metrics for measuring the speed and reliability of app-based crypto.

This CL adds metrics to call into the elevation service to perform
app-based encryption and decryption operations similar to those
that would be performed to support app-based encryption in Chrome.

A task is posted at startup to measure a call to Encrypt for a new
local state, with the encrypted data persisted to local state.

On subsequent startups, the encrypted data is decrypted and the time
taken to decrypt is measured

This will give a good proxy for the performance of the code in
src/chrome if it is to be used in production, and help direct
further development on the threading model that will be used
for initializing the os_crypt key in future iterations.

A test was added that requires running as Admin to work correctly
as it installs the service, and verifies that it can be
successfully communicated with.

BUG=1333461

Change-Id: I9d735242a24bc8a29cfc3b8a14634578d6cf1c3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3697028
Reviewed-by: Greg Thompson <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Commit-Queue: Will Harris <[email protected]>
Reviewed-by: Robert Kaplow <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1016956}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 8bfc3599..badad2b 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -423,6 +423,7 @@
 #include "chrome/browser/font_prewarmer_tab_helper.h"
 #include "chrome/browser/media/cdm_pref_service_helper.h"
 #include "chrome/browser/media/media_foundation_service_monitor.h"
+#include "chrome/browser/os_crypt/app_bound_encryption_metrics_win.h"
 #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
 #include "chrome/browser/win/conflicts/incompatible_applications_updater.h"
 #include "chrome/browser/win/conflicts/module_database.h"
@@ -1181,6 +1182,7 @@
   component_updater::RegisterPrefsForSwReporter(registry);
   safe_browsing::RegisterChromeCleanerScanCompletionTimePref(registry);
   MediaFoundationServiceMonitor::RegisterPrefs(registry);
+  os_crypt::RegisterLocalStatePrefs(registry);
 #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
   IncompatibleApplicationsUpdater::RegisterLocalStatePrefs(registry);
   ModuleDatabase::RegisterLocalStatePrefs(registry);