Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include "chrome/browser/io_thread.h" | 36 #include "chrome/browser/io_thread.h" |
| 37 #include "chrome/browser/metrics/metrics_service.h" | 37 #include "chrome/browser/metrics/metrics_service.h" |
| 38 #include "chrome/browser/metrics/thread_watcher.h" | 38 #include "chrome/browser/metrics/thread_watcher.h" |
| 39 #include "chrome/browser/net/chrome_net_log.h" | 39 #include "chrome/browser/net/chrome_net_log.h" |
| 40 #include "chrome/browser/net/predictor_api.h" | 40 #include "chrome/browser/net/predictor_api.h" |
| 41 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 41 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| 42 #include "chrome/browser/notifications/notification_ui_manager.h" | 42 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 43 #include "chrome/browser/platform_util.h" | 43 #include "chrome/browser/platform_util.h" |
| 44 #include "chrome/browser/plugin_data_remover.h" | 44 #include "chrome/browser/plugin_data_remover.h" |
| 45 #include "chrome/browser/policy/browser_policy_connector.h" | 45 #include "chrome/browser/policy/browser_policy_connector.h" |
| 46 #include "chrome/browser/policy/profile_policy_connector.h" | |
|
Mattias Nissler (ping if slow)
2011/05/26 10:20:20
alphabetize
sfeuz
2011/05/31 07:32:31
Done.
| |
| 47 #include "chrome/browser/policy/cloud_policy_cache_base.h" | |
| 48 #include "chrome/browser/policy/configuration_policy_pref_store.h" | |
| 46 #include "chrome/browser/prefs/browser_prefs.h" | 49 #include "chrome/browser/prefs/browser_prefs.h" |
| 47 #include "chrome/browser/prefs/pref_service.h" | 50 #include "chrome/browser/prefs/pref_service.h" |
| 48 #include "chrome/browser/printing/background_printing_manager.h" | 51 #include "chrome/browser/printing/background_printing_manager.h" |
| 49 #include "chrome/browser/printing/print_job_manager.h" | 52 #include "chrome/browser/printing/print_job_manager.h" |
| 50 #include "chrome/browser/printing/print_preview_tab_controller.h" | 53 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 51 #include "chrome/browser/profiles/profile_manager.h" | 54 #include "chrome/browser/profiles/profile_manager.h" |
| 52 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 55 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 53 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 56 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 54 #include "chrome/browser/shell_integration.h" | 57 #include "chrome/browser/shell_integration.h" |
| 55 #include "chrome/browser/sidebar/sidebar_manager.h" | 58 #include "chrome/browser/sidebar/sidebar_manager.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 created_watchdog_thread_(false), | 122 created_watchdog_thread_(false), |
| 120 #if defined(OS_CHROMEOS) | 123 #if defined(OS_CHROMEOS) |
| 121 created_web_socket_proxy_thread_(false), | 124 created_web_socket_proxy_thread_(false), |
| 122 #endif | 125 #endif |
| 123 created_profile_manager_(false), | 126 created_profile_manager_(false), |
| 124 created_local_state_(false), | 127 created_local_state_(false), |
| 125 created_icon_manager_(false), | 128 created_icon_manager_(false), |
| 126 created_devtools_manager_(false), | 129 created_devtools_manager_(false), |
| 127 created_sidebar_manager_(false), | 130 created_sidebar_manager_(false), |
| 128 created_browser_policy_connector_(false), | 131 created_browser_policy_connector_(false), |
| 132 created_user_policy_connector_(false), | |
| 133 created_managed_cloud_policy_provider_(false), | |
| 134 created_recommended_cloud_policy_provider_(false), | |
| 129 created_notification_ui_manager_(false), | 135 created_notification_ui_manager_(false), |
| 130 created_safe_browsing_detection_service_(false), | 136 created_safe_browsing_detection_service_(false), |
| 131 module_ref_count_(0), | 137 module_ref_count_(0), |
| 132 did_start_(false), | 138 did_start_(false), |
| 133 checked_for_new_frames_(false), | 139 checked_for_new_frames_(false), |
| 134 using_new_frames_(false) { | 140 using_new_frames_(false) { |
| 135 g_browser_process = this; | 141 g_browser_process = this; |
| 136 clipboard_.reset(new ui::Clipboard); | 142 clipboard_.reset(new ui::Clipboard); |
| 137 main_notification_service_.reset(new NotificationService); | 143 main_notification_service_.reset(new NotificationService); |
| 138 | 144 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 | 223 |
| 218 // Cancel pending requests and prevent new requests. | 224 // Cancel pending requests and prevent new requests. |
| 219 resource_dispatcher_host()->Shutdown(); | 225 resource_dispatcher_host()->Shutdown(); |
| 220 } | 226 } |
| 221 | 227 |
| 222 ExtensionTabIdMap::GetInstance()->Shutdown(); | 228 ExtensionTabIdMap::GetInstance()->Shutdown(); |
| 223 | 229 |
| 224 // The policy providers managed by |browser_policy_connector_| need to shut | 230 // The policy providers managed by |browser_policy_connector_| need to shut |
| 225 // down while the IO and FILE threads are still alive. | 231 // down while the IO and FILE threads are still alive. |
| 226 browser_policy_connector_.reset(); | 232 browser_policy_connector_.reset(); |
| 233 user_policy_connector_.reset(); | |
| 234 managed_cloud_policy_provider_.reset(); | |
| 235 recommended_cloud_policy_provider_.reset(); | |
| 227 | 236 |
| 228 #if defined(USE_X11) | 237 #if defined(USE_X11) |
| 229 // The IO thread must outlive the BACKGROUND_X11 thread. | 238 // The IO thread must outlive the BACKGROUND_X11 thread. |
| 230 background_x11_thread_.reset(); | 239 background_x11_thread_.reset(); |
| 231 #endif | 240 #endif |
| 232 | 241 |
| 233 // Wait for removing plugin data to finish before shutting down the IO thread. | 242 // Wait for removing plugin data to finish before shutting down the IO thread. |
| 234 WaitForPluginDataRemoverToFinish(); | 243 WaitForPluginDataRemoverToFinish(); |
| 235 | 244 |
| 236 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 245 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { | 532 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { |
| 524 DCHECK(CalledOnValidThread()); | 533 DCHECK(CalledOnValidThread()); |
| 525 if (!created_browser_policy_connector_) { | 534 if (!created_browser_policy_connector_) { |
| 526 DCHECK(browser_policy_connector_.get() == NULL); | 535 DCHECK(browser_policy_connector_.get() == NULL); |
| 527 created_browser_policy_connector_ = true; | 536 created_browser_policy_connector_ = true; |
| 528 browser_policy_connector_.reset(policy::BrowserPolicyConnector::Create()); | 537 browser_policy_connector_.reset(policy::BrowserPolicyConnector::Create()); |
| 529 } | 538 } |
| 530 return browser_policy_connector_.get(); | 539 return browser_policy_connector_.get(); |
| 531 } | 540 } |
| 532 | 541 |
| 542 policy::ProfilePolicyConnector* BrowserProcessImpl::user_policy_connector() { | |
| 543 DCHECK(CalledOnValidThread()); | |
| 544 if (!created_user_policy_connector_) { | |
| 545 DCHECK(user_policy_connector_.get() == NULL); | |
| 546 created_user_policy_connector_ = true; | |
| 547 user_policy_connector_.reset(policy::ProfilePolicyConnector::Create()); | |
| 548 } | |
| 549 return user_policy_connector_.get(); | |
| 550 } | |
| 551 | |
| 552 policy::ConfigurationPolicyProvider* | |
| 553 BrowserProcessImpl::managed_cloud_policy_provider() { | |
| 554 DCHECK(CalledOnValidThread()); | |
| 555 if (!created_managed_cloud_policy_provider_) { | |
| 556 DCHECK(!managed_cloud_policy_provider_.get()); | |
| 557 created_managed_cloud_policy_provider_ = true; | |
| 558 // Combining UserPolicy and DevicePolicy. | |
|
Mattias Nissler (ping if slow)
2011/05/26 10:20:20
The spelling of "UserPolicy" and "DevicePolicy" su
sfeuz
2011/05/31 07:32:31
Done.
| |
| 559 managed_cloud_policy_provider_.reset( | |
| 560 new policy::CombiningCloudPolicyProvider( | |
| 561 policy::ConfigurationPolicyPrefStore:: | |
|
Mattias Nissler (ping if slow)
2011/05/26 10:20:20
Indentation
sfeuz
2011/05/31 07:32:31
Done.
| |
| 562 GetChromePolicyDefinitionList())); | |
| 563 // UserPolicy taking precedence. | |
| 564 policy::CloudPolicyProvider* user_policy = | |
| 565 user_policy_connector()->GetManagedCloudProvider(); | |
| 566 if (user_policy) | |
| 567 managed_cloud_policy_provider_.get()->AddCloudPolicyProvider(user_policy); | |
| 568 | |
| 569 policy::CloudPolicyProvider* device_policy = | |
| 570 browser_policy_connector()->GetManagedCloudProvider(); | |
| 571 if (device_policy) | |
|
Mattias Nissler (ping if slow)
2011/05/26 10:20:20
Need curlies for multi-line conditional blocks
sfeuz
2011/05/31 07:32:31
Done.
| |
| 572 managed_cloud_policy_provider_.get()-> | |
| 573 AddCloudPolicyProvider(device_policy); | |
|
Mattias Nissler (ping if slow)
2011/05/26 10:20:20
Indentation
sfeuz
2011/05/31 07:32:31
Done.
| |
| 574 } | |
| 575 return managed_cloud_policy_provider_.get(); | |
| 576 } | |
| 577 | |
| 578 policy::ConfigurationPolicyProvider* | |
| 579 BrowserProcessImpl::recommended_cloud_policy_provider() { | |
| 580 DCHECK(CalledOnValidThread()); | |
| 581 if (!created_recommended_cloud_policy_provider_) { | |
| 582 DCHECK(!recommended_cloud_policy_provider_.get()); | |
| 583 created_recommended_cloud_policy_provider_ = true; | |
| 584 // Combining UserPolicy and DevicePolicy. | |
| 585 recommended_cloud_policy_provider_.reset( | |
| 586 new policy::CombiningCloudPolicyProvider( | |
| 587 policy::ConfigurationPolicyPrefStore:: | |
| 588 GetChromePolicyDefinitionList())); | |
| 589 // UserPolicy taking precedence. | |
| 590 policy::CloudPolicyProvider* user_policy = | |
| 591 user_policy_connector()->GetRecommendedCloudProvider(); | |
| 592 if (user_policy) | |
| 593 recommended_cloud_policy_provider_.get()-> | |
| 594 AddCloudPolicyProvider(user_policy); | |
| 595 | |
| 596 policy::CloudPolicyProvider* device_policy = | |
| 597 browser_policy_connector()->GetRecommendedCloudProvider(); | |
| 598 if (device_policy) | |
| 599 recommended_cloud_policy_provider_.get()-> | |
| 600 AddCloudPolicyProvider(device_policy); | |
| 601 } | |
| 602 return recommended_cloud_policy_provider_.get(); | |
| 603 } | |
| 604 | |
| 533 IconManager* BrowserProcessImpl::icon_manager() { | 605 IconManager* BrowserProcessImpl::icon_manager() { |
| 534 DCHECK(CalledOnValidThread()); | 606 DCHECK(CalledOnValidThread()); |
| 535 if (!created_icon_manager_) | 607 if (!created_icon_manager_) |
| 536 CreateIconManager(); | 608 CreateIconManager(); |
| 537 return icon_manager_.get(); | 609 return icon_manager_.get(); |
| 538 } | 610 } |
| 539 | 611 |
| 540 ThumbnailGenerator* BrowserProcessImpl::GetThumbnailGenerator() { | 612 ThumbnailGenerator* BrowserProcessImpl::GetThumbnailGenerator() { |
| 541 return &thumbnail_generator_; | 613 return &thumbnail_generator_; |
| 542 } | 614 } |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1121 } | 1193 } |
| 1122 | 1194 |
| 1123 void BrowserProcessImpl::OnAutoupdateTimer() { | 1195 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1124 if (CanAutorestartForUpdate()) { | 1196 if (CanAutorestartForUpdate()) { |
| 1125 DLOG(WARNING) << "Detected update. Restarting browser."; | 1197 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1126 RestartPersistentInstance(); | 1198 RestartPersistentInstance(); |
| 1127 } | 1199 } |
| 1128 } | 1200 } |
| 1129 | 1201 |
| 1130 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1202 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |