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

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

Issue 1786263002: Remove uses of ENABLE_CONFIGURATION_POLICY from src/chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sort Created 4 years, 9 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
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 <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 #include "chrome/common/url_constants.h" 79 #include "chrome/common/url_constants.h"
80 #include "chrome/installer/util/google_update_constants.h" 80 #include "chrome/installer/util/google_update_constants.h"
81 #include "chrome/installer/util/google_update_settings.h" 81 #include "chrome/installer/util/google_update_settings.h"
82 #include "components/component_updater/component_updater_service.h" 82 #include "components/component_updater/component_updater_service.h"
83 #include "components/gcm_driver/gcm_driver.h" 83 #include "components/gcm_driver/gcm_driver.h"
84 #include "components/metrics/metrics_pref_names.h" 84 #include "components/metrics/metrics_pref_names.h"
85 #include "components/metrics/metrics_service.h" 85 #include "components/metrics/metrics_service.h"
86 #include "components/metrics_services_manager/metrics_services_manager.h" 86 #include "components/metrics_services_manager/metrics_services_manager.h"
87 #include "components/net_log/chrome_net_log.h" 87 #include "components/net_log/chrome_net_log.h"
88 #include "components/network_time/network_time_tracker.h" 88 #include "components/network_time/network_time_tracker.h"
89 #include "components/policy/core/browser/browser_policy_connector.h"
89 #include "components/policy/core/common/policy_service.h" 90 #include "components/policy/core/common/policy_service.h"
90 #include "components/prefs/json_pref_store.h" 91 #include "components/prefs/json_pref_store.h"
91 #include "components/prefs/pref_registry_simple.h" 92 #include "components/prefs/pref_registry_simple.h"
92 #include "components/prefs/pref_service.h" 93 #include "components/prefs/pref_service.h"
93 #include "components/safe_json/safe_json_parser.h" 94 #include "components/safe_json/safe_json_parser.h"
94 #include "components/signin/core/common/profile_management_switches.h" 95 #include "components/signin/core/common/profile_management_switches.h"
95 #include "components/translate/core/browser/translate_download_manager.h" 96 #include "components/translate/core/browser/translate_download_manager.h"
96 #include "components/update_client/update_query_params.h" 97 #include "components/update_client/update_query_params.h"
97 #include "components/web_resource/promo_resource_service.h" 98 #include "components/web_resource/promo_resource_service.h"
98 #include "components/web_resource/web_resource_pref_names.h" 99 #include "components/web_resource/web_resource_pref_names.h"
(...skipping 24 matching lines...) Expand all
123 #if !defined(OS_ANDROID) 124 #if !defined(OS_ANDROID)
124 #include "chrome/browser/ui/user_manager.h" 125 #include "chrome/browser/ui/user_manager.h"
125 #include "components/gcm_driver/gcm_client_factory.h" 126 #include "components/gcm_driver/gcm_client_factory.h"
126 #include "components/gcm_driver/gcm_desktop_utils.h" 127 #include "components/gcm_driver/gcm_desktop_utils.h"
127 #endif 128 #endif
128 129
129 #if BUILDFLAG(ENABLE_BACKGROUND) 130 #if BUILDFLAG(ENABLE_BACKGROUND)
130 #include "chrome/browser/background/background_mode_manager.h" 131 #include "chrome/browser/background/background_mode_manager.h"
131 #endif 132 #endif
132 133
133 #if defined(ENABLE_CONFIGURATION_POLICY)
134 #include "components/policy/core/browser/browser_policy_connector.h"
135 #else
136 #include "components/policy/core/common/policy_service_stub.h"
137 #endif // defined(ENABLE_CONFIGURATION_POLICY)
138
139 #if defined(ENABLE_EXTENSIONS) 134 #if defined(ENABLE_EXTENSIONS)
140 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" 135 #include "chrome/browser/extensions/chrome_extensions_browser_client.h"
141 #include "chrome/browser/extensions/event_router_forwarder.h" 136 #include "chrome/browser/extensions/event_router_forwarder.h"
142 #include "chrome/browser/extensions/extension_renderer_state.h" 137 #include "chrome/browser/extensions/extension_renderer_state.h"
143 #include "chrome/browser/media_galleries/media_file_system_registry.h" 138 #include "chrome/browser/media_galleries/media_file_system_registry.h"
144 #include "chrome/browser/ui/apps/chrome_app_window_client.h" 139 #include "chrome/browser/ui/apps/chrome_app_window_client.h"
145 #include "components/storage_monitor/storage_monitor.h" 140 #include "components/storage_monitor/storage_monitor.h"
146 #include "extensions/common/extension_l10n_util.h" 141 #include "extensions/common/extension_l10n_util.h"
147 #endif 142 #endif
148 143
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 media_file_system_registry_.reset(); 309 media_file_system_registry_.reset();
315 // Remove the global instance of the Storage Monitor now. Otherwise the 310 // Remove the global instance of the Storage Monitor now. Otherwise the
316 // FILE thread would be gone when we try to release it in the dtor and 311 // FILE thread would be gone when we try to release it in the dtor and
317 // Valgrind would report a leak on almost every single browser_test. 312 // Valgrind would report a leak on almost every single browser_test.
318 // TODO(gbillock): Make this unnecessary. 313 // TODO(gbillock): Make this unnecessary.
319 storage_monitor::StorageMonitor::Destroy(); 314 storage_monitor::StorageMonitor::Destroy();
320 #endif 315 #endif
321 316
322 message_center::MessageCenter::Shutdown(); 317 message_center::MessageCenter::Shutdown();
323 318
324 #if defined(ENABLE_CONFIGURATION_POLICY)
325 // The policy providers managed by |browser_policy_connector_| need to shut 319 // The policy providers managed by |browser_policy_connector_| need to shut
326 // down while the IO and FILE threads are still alive. The monitoring 320 // down while the IO and FILE threads are still alive. The monitoring
327 // framework owned by |browser_policy_connector_| relies on |gcm_driver_|, so 321 // framework owned by |browser_policy_connector_| relies on |gcm_driver_|, so
328 // this must be shutdown before |gcm_driver_| below. 322 // this must be shutdown before |gcm_driver_| below.
329 if (browser_policy_connector_) 323 if (browser_policy_connector_)
330 browser_policy_connector_->Shutdown(); 324 browser_policy_connector_->Shutdown();
331 #endif
332 325
333 // The |gcm_driver_| must shut down while the IO thread is still alive. 326 // The |gcm_driver_| must shut down while the IO thread is still alive.
334 if (gcm_driver_) 327 if (gcm_driver_)
335 gcm_driver_->Shutdown(); 328 gcm_driver_->Shutdown();
336 329
337 // Stop the watchdog thread before stopping other threads. 330 // Stop the watchdog thread before stopping other threads.
338 watchdog_thread_.reset(); 331 watchdog_thread_.reset();
339 332
340 platform_part()->StartTearDown(); 333 platform_part()->StartTearDown();
341 334
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 return notification_ui_manager_.get(); 622 return notification_ui_manager_.get();
630 } 623 }
631 624
632 message_center::MessageCenter* BrowserProcessImpl::message_center() { 625 message_center::MessageCenter* BrowserProcessImpl::message_center() {
633 DCHECK(CalledOnValidThread()); 626 DCHECK(CalledOnValidThread());
634 return message_center::MessageCenter::Get(); 627 return message_center::MessageCenter::Get();
635 } 628 }
636 629
637 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { 630 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() {
638 DCHECK(CalledOnValidThread()); 631 DCHECK(CalledOnValidThread());
639 #if defined(ENABLE_CONFIGURATION_POLICY)
640 if (!created_browser_policy_connector_) { 632 if (!created_browser_policy_connector_) {
641 DCHECK(!browser_policy_connector_); 633 DCHECK(!browser_policy_connector_);
642 browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector(); 634 browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector();
643 created_browser_policy_connector_ = true; 635 created_browser_policy_connector_ = true;
644 } 636 }
645 return browser_policy_connector_.get(); 637 return browser_policy_connector_.get();
646 #else
647 return NULL;
648 #endif
649 } 638 }
650 639
651 policy::PolicyService* BrowserProcessImpl::policy_service() { 640 policy::PolicyService* BrowserProcessImpl::policy_service() {
652 #if defined(ENABLE_CONFIGURATION_POLICY)
653 return browser_policy_connector()->GetPolicyService(); 641 return browser_policy_connector()->GetPolicyService();
654 #else
655 if (!policy_service_.get())
656 policy_service_.reset(new policy::PolicyServiceStub());
657 return policy_service_.get();
658 #endif
659 } 642 }
660 643
661 IconManager* BrowserProcessImpl::icon_manager() { 644 IconManager* BrowserProcessImpl::icon_manager() {
662 DCHECK(CalledOnValidThread()); 645 DCHECK(CalledOnValidThread());
663 if (!created_icon_manager_) 646 if (!created_icon_manager_)
664 CreateIconManager(); 647 CreateIconManager();
665 return icon_manager_.get(); 648 return icon_manager_.get();
666 } 649 }
667 650
668 GLStringManager* BrowserProcessImpl::gl_string_manager() { 651 GLStringManager* BrowserProcessImpl::gl_string_manager() {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 io_thread_.reset( 1041 io_thread_.reset(
1059 new IOThread(local_state(), policy_service(), net_log_.get(), 1042 new IOThread(local_state(), policy_service(), net_log_.get(),
1060 extension_event_router_forwarder())); 1043 extension_event_router_forwarder()));
1061 } 1044 }
1062 1045
1063 void BrowserProcessImpl::PreMainMessageLoopRun() { 1046 void BrowserProcessImpl::PreMainMessageLoopRun() {
1064 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun"); 1047 TRACE_EVENT0("startup", "BrowserProcessImpl::PreMainMessageLoopRun");
1065 SCOPED_UMA_HISTOGRAM_TIMER( 1048 SCOPED_UMA_HISTOGRAM_TIMER(
1066 "Startup.BrowserProcessImpl_PreMainMessageLoopRunTime"); 1049 "Startup.BrowserProcessImpl_PreMainMessageLoopRunTime");
1067 1050
1068 #if defined(ENABLE_CONFIGURATION_POLICY)
1069 // browser_policy_connector() is created very early because local_state() 1051 // browser_policy_connector() is created very early because local_state()
1070 // needs policy to be initialized with the managed preference values. 1052 // needs policy to be initialized with the managed preference values.
1071 // However, policy fetches from the network and loading of disk caches 1053 // However, policy fetches from the network and loading of disk caches
1072 // requires that threads are running; this Init() call lets the connector 1054 // requires that threads are running; this Init() call lets the connector
1073 // resume its initialization now that the loops are spinning and the 1055 // resume its initialization now that the loops are spinning and the
1074 // system request context is available for the fetchers. 1056 // system request context is available for the fetchers.
1075 browser_policy_connector()->Init(local_state(), system_request_context()); 1057 browser_policy_connector()->Init(local_state(), system_request_context());
1076 #endif
1077 1058
1078 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) 1059 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled))
1079 ApplyDefaultBrowserPolicy(); 1060 ApplyDefaultBrowserPolicy();
1080 1061
1081 #if !defined(OS_ANDROID) 1062 #if !defined(OS_ANDROID)
1082 ApplyMetricsReportingPolicy(); 1063 ApplyMetricsReportingPolicy();
1083 #endif 1064 #endif
1084 1065
1085 #if defined(ENABLE_PLUGINS) 1066 #if defined(ENABLE_PLUGINS)
1086 PluginService* plugin_service = PluginService::GetInstance(); 1067 PluginService* plugin_service = PluginService::GetInstance();
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 } 1295 }
1315 1296
1316 void BrowserProcessImpl::OnAutoupdateTimer() { 1297 void BrowserProcessImpl::OnAutoupdateTimer() {
1317 if (CanAutorestartForUpdate()) { 1298 if (CanAutorestartForUpdate()) {
1318 DLOG(WARNING) << "Detected update. Restarting browser."; 1299 DLOG(WARNING) << "Detected update. Restarting browser.";
1319 RestartBackgroundInstance(); 1300 RestartBackgroundInstance();
1320 } 1301 }
1321 } 1302 }
1322 1303
1323 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1304 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/browser_process_platform_part_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698