From 459158c1c918ae4cd08da6308dd30ab80dab30ef Mon Sep 17 00:00:00 2001 From: "joaodasilva@chromium.org" Date: Thu, 14 Nov 2013 00:25:15 +0000 Subject: Make the "Consent To Send Stats" file follow the kMetricsReportingEnabled pref. The options UI updates the state of this file manually (besides setting the pref), but when the policy overrides the pref then the file should be updated to reflect the pref's value. On Windows a registry key is kept in sync with the pref instead of the consents file. After this fix it'll be possible to simply set the pref from the options UI, and to remove the ChromeOS-specific code (that reads from device settings). BUG=318761 Review URL: https://codereview.chromium.org/70233005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234979 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browser_process_impl.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'chrome/browser/browser_process_impl.cc') diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 3b7be8e..161c5f8 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -110,6 +110,7 @@ #if !defined(OS_ANDROID) && !defined(OS_IOS) #include "chrome/browser/media_galleries/media_file_system_registry.h" +#include "chrome/browser/ui/options/options_util.h" #endif #if defined(ENABLE_PLUGIN_INSTALLATION) @@ -878,6 +879,16 @@ void BrowserProcessImpl::CreateLocalState() { base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy, base::Unretained(this))); + // This preference must be kept in sync with external values; update them + // whenever the preference or its controlling policy changes. +#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) + pref_change_registrar_.Add( + prefs::kMetricsReportingEnabled, + base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy, + base::Unretained(this))); + ApplyMetricsReportingPolicy(); +#endif + int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( net::HttpNetworkSession::NORMAL_SOCKET_POOL, @@ -1028,6 +1039,13 @@ void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); } +void BrowserProcessImpl::ApplyMetricsReportingPolicy() { +#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) + OptionsUtil::ResolveMetricsReportingEnabled( + local_state()->GetBoolean(prefs::kMetricsReportingEnabled)); +#endif +} + // Mac is currently not supported. #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) -- cgit v1.1