Push policy-based origin security policy into //services/network.

After this CL the policies that map into
prefs::kUnsafelyTreatInsecureOriginAsSecure are pushed at runtime into
the SecureOriginAllowlist singleton class in the //services/network
layer.

This helps in the following ways:

- After this CL, content::IsOriginSecure takes the policy into account
  (it didn't before)

- Since SecureOriginAllowlist (unlike prefs) can be accessed from any
  browser-side thread, after this CL we are able to propagate the policy
  into the NetworkService process (see the changes in
  //chrome/browser/chrome_content_browser_client.cc)

- This CL allows to delete //chrome-layer IsOriginSecure (which was
  asking content::IsOriginSecure *and* also checking the policy/pref)
  and instead just always call content::IsOriginSecure which already
  looks at the switch value.  This means that //content-layer calls to
  content::IsOriginSecure now correctly start to take the policy/pref
  value into account.

In addition to testing via automated regression tests, I've also
manually launched chrome with --unsafely-treat-insecure-origin-as-secure
switch and with UnsafelyTreatInsecureOriginAsSecure policy configured
via /etc/chromium/policies/managed/trustworthy-origins.json and verified
(via ps -fwwp) that the renderer process and the NetworkService process
have the right cmdline switch (combining the policy and cmdline values
from the browser process).

Bug: 937451, 917107
Change-Id: I3ff24d57ec89971e7657ca0d612b291d7bbfb2b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1513098
Reviewed-by: Łukasz Anforowicz <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Yutaka Hirano <[email protected]>
Reviewed-by: Dominick Ng <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: Emily Stark <[email protected]>
Reviewed-by: Julian Pastarmov <[email protected]>
Reviewed-by: Christopher Thompson <[email protected]>
Reviewed-by: Pavol Marko <[email protected]>
Commit-Queue: Łukasz Anforowicz <[email protected]>
Cr-Commit-Position: refs/heads/master@{#657737}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index ae78c35..2dc73bf 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -529,6 +529,7 @@
   rappor::RapporServiceImpl::RegisterPrefs(registry);
   RegisterScreenshotPrefs(registry);
   safe_browsing::RegisterLocalStatePrefs(registry);
+  secure_origin_whitelist::RegisterPrefs(registry);
   sessions::SessionIdGenerator::RegisterPrefs(registry);
   SSLConfigServiceManager::RegisterPrefs(registry);
   startup_metric_utils::RegisterPrefs(registry);
@@ -709,7 +710,7 @@
   PushMessagingAppIdentifier::RegisterProfilePrefs(registry);
   RegisterBrowserUserPrefs(registry);
   safe_browsing::RegisterProfilePrefs(registry);
-  secure_origin_whitelist::RegisterProfilePrefs(registry);
+  secure_origin_whitelist::RegisterPrefs(registry);
   SafeBrowsingTriggeredPopupBlocker::RegisterProfilePrefs(registry);
   SessionStartupPref::RegisterProfilePrefs(registry);
   sync_sessions::SessionSyncPrefs::RegisterProfilePrefs(registry);