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

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

Powered by Google App Engine
This is Rietveld 408576698