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

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

Issue 136713002: Delay setting the consent to send settings until after threads are running (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy, 888 base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy,
889 base::Unretained(this))); 889 base::Unretained(this)));
890 890
891 // This preference must be kept in sync with external values; update them 891 // This preference must be kept in sync with external values; update them
892 // whenever the preference or its controlling policy changes. 892 // whenever the preference or its controlling policy changes.
893 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 893 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
894 pref_change_registrar_.Add( 894 pref_change_registrar_.Add(
895 prefs::kMetricsReportingEnabled, 895 prefs::kMetricsReportingEnabled,
896 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy, 896 base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy,
897 base::Unretained(this))); 897 base::Unretained(this)));
898 ApplyMetricsReportingPolicy();
899 #endif 898 #endif
900 899
901 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy); 900 int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy);
902 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server( 901 net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(
903 net::HttpNetworkSession::NORMAL_SOCKET_POOL, 902 net::HttpNetworkSession::NORMAL_SOCKET_POOL,
904 std::max(std::min(max_per_proxy, 99), 903 std::max(std::min(max_per_proxy, 99),
905 net::ClientSocketPoolManager::max_sockets_per_group( 904 net::ClientSocketPoolManager::max_sockets_per_group(
906 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); 905 net::HttpNetworkSession::NORMAL_SOCKET_POOL)));
907 } 906 }
908 907
909 void BrowserProcessImpl::PreCreateThreads() { 908 void BrowserProcessImpl::PreCreateThreads() {
910 io_thread_.reset(new IOThread(local_state(), policy_service(), net_log_.get(), 909 io_thread_.reset(new IOThread(local_state(), policy_service(), net_log_.get(),
911 extension_event_router_forwarder_.get())); 910 extension_event_router_forwarder_.get()));
912 } 911 }
913 912
914 void BrowserProcessImpl::PreMainMessageLoopRun() { 913 void BrowserProcessImpl::PreMainMessageLoopRun() {
915 #if defined(ENABLE_CONFIGURATION_POLICY) 914 #if defined(ENABLE_CONFIGURATION_POLICY)
916 // browser_policy_connector() is created very early because local_state() 915 // browser_policy_connector() is created very early because local_state()
917 // needs policy to be initialized with the managed preference values. 916 // needs policy to be initialized with the managed preference values.
918 // However, policy fetches from the network and loading of disk caches 917 // However, policy fetches from the network and loading of disk caches
919 // requires that threads are running; this Init() call lets the connector 918 // requires that threads are running; this Init() call lets the connector
920 // resume its initialization now that the loops are spinning and the 919 // resume its initialization now that the loops are spinning and the
921 // system request context is available for the fetchers. 920 // system request context is available for the fetchers.
922 browser_policy_connector()->Init(local_state(), system_request_context()); 921 browser_policy_connector()->Init(local_state(), system_request_context());
923 #endif 922 #endif
924 923
925 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) 924 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled))
926 ApplyDefaultBrowserPolicy(); 925 ApplyDefaultBrowserPolicy();
927 926
927 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
928 ApplyMetricsReportingPolicy();
929 #endif
930
928 #if defined(ENABLE_PLUGINS) 931 #if defined(ENABLE_PLUGINS)
929 PluginService* plugin_service = PluginService::GetInstance(); 932 PluginService* plugin_service = PluginService::GetInstance();
930 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); 933 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance());
931 plugin_service->StartWatchingPlugins(); 934 plugin_service->StartWatchingPlugins();
932 935
933 #if defined(OS_POSIX) 936 #if defined(OS_POSIX)
934 // Also find plugins in a user-specific plugins dir, 937 // Also find plugins in a user-specific plugins dir,
935 // e.g. ~/.config/chromium/Plugins. 938 // e.g. ~/.config/chromium/Plugins.
936 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); 939 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
937 if (!cmd_line.HasSwitch(switches::kDisablePluginsDiscovery)) { 940 if (!cmd_line.HasSwitch(switches::kDisablePluginsDiscovery)) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1046 }
1044 } 1047 }
1045 1048
1046 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { 1049 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() {
1047 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); 1050 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
1048 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); 1051 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value);
1049 } 1052 }
1050 1053
1051 void BrowserProcessImpl::ApplyMetricsReportingPolicy() { 1054 void BrowserProcessImpl::ApplyMetricsReportingPolicy() {
1052 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) 1055 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
1053 BrowserThread::PostTask( 1056 CHECK(BrowserThread::PostTask(
1054 BrowserThread::FILE, FROM_HERE, 1057 BrowserThread::FILE, FROM_HERE,
1055 base::Bind( 1058 base::Bind(
1056 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent), 1059 base::IgnoreResult(&GoogleUpdateSettings::SetCollectStatsConsent),
1057 local_state()->GetBoolean(prefs::kMetricsReportingEnabled))); 1060 local_state()->GetBoolean(prefs::kMetricsReportingEnabled))));
1058 #endif 1061 #endif
1059 } 1062 }
1060 1063
1061 // Mac is currently not supported. 1064 // Mac is currently not supported.
1062 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1065 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
1063 1066
1064 bool BrowserProcessImpl::CanAutorestartForUpdate() const { 1067 bool BrowserProcessImpl::CanAutorestartForUpdate() const {
1065 // Check if browser is in the background and if it needs to be restarted to 1068 // Check if browser is in the background and if it needs to be restarted to
1066 // apply a pending update. 1069 // apply a pending update.
1067 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() && 1070 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() &&
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 } 1111 }
1109 1112
1110 void BrowserProcessImpl::OnAutoupdateTimer() { 1113 void BrowserProcessImpl::OnAutoupdateTimer() {
1111 if (CanAutorestartForUpdate()) { 1114 if (CanAutorestartForUpdate()) {
1112 DLOG(WARNING) << "Detected update. Restarting browser."; 1115 DLOG(WARNING) << "Detected update. Restarting browser.";
1113 RestartBackgroundInstance(); 1116 RestartBackgroundInstance();
1114 } 1117 }
1115 } 1118 }
1116 1119
1117 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1120 #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