OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 set_browser_worker->StartSetAsDefault(); | 1207 set_browser_worker->StartSetAsDefault(); |
1211 } | 1208 } |
1212 } | 1209 } |
1213 | 1210 |
1214 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { | 1211 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { |
1215 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); | 1212 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); |
1216 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); | 1213 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); |
1217 } | 1214 } |
1218 | 1215 |
1219 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { | 1216 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { |
1220 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 1217 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
1221 CHECK(BrowserThread::PostTask( | 1218 CHECK(BrowserThread::PostTask( |
1222 BrowserThread::FILE, FROM_HERE, | 1219 BrowserThread::FILE, FROM_HERE, |
1223 base::Bind( | 1220 base::Bind( |
1224 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), | 1221 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), |
1225 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()))); | 1222 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()))); |
1226 #endif | 1223 #endif |
1227 } | 1224 } |
1228 | 1225 |
1229 void BrowserProcessImpl::CacheDefaultWebClientState() { | 1226 void BrowserProcessImpl::CacheDefaultWebClientState() { |
1230 #if defined(OS_CHROMEOS) | 1227 #if defined(OS_CHROMEOS) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 } | 1283 } |
1287 | 1284 |
1288 void BrowserProcessImpl::OnAutoupdateTimer() { | 1285 void BrowserProcessImpl::OnAutoupdateTimer() { |
1289 if (CanAutorestartForUpdate()) { | 1286 if (CanAutorestartForUpdate()) { |
1290 DLOG(WARNING) << "Detected update. Restarting browser."; | 1287 DLOG(WARNING) << "Detected update. Restarting browser."; |
1291 RestartBackgroundInstance(); | 1288 RestartBackgroundInstance(); |
1292 } | 1289 } |
1293 } | 1290 } |
1294 | 1291 |
1295 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1292 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |