| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 214 |
| 215 extensions_browser_client_.reset( | 215 extensions_browser_client_.reset( |
| 216 new extensions::ChromeExtensionsBrowserClient); | 216 new extensions::ChromeExtensionsBrowserClient); |
| 217 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); | 217 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); |
| 218 #endif | 218 #endif |
| 219 | 219 |
| 220 message_center::MessageCenter::Initialize(); | 220 message_center::MessageCenter::Initialize(); |
| 221 | 221 |
| 222 omaha_query_params::OmahaQueryParams::SetDelegate( | 222 omaha_query_params::OmahaQueryParams::SetDelegate( |
| 223 ChromeOmahaQueryParamsDelegate::GetInstance()); | 223 ChromeOmahaQueryParamsDelegate::GetInstance()); |
| 224 |
| 224 } | 225 } |
| 225 | 226 |
| 226 BrowserProcessImpl::~BrowserProcessImpl() { | 227 BrowserProcessImpl::~BrowserProcessImpl() { |
| 227 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); | 228 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); |
| 228 | 229 |
| 229 g_browser_process = NULL; | 230 g_browser_process = NULL; |
| 230 } | 231 } |
| 231 | 232 |
| 232 void BrowserProcessImpl::StartTearDown() { | 233 void BrowserProcessImpl::StartTearDown() { |
| 233 TRACE_EVENT0("shutdown", "BrowserProcessImpl::StartTearDown"); | 234 TRACE_EVENT0("shutdown", "BrowserProcessImpl::StartTearDown"); |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 chrome::RegisterLocalState(pref_registry.get()); | 969 chrome::RegisterLocalState(pref_registry.get()); |
| 969 | 970 |
| 970 local_state_ = | 971 local_state_ = |
| 971 chrome_prefs::CreateLocalState(local_state_path, | 972 chrome_prefs::CreateLocalState(local_state_path, |
| 972 local_state_task_runner_.get(), | 973 local_state_task_runner_.get(), |
| 973 policy_service(), | 974 policy_service(), |
| 974 pref_registry, | 975 pref_registry, |
| 975 false).Pass(); | 976 false).Pass(); |
| 976 | 977 |
| 977 pref_change_registrar_.Init(local_state_.get()); | 978 pref_change_registrar_.Init(local_state_.get()); |
| 979 local_pref_change_registrar_.Init(profile_manager() |
| 980 ->GetLastUsedProfileAllowedByPolicy()->GetPrefs()); |
| 981 |
| 978 | 982 |
| 979 // Initialize the notification for the default browser setting policy. | 983 // Initialize the notification for the default browser setting policy. |
| 980 pref_change_registrar_.Add( | 984 pref_change_registrar_.Add( |
| 981 prefs::kDefaultBrowserSettingEnabled, | 985 prefs::kDefaultBrowserSettingEnabled, |
| 982 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy, | 986 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy, |
| 983 base::Unretained(this))); | 987 base::Unretained(this))); |
| 984 | 988 |
| 985 // This preference must be kept in sync with external values; update them | 989 // This preference must be kept in sync with external values; update them |
| 986 // whenever the preference or its controlling policy changes. | 990 // whenever the preference or its controlling policy changes. |
| 987 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 991 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
| 988 pref_change_registrar_.Add( | 992 pref_change_registrar_.Add( |
| 989 prefs::kMetricsReportingEnabled, | 993 prefs::kMetricsReportingEnabled, |
| 990 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy, | 994 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy, |
| 991 base::Unretained(this))); | 995 base::Unretained(this))); |
| 992 #endif | 996 #endif |
| 993 | 997 |
| 994 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); | 998 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); |
| 995 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 999 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 996 net::HttpNetworkSession::NORMAL_SOCKET_POOL, | 1000 net::HttpNetworkSession::NORMAL_SOCKET_POOL, |
| 997 std::max(std::min(max_per_proxy, 99), | 1001 std::max(std::min(max_per_proxy, 99), |
| 998 net::ClientSocketPoolManager::max_sockets_per_group( | 1002 net::ClientSocketPoolManager::max_sockets_per_group( |
| 999 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1003 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| 1004 |
| 1005 // Monitor language preferences change. |
| 1006 local_pref_change_registrar_.Add(prefs::kAcceptLanguages, |
| 1007 base::Bind(&BrowserProcessImpl::OnLanguagesChange, |
| 1008 base::Unretained(this))); |
| 1009 local_pref_change_registrar_.Add(prefs::kApplicationLocale, |
| 1010 base::Bind(&BrowserProcessImpl::OnLanguagesChange, |
| 1011 base::Unretained(this))); |
| 1012 |
| 1013 |
| 1000 } | 1014 } |
| 1001 | 1015 |
| 1002 void BrowserProcessImpl::PreCreateThreads() { | 1016 void BrowserProcessImpl::PreCreateThreads() { |
| 1003 io_thread_.reset( | 1017 io_thread_.reset( |
| 1004 new IOThread(local_state(), policy_service(), net_log_.get(), | 1018 new IOThread(local_state(), policy_service(), net_log_.get(), |
| 1005 extension_event_router_forwarder())); | 1019 extension_event_router_forwarder())); |
| 1006 } | 1020 } |
| 1007 | 1021 |
| 1008 void BrowserProcessImpl::PreMainMessageLoopRun() { | 1022 void BrowserProcessImpl::PreMainMessageLoopRun() { |
| 1009 #if defined(ENABLE_CONFIGURATION_POLICY) | 1023 #if defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 upgrade_util::SetNewCommandLine(new_cl.release()); | 1233 upgrade_util::SetNewCommandLine(new_cl.release()); |
| 1220 } | 1234 } |
| 1221 | 1235 |
| 1222 void BrowserProcessImpl::OnAutoupdateTimer() { | 1236 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1223 if (CanAutorestartForUpdate()) { | 1237 if (CanAutorestartForUpdate()) { |
| 1224 DLOG(WARNING) << "Detected update. Restarting browser."; | 1238 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1225 RestartBackgroundInstance(); | 1239 RestartBackgroundInstance(); |
| 1226 } | 1240 } |
| 1227 } | 1241 } |
| 1228 | 1242 |
| 1243 void BrowserProcessImpl::OnLanguagesChange() { |
| 1244 DLOG(WARNING) << "-----------Browser languages changed---------------"; |
| 1245 VLOG(1) << "-----------Browser languages changed---------------"; |
| 1246 } |
| 1247 |
| 1229 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1248 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |