Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 1411863002: Use kMetricsReportingEnabled instead of kStatsReporingPref on metrics side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 // a candidate for removal. 826 // a candidate for removal.
827 // Initialize ResourceBundle which handles files loaded from external 827 // Initialize ResourceBundle which handles files loaded from external
828 // sources. This has to be done before uninstall code path and before prefs 828 // sources. This has to be done before uninstall code path and before prefs
829 // are registered. 829 // are registered.
830 registry->RegisterStringPref(prefs::kApplicationLocale, std::string()); 830 registry->RegisterStringPref(prefs::kApplicationLocale, std::string());
831 #if defined(OS_CHROMEOS) 831 #if defined(OS_CHROMEOS)
832 registry->RegisterStringPref(prefs::kOwnerLocale, std::string()); 832 registry->RegisterStringPref(prefs::kOwnerLocale, std::string());
833 registry->RegisterStringPref(prefs::kHardwareKeyboardLayout, 833 registry->RegisterStringPref(prefs::kHardwareKeyboardLayout,
834 std::string()); 834 std::string());
835 #endif // defined(OS_CHROMEOS) 835 #endif // defined(OS_CHROMEOS)
836 #if !defined(OS_CHROMEOS)
837 registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled, 836 registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled,
838 GoogleUpdateSettings::GetCollectStatsConsent()); 837 GoogleUpdateSettings::GetCollectStatsConsent());
839 #endif // !defined(OS_CHROMEOS)
840
841 #if defined(OS_ANDROID) 838 #if defined(OS_ANDROID)
842 registry->RegisterBooleanPref( 839 registry->RegisterBooleanPref(
843 prefs::kCrashReportingEnabled, false); 840 prefs::kCrashReportingEnabled, false);
844 #endif // defined(OS_ANDROID) 841 #endif // defined(OS_ANDROID)
845 } 842 }
846 843
847 DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() { 844 DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {
848 DCHECK(CalledOnValidThread()); 845 DCHECK(CalledOnValidThread());
849 if (!download_request_limiter_.get()) 846 if (!download_request_limiter_.get())
850 download_request_limiter_ = new DownloadRequestLimiter(); 847 download_request_limiter_ = new DownloadRequestLimiter();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 pref_change_registrar_.Init(local_state_.get()); 1005 pref_change_registrar_.Init(local_state_.get());
1009 1006
1010 // Initialize the notification for the default browser setting policy. 1007 // Initialize the notification for the default browser setting policy.
1011 pref_change_registrar_.Add( 1008 pref_change_registrar_.Add(
1012 prefs::kDefaultBrowserSettingEnabled, 1009 prefs::kDefaultBrowserSettingEnabled,
1013 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy, 1010 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy,
1014 base::Unretained(this))); 1011 base::Unretained(this)));
1015 1012
1016 // This preference must be kept in sync with external values; update them 1013 // This preference must be kept in sync with external values; update them
1017 // whenever the preference or its controlling policy changes. 1014 // whenever the preference or its controlling policy changes.
1018 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 1015 #if !defined(OS_ANDROID) && !defined(OS_IOS)
1019 pref_change_registrar_.Add( 1016 pref_change_registrar_.Add(
1020 metrics::prefs::kMetricsReportingEnabled, 1017 metrics::prefs::kMetricsReportingEnabled,
1021 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy, 1018 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy,
1022 base::Unretained(this))); 1019 base::Unretained(this)));
1023 #endif 1020 #endif
1024 1021
1025 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); 1022 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy);
1026 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( 1023 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(
1027 net::HttpNetworkSession::NORMAL_SOCKET_POOL, 1024 net::HttpNetworkSession::NORMAL_SOCKET_POOL,
1028 std::max(std::min(max_per_proxy, 99), 1025 std::max(std::min(max_per_proxy, 99),
(...skipping 18 matching lines...) Expand all
1047 // However, policy fetches from the network and loading of disk caches 1044 // However, policy fetches from the network and loading of disk caches
1048 // requires that threads are running; this Init() call lets the connector 1045 // requires that threads are running; this Init() call lets the connector
1049 // resume its initialization now that the loops are spinning and the 1046 // resume its initialization now that the loops are spinning and the
1050 // system request context is available for the fetchers. 1047 // system request context is available for the fetchers.
1051 browser_policy_connector()->Init(local_state(), system_request_context()); 1048 browser_policy_connector()->Init(local_state(), system_request_context());
1052 #endif 1049 #endif
1053 1050
1054 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) 1051 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled))
1055 ApplyDefaultBrowserPolicy(); 1052 ApplyDefaultBrowserPolicy();
1056 1053
1057 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 1054 #if !defined(OS_ANDROID) && !defined(OS_IOS)
1058 ApplyMetricsReportingPolicy(); 1055 ApplyMetricsReportingPolicy();
1059 #endif 1056 #endif
1060 1057
1061 #if defined(ENABLE_PLUGINS) 1058 #if defined(ENABLE_PLUGINS)
1062 PluginService* plugin_service = PluginService::GetInstance(); 1059 PluginService* plugin_service = PluginService::GetInstance();
1063 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); 1060 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance());
1064 plugin_service->StartWatchingPlugins(); 1061 plugin_service->StartWatchingPlugins();
1065 1062
1066 #if defined(OS_POSIX) 1063 #if defined(OS_POSIX)
1067 // Also find plugins in a user-specific plugins dir, 1064 // Also find plugins in a user-specific plugins dir,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 set_browser_worker->StartSetAsDefault(); 1206 set_browser_worker->StartSetAsDefault();
1210 } 1207 }
1211 } 1208 }
1212 1209
1213 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { 1210 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() {
1214 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); 1211 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
1215 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); 1212 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value);
1216 } 1213 }
1217 1214
1218 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { 1215 void BrowserProcessImpl::ApplyMetricsReportingPolicy() {
1219 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 1216 #if !defined(OS_ANDROID) && !defined(OS_IOS)
1220 CHECK(BrowserThread::PostTask( 1217 CHECK(BrowserThread::PostTask(
1221 BrowserThread::FILE, FROM_HERE, 1218 BrowserThread::FILE, FROM_HERE,
1222 base::Bind( 1219 base::Bind(
1223 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), 1220 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent),
1224 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()))); 1221 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled())));
1225 #endif 1222 #endif
1226 } 1223 }
1227 1224
1228 void BrowserProcessImpl::CacheDefaultWebClientState() { 1225 void BrowserProcessImpl::CacheDefaultWebClientState() {
1229 #if defined(OS_CHROMEOS) 1226 #if defined(OS_CHROMEOS)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 } 1282 }
1286 1283
1287 void BrowserProcessImpl::OnAutoupdateTimer() { 1284 void BrowserProcessImpl::OnAutoupdateTimer() {
1288 if (CanAutorestartForUpdate()) { 1285 if (CanAutorestartForUpdate()) {
1289 DLOG(WARNING) << "Detected update. Restarting browser."; 1286 DLOG(WARNING) << "Detected update. Restarting browser.";
1290 RestartBackgroundInstance(); 1287 RestartBackgroundInstance();
1291 } 1288 }
1292 } 1289 }
1293 1290
1294 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1291 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main.cc » ('j') | chrome/browser/chrome_browser_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698