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

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

Issue 136403003: Merge 244499 "Delay setting the consent to send settings until a..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1700/src/
Patch Set: Created 6 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy, 875 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy,
876 base::Unretained(this))); 876 base::Unretained(this)));
877 877
878 // This preference must be kept in sync with external values; update them 878 // This preference must be kept in sync with external values; update them
879 // whenever the preference or its controlling policy changes. 879 // whenever the preference or its controlling policy changes.
880 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 880 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
881 pref_change_registrar_.Add( 881 pref_change_registrar_.Add(
882 prefs::kMetricsReportingEnabled, 882 prefs::kMetricsReportingEnabled,
883 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy, 883 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy,
884 base::Unretained(this))); 884 base::Unretained(this)));
885 ApplyMetricsReportingPolicy();
886 #endif 885 #endif
887 886
888 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); 887 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy);
889 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( 888 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(
890 net::HttpNetworkSession::NORMAL_SOCKET_POOL, 889 net::HttpNetworkSession::NORMAL_SOCKET_POOL,
891 std::max(std::min(max_per_proxy, 99), 890 std::max(std::min(max_per_proxy, 99),
892 net::ClientSocketPoolManager::max_sockets_per_group( 891 net::ClientSocketPoolManager::max_sockets_per_group(
893 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); 892 net::HttpNetworkSession::NORMAL_SOCKET_POOL)));
894 } 893 }
895 894
896 void BrowserProcessImpl::PreCreateThreads() { 895 void BrowserProcessImpl::PreCreateThreads() {
897 io_thread_.reset(new IOThread(local_state(), policy_service(), net_log_.get(), 896 io_thread_.reset(new IOThread(local_state(), policy_service(), net_log_.get(),
898 extension_event_router_forwarder_.get())); 897 extension_event_router_forwarder_.get()));
899 } 898 }
900 899
901 void BrowserProcessImpl::PreMainMessageLoopRun() { 900 void BrowserProcessImpl::PreMainMessageLoopRun() {
902 #if defined(ENABLE_CONFIGURATION_POLICY) 901 #if defined(ENABLE_CONFIGURATION_POLICY)
903 // browser_policy_connector() is created very early because local_state() 902 // browser_policy_connector() is created very early because local_state()
904 // needs policy to be initialized with the managed preference values. 903 // needs policy to be initialized with the managed preference values.
905 // However, policy fetches from the network and loading of disk caches 904 // However, policy fetches from the network and loading of disk caches
906 // requires that threads are running; this Init() call lets the connector 905 // requires that threads are running; this Init() call lets the connector
907 // resume its initialization now that the loops are spinning and the 906 // resume its initialization now that the loops are spinning and the
908 // system request context is available for the fetchers. 907 // system request context is available for the fetchers.
909 browser_policy_connector()->Init(local_state(), system_request_context()); 908 browser_policy_connector()->Init(local_state(), system_request_context());
910 #endif 909 #endif
911 910
912 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) 911 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled))
913 ApplyDefaultBrowserPolicy(); 912 ApplyDefaultBrowserPolicy();
914 913
914 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
915 ApplyMetricsReportingPolicy();
916 #endif
917
915 #if defined(ENABLE_PLUGINS) 918 #if defined(ENABLE_PLUGINS)
916 PluginService* plugin_service = PluginService::GetInstance(); 919 PluginService* plugin_service = PluginService::GetInstance();
917 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); 920 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance());
918 plugin_service->StartWatchingPlugins(); 921 plugin_service->StartWatchingPlugins();
919 922
920 #if defined(OS_POSIX) 923 #if defined(OS_POSIX)
921 // Also find plugins in a user-specific plugins dir, 924 // Also find plugins in a user-specific plugins dir,
922 // e.g. ~/.config/chromium/Plugins. 925 // e.g. ~/.config/chromium/Plugins.
923 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); 926 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
924 if (!cmd_line.HasSwitch(switches::kDisablePluginsDiscovery)) { 927 if (!cmd_line.HasSwitch(switches::kDisablePluginsDiscovery)) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 } 1033 }
1031 } 1034 }
1032 1035
1033 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { 1036 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() {
1034 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); 1037 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
1035 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); 1038 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value);
1036 } 1039 }
1037 1040
1038 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { 1041 void BrowserProcessImpl::ApplyMetricsReportingPolicy() {
1039 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 1042 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
1040 BrowserThread::PostTask( 1043 CHECK(BrowserThread::PostTask(
1041 BrowserThread::FILE, FROM_HERE, 1044 BrowserThread::FILE, FROM_HERE,
1042 base::Bind( 1045 base::Bind(
1043 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), 1046 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent),
1044 local_state()->GetBoolean(prefs::kMetricsReportingEnabled))); 1047 local_state()->GetBoolean(prefs::kMetricsReportingEnabled))));
1045 #endif 1048 #endif
1046 } 1049 }
1047 1050
1048 // Mac is currently not supported. 1051 // Mac is currently not supported.
1049 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1052 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
1050 1053
1051 bool BrowserProcessImpl::CanAutorestartForUpdate() const { 1054 bool BrowserProcessImpl::CanAutorestartForUpdate() const {
1052 // Check if browser is in the background and if it needs to be restarted to 1055 // Check if browser is in the background and if it needs to be restarted to
1053 // apply a pending update. 1056 // apply a pending update.
1054 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() && 1057 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() &&
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 } 1098 }
1096 1099
1097 void BrowserProcessImpl::OnAutoupdateTimer() { 1100 void BrowserProcessImpl::OnAutoupdateTimer() {
1098 if (CanAutorestartForUpdate()) { 1101 if (CanAutorestartForUpdate()) {
1099 DLOG(WARNING) << "Detected update. Restarting browser."; 1102 DLOG(WARNING) << "Detected update. Restarting browser.";
1100 RestartBackgroundInstance(); 1103 RestartBackgroundInstance();
1101 } 1104 }
1102 } 1105 }
1103 1106
1104 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1107 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698