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

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

Issue 6312121: Add initial device policy infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix race condition and tests. Created 9 years, 10 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 | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/policy/browser_policy_context.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/synchronization/waitable_event.h"
12 #include "base/task.h" 13 #include "base/task.h"
13 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
14 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
15 #include "base/synchronization/waitable_event.h"
16 #include "chrome/browser/automation/automation_provider_list.h" 16 #include "chrome/browser/automation/automation_provider_list.h"
17 #include "chrome/browser/browser_child_process_host.h" 17 #include "chrome/browser/browser_child_process_host.h"
18 #include "chrome/browser/browser_list.h" 18 #include "chrome/browser/browser_list.h"
19 #include "chrome/browser/browser_main.h" 19 #include "chrome/browser/browser_main.h"
20 #include "chrome/browser/browser_process_sub_thread.h" 20 #include "chrome/browser/browser_process_sub_thread.h"
21 #include "chrome/browser/browser_thread.h" 21 #include "chrome/browser/browser_thread.h"
22 #include "chrome/browser/browser_trial.h" 22 #include "chrome/browser/browser_trial.h"
23 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" 23 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h"
24 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" 24 #include "chrome/browser/debugger/devtools_http_protocol_handler.h"
25 #include "chrome/browser/debugger/devtools_manager.h" 25 #include "chrome/browser/debugger/devtools_manager.h"
26 #include "chrome/browser/debugger/devtools_protocol_handler.h" 26 #include "chrome/browser/debugger/devtools_protocol_handler.h"
27 #include "chrome/browser/download/download_file_manager.h" 27 #include "chrome/browser/download/download_file_manager.h"
28 #include "chrome/browser/download/save_file_manager.h" 28 #include "chrome/browser/download/save_file_manager.h"
29 #include "chrome/browser/first_run/first_run.h" 29 #include "chrome/browser/first_run/first_run.h"
30 #include "chrome/browser/google/google_url_tracker.h" 30 #include "chrome/browser/google/google_url_tracker.h"
31 #include "chrome/browser/icon_manager.h" 31 #include "chrome/browser/icon_manager.h"
32 #include "chrome/browser/intranet_redirect_detector.h" 32 #include "chrome/browser/intranet_redirect_detector.h"
33 #include "chrome/browser/io_thread.h" 33 #include "chrome/browser/io_thread.h"
34 #include "chrome/browser/metrics/metrics_service.h" 34 #include "chrome/browser/metrics/metrics_service.h"
35 #include "chrome/browser/net/chrome_net_log.h" 35 #include "chrome/browser/net/chrome_net_log.h"
36 #include "chrome/browser/net/predictor_api.h" 36 #include "chrome/browser/net/predictor_api.h"
37 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 37 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
38 #include "chrome/browser/notifications/notification_ui_manager.h" 38 #include "chrome/browser/notifications/notification_ui_manager.h"
39 #include "chrome/browser/plugin_data_remover.h" 39 #include "chrome/browser/plugin_data_remover.h"
40 #include "chrome/browser/plugin_service.h" 40 #include "chrome/browser/plugin_service.h"
41 #include "chrome/browser/plugin_updater.h" 41 #include "chrome/browser/plugin_updater.h"
42 #include "chrome/browser/policy/configuration_policy_provider_keeper.h" 42 #include "chrome/browser/policy/browser_policy_context.h"
43 #include "chrome/browser/prefs/pref_service.h" 43 #include "chrome/browser/prefs/pref_service.h"
44 #include "chrome/browser/printing/print_job_manager.h" 44 #include "chrome/browser/printing/print_job_manager.h"
45 #include "chrome/browser/printing/print_preview_tab_controller.h" 45 #include "chrome/browser/printing/print_preview_tab_controller.h"
46 #include "chrome/browser/profiles/profile_manager.h" 46 #include "chrome/browser/profiles/profile_manager.h"
47 #include "chrome/browser/renderer_host/render_process_host.h" 47 #include "chrome/browser/renderer_host/render_process_host.h"
48 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 48 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
49 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 49 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
50 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 50 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
51 #include "chrome/browser/shell_integration.h" 51 #include "chrome/browser/shell_integration.h"
52 #include "chrome/browser/sidebar/sidebar_manager.h" 52 #include "chrome/browser/sidebar/sidebar_manager.h"
53 #include "chrome/browser/tab_closeable_state_watcher.h" 53 #include "chrome/browser/tab_closeable_state_watcher.h"
54 #include "chrome/common/chrome_constants.h" 54 #include "chrome/common/chrome_constants.h"
55 #include "chrome/common/chrome_paths.h" 55 #include "chrome/common/chrome_paths.h"
56 #include "chrome/common/chrome_switches.h" 56 #include "chrome/common/chrome_switches.h"
57 #include "chrome/common/extensions/extension_l10n_util.h"
57 #include "chrome/common/extensions/extension_resource.h" 58 #include "chrome/common/extensions/extension_resource.h"
58 #include "chrome/common/extensions/extension_l10n_util.h"
59 #include "chrome/common/json_pref_store.h" 59 #include "chrome/common/json_pref_store.h"
60 #include "chrome/common/notification_service.h" 60 #include "chrome/common/notification_service.h"
61 #include "chrome/common/pref_names.h" 61 #include "chrome/common/pref_names.h"
62 #include "chrome/common/switch_utils.h"
62 #include "chrome/common/url_constants.h" 63 #include "chrome/common/url_constants.h"
63 #include "chrome/common/switch_utils.h"
64 #include "chrome/installer/util/google_update_constants.h" 64 #include "chrome/installer/util/google_update_constants.h"
65 #include "ipc/ipc_logging.h" 65 #include "ipc/ipc_logging.h"
66 #include "ui/base/clipboard/clipboard.h" 66 #include "ui/base/clipboard/clipboard.h"
67 #include "ui/base/l10n/l10n_util.h" 67 #include "ui/base/l10n/l10n_util.h"
68 #include "webkit/database/database_tracker.h" 68 #include "webkit/database/database_tracker.h"
69 69
70 #if defined(OS_WIN) 70 #if defined(OS_WIN)
71 #include "views/focus/view_storage.h" 71 #include "views/focus/view_storage.h"
72 #endif 72 #endif
73 73
(...skipping 21 matching lines...) Expand all
95 created_io_thread_(false), 95 created_io_thread_(false),
96 created_file_thread_(false), 96 created_file_thread_(false),
97 created_db_thread_(false), 97 created_db_thread_(false),
98 created_process_launcher_thread_(false), 98 created_process_launcher_thread_(false),
99 created_cache_thread_(false), 99 created_cache_thread_(false),
100 created_profile_manager_(false), 100 created_profile_manager_(false),
101 created_local_state_(false), 101 created_local_state_(false),
102 created_icon_manager_(false), 102 created_icon_manager_(false),
103 created_devtools_manager_(false), 103 created_devtools_manager_(false),
104 created_sidebar_manager_(false), 104 created_sidebar_manager_(false),
105 created_configuration_policy_provider_keeper_(false),
106 created_notification_ui_manager_(false), 105 created_notification_ui_manager_(false),
107 created_safe_browsing_detection_service_(false), 106 created_safe_browsing_detection_service_(false),
108 module_ref_count_(0), 107 module_ref_count_(0),
109 did_start_(false), 108 did_start_(false),
110 checked_for_new_frames_(false), 109 checked_for_new_frames_(false),
111 using_new_frames_(false), 110 using_new_frames_(false),
112 have_inspector_files_(true) { 111 have_inspector_files_(true) {
113 g_browser_process = this; 112 g_browser_process = this;
114 clipboard_.reset(new ui::Clipboard); 113 clipboard_.reset(new ui::Clipboard);
115 main_notification_service_.reset(new NotificationService); 114 main_notification_service_.reset(new NotificationService);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (resource_dispatcher_host_.get()) { 179 if (resource_dispatcher_host_.get()) {
181 // Need to tell Safe Browsing Service that the IO thread is going away 180 // Need to tell Safe Browsing Service that the IO thread is going away
182 // since it cached a pointer to it. 181 // since it cached a pointer to it.
183 if (resource_dispatcher_host()->safe_browsing_service()) 182 if (resource_dispatcher_host()->safe_browsing_service())
184 resource_dispatcher_host()->safe_browsing_service()->ShutDown(); 183 resource_dispatcher_host()->safe_browsing_service()->ShutDown();
185 184
186 // Cancel pending requests and prevent new requests. 185 // Cancel pending requests and prevent new requests.
187 resource_dispatcher_host()->Shutdown(); 186 resource_dispatcher_host()->Shutdown();
188 } 187 }
189 188
190 // The policy providers managed by |configuration_policy_provider_keeper_| 189 // The policy providers managed by |browser_policy_context_| need to shut down
191 // need to shut down while the file thread is still alive. 190 // while the IO and FILE threads are still alive.
192 configuration_policy_provider_keeper_.reset(); 191 browser_policy_context_.reset();
193 192
194 #if defined(USE_X11) 193 #if defined(USE_X11)
195 // The IO thread must outlive the BACKGROUND_X11 thread. 194 // The IO thread must outlive the BACKGROUND_X11 thread.
196 background_x11_thread_.reset(); 195 background_x11_thread_.reset();
197 #endif 196 #endif
198 197
199 // Wait for removing plugin data to finish before shutting down the IO thread. 198 // Wait for removing plugin data to finish before shutting down the IO thread.
200 WaitForPluginDataRemoverToFinish(); 199 WaitForPluginDataRemoverToFinish();
201 200
202 // Need to stop io_thread_ before resource_dispatcher_host_, since 201 // Need to stop io_thread_ before resource_dispatcher_host_, since
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 return clipboard_.get(); 422 return clipboard_.get();
424 } 423 }
425 424
426 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { 425 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() {
427 DCHECK(CalledOnValidThread()); 426 DCHECK(CalledOnValidThread());
428 if (!created_notification_ui_manager_) 427 if (!created_notification_ui_manager_)
429 CreateNotificationUIManager(); 428 CreateNotificationUIManager();
430 return notification_ui_manager_.get(); 429 return notification_ui_manager_.get();
431 } 430 }
432 431
433 policy::ConfigurationPolicyProviderKeeper* 432 policy::BrowserPolicyContext* BrowserProcessImpl::browser_policy_context() {
434 BrowserProcessImpl::configuration_policy_provider_keeper() {
435 DCHECK(CalledOnValidThread()); 433 DCHECK(CalledOnValidThread());
436 if (!created_configuration_policy_provider_keeper_) { 434 if (!created_browser_policy_context_) {
437 DCHECK(configuration_policy_provider_keeper_.get() == NULL); 435 DCHECK(browser_policy_context_.get() == NULL);
438 created_configuration_policy_provider_keeper_ = true; 436 created_browser_policy_context_ = true;
439 configuration_policy_provider_keeper_.reset( 437 browser_policy_context_.reset(new policy::BrowserPolicyContext());
440 new policy::ConfigurationPolicyProviderKeeper());
441 } 438 }
442 return configuration_policy_provider_keeper_.get(); 439 return browser_policy_context_.get();
443 } 440 }
444 441
445 IconManager* BrowserProcessImpl::icon_manager() { 442 IconManager* BrowserProcessImpl::icon_manager() {
446 DCHECK(CalledOnValidThread()); 443 DCHECK(CalledOnValidThread());
447 if (!created_icon_manager_) 444 if (!created_icon_manager_)
448 CreateIconManager(); 445 CreateIconManager();
449 return icon_manager_.get(); 446 return icon_manager_.get();
450 } 447 }
451 448
452 ThumbnailGenerator* BrowserProcessImpl::GetThumbnailGenerator() { 449 ThumbnailGenerator* BrowserProcessImpl::GetThumbnailGenerator() {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 938 }
942 939
943 void BrowserProcessImpl::OnAutoupdateTimer() { 940 void BrowserProcessImpl::OnAutoupdateTimer() {
944 if (CanAutorestartForUpdate()) { 941 if (CanAutorestartForUpdate()) {
945 DLOG(WARNING) << "Detected update. Restarting browser."; 942 DLOG(WARNING) << "Detected update. Restarting browser.";
946 RestartPersistentInstance(); 943 RestartPersistentInstance();
947 } 944 }
948 } 945 }
949 946
950 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 947 #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/policy/browser_policy_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698