media: Support persistent hardware secure decryption disabling

This CL adds a new pref in "Local State" to keep track of past times
when hardware secure decryption was disabled. To avoid repeated playback
errors after each browser restart, this new pref is checked at browser
start time and hardware secure decryption should remain disabled if it
was disabled explicitly in the last 7 days. We will add metrics here
and refine the detailed disabling algorithm later.

Manually tested by triggering multiple playback errors and make sure
hardware secure decryption should remain disabled after browser restart.

Bug: 1296219
Test: See above
Change-Id: I920064a0931e0b43f5f0c57606c35e8f2553b1b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3550788
Reviewed-by: Joshua Pawlicki <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: John Rummell <[email protected]>
Commit-Queue: Xiaohan Wang <[email protected]>
Cr-Commit-Position: refs/heads/main@{#985710}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index f5eb1ef8d..51c11d51 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -412,6 +412,7 @@
 #include "chrome/browser/component_updater/sw_reporter_installer_win.h"
 #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"
 #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
 #include "chrome/browser/win/conflicts/incompatible_applications_updater.h"
 #include "chrome/browser/win/conflicts/module_database.h"
@@ -1159,6 +1160,7 @@
       policy::policy_prefs::kNativeWindowOcclusionEnabled, true);
   component_updater::RegisterPrefsForSwReporter(registry);
   safe_browsing::RegisterChromeCleanerScanCompletionTimePref(registry);
+  MediaFoundationServiceMonitor::RegisterPrefs(registry);
 #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
   IncompatibleApplicationsUpdater::RegisterLocalStatePrefs(registry);
   ModuleDatabase::RegisterLocalStatePrefs(registry);