| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 // sources. This has to be done before uninstall code path and before prefs | 670 // sources. This has to be done before uninstall code path and before prefs |
| 671 // are registered. | 671 // are registered. |
| 672 registry->RegisterStringPref(prefs::kApplicationLocale, std::string()); | 672 registry->RegisterStringPref(prefs::kApplicationLocale, std::string()); |
| 673 #if defined(OS_CHROMEOS) | 673 #if defined(OS_CHROMEOS) |
| 674 registry->RegisterStringPref(prefs::kOwnerLocale, std::string()); | 674 registry->RegisterStringPref(prefs::kOwnerLocale, std::string()); |
| 675 registry->RegisterStringPref(prefs::kHardwareKeyboardLayout, | 675 registry->RegisterStringPref(prefs::kHardwareKeyboardLayout, |
| 676 std::string()); | 676 std::string()); |
| 677 #endif // defined(OS_CHROMEOS) | 677 #endif // defined(OS_CHROMEOS) |
| 678 #if !defined(OS_CHROMEOS) | 678 #if !defined(OS_CHROMEOS) |
| 679 registry->RegisterBooleanPref( | 679 registry->RegisterBooleanPref( |
| 680 prefs::kMetricsReportingEnabled, | 680 metrics::prefs::kMetricsReportingEnabled, |
| 681 GoogleUpdateSettings::GetCollectStatsConsent()); | 681 GoogleUpdateSettings::GetCollectStatsConsent()); |
| 682 #endif // !defined(OS_CHROMEOS) | 682 #endif // !defined(OS_CHROMEOS) |
| 683 | 683 |
| 684 #if defined(OS_ANDROID) | 684 #if defined(OS_ANDROID) |
| 685 registry->RegisterBooleanPref( | 685 registry->RegisterBooleanPref( |
| 686 prefs::kCrashReportingEnabled, false); | 686 prefs::kCrashReportingEnabled, false); |
| 687 #endif // defined(OS_ANDROID) | 687 #endif // defined(OS_ANDROID) |
| 688 } | 688 } |
| 689 | 689 |
| 690 DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() { | 690 DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 // Initialize the notification for the default browser setting policy. | 840 // Initialize the notification for the default browser setting policy. |
| 841 pref_change_registrar_.Add( | 841 pref_change_registrar_.Add( |
| 842 prefs::kDefaultBrowserSettingEnabled, | 842 prefs::kDefaultBrowserSettingEnabled, |
| 843 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy, | 843 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy, |
| 844 base::Unretained(this))); | 844 base::Unretained(this))); |
| 845 | 845 |
| 846 // This preference must be kept in sync with external values; update them | 846 // This preference must be kept in sync with external values; update them |
| 847 // whenever the preference or its controlling policy changes. | 847 // whenever the preference or its controlling policy changes. |
| 848 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 848 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
| 849 pref_change_registrar_.Add( | 849 pref_change_registrar_.Add( |
| 850 prefs::kMetricsReportingEnabled, | 850 metrics::prefs::kMetricsReportingEnabled, |
| 851 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy, | 851 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy, |
| 852 base::Unretained(this))); | 852 base::Unretained(this))); |
| 853 #endif | 853 #endif |
| 854 | 854 |
| 855 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); | 855 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); |
| 856 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 856 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 857 net::HttpNetworkSession::NORMAL_SOCKET_POOL, | 857 net::HttpNetworkSession::NORMAL_SOCKET_POOL, |
| 858 std::max(std::min(max_per_proxy, 99), | 858 std::max(std::min(max_per_proxy, 99), |
| 859 net::ClientSocketPoolManager::max_sockets_per_group( | 859 net::ClientSocketPoolManager::max_sockets_per_group( |
| 860 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); | 860 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); | 1005 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); |
| 1006 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); | 1006 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { | 1009 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { |
| 1010 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 1010 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
| 1011 CHECK(BrowserThread::PostTask( | 1011 CHECK(BrowserThread::PostTask( |
| 1012 BrowserThread::FILE, FROM_HERE, | 1012 BrowserThread::FILE, FROM_HERE, |
| 1013 base::Bind( | 1013 base::Bind( |
| 1014 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), | 1014 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), |
| 1015 local_state()->GetBoolean(prefs::kMetricsReportingEnabled)))); | 1015 local_state()->GetBoolean( |
| 1016 metrics::prefs::kMetricsReportingEnabled)))); |
| 1016 #endif | 1017 #endif |
| 1017 } | 1018 } |
| 1018 | 1019 |
| 1019 // Mac is currently not supported. | 1020 // Mac is currently not supported. |
| 1020 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1021 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| 1021 | 1022 |
| 1022 bool BrowserProcessImpl::CanAutorestartForUpdate() const { | 1023 bool BrowserProcessImpl::CanAutorestartForUpdate() const { |
| 1023 // Check if browser is in the background and if it needs to be restarted to | 1024 // Check if browser is in the background and if it needs to be restarted to |
| 1024 // apply a pending update. | 1025 // apply a pending update. |
| 1025 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() && | 1026 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() && |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 } | 1067 } |
| 1067 | 1068 |
| 1068 void BrowserProcessImpl::OnAutoupdateTimer() { | 1069 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1069 if (CanAutorestartForUpdate()) { | 1070 if (CanAutorestartForUpdate()) { |
| 1070 DLOG(WARNING) << "Detected update. Restarting browser."; | 1071 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1071 RestartBackgroundInstance(); | 1072 RestartBackgroundInstance(); |
| 1072 } | 1073 } |
| 1073 } | 1074 } |
| 1074 | 1075 |
| 1075 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1076 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |