Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 #include "content/public/browser/browser_thread.h" | 85 #include "content/public/browser/browser_thread.h" |
| 86 #include "content/public/browser/child_process_security_policy.h" | 86 #include "content/public/browser/child_process_security_policy.h" |
| 87 #include "content/public/browser/notification_details.h" | 87 #include "content/public/browser/notification_details.h" |
| 88 #include "content/public/browser/plugin_service.h" | 88 #include "content/public/browser/plugin_service.h" |
| 89 #include "content/public/browser/render_process_host.h" | 89 #include "content/public/browser/render_process_host.h" |
| 90 #include "content/public/browser/resource_dispatcher_host.h" | 90 #include "content/public/browser/resource_dispatcher_host.h" |
| 91 #include "content/public/browser/service_worker_context.h" | 91 #include "content/public/browser/service_worker_context.h" |
| 92 #include "content/public/browser/storage_partition.h" | 92 #include "content/public/browser/storage_partition.h" |
| 93 #include "extensions/common/constants.h" | 93 #include "extensions/common/constants.h" |
| 94 #include "extensions/common/extension_l10n_util.h" | 94 #include "extensions/common/extension_l10n_util.h" |
| 95 #include "google_apis/gaia/identity_provider.h" | |
| 96 #include "net/socket/client_socket_pool_manager.h" | 95 #include "net/socket/client_socket_pool_manager.h" |
| 97 #include "net/url_request/url_request_context_getter.h" | 96 #include "net/url_request/url_request_context_getter.h" |
| 98 #include "ui/base/l10n/l10n_util.h" | 97 #include "ui/base/l10n/l10n_util.h" |
| 99 #include "ui/message_center/message_center.h" | 98 #include "ui/message_center/message_center.h" |
| 100 | 99 |
| 101 #if defined(ENABLE_CONFIGURATION_POLICY) | 100 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 102 #include "components/policy/core/browser/browser_policy_connector.h" | 101 #include "components/policy/core/browser/browser_policy_connector.h" |
| 103 #else | 102 #else |
| 104 #include "components/policy/core/common/policy_service_stub.h" | 103 #include "components/policy/core/common/policy_service_stub.h" |
| 105 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 104 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 121 #endif | 120 #endif |
| 122 | 121 |
| 123 #if defined(ENABLE_PLUGIN_INSTALLATION) | 122 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 124 #include "chrome/browser/plugins/plugins_resource_service.h" | 123 #include "chrome/browser/plugins/plugins_resource_service.h" |
| 125 #endif | 124 #endif |
| 126 | 125 |
| 127 #if defined(ENABLE_WEBRTC) | 126 #if defined(ENABLE_WEBRTC) |
| 128 #include "chrome/browser/media/webrtc_log_uploader.h" | 127 #include "chrome/browser/media/webrtc_log_uploader.h" |
| 129 #endif | 128 #endif |
| 130 | 129 |
| 131 #if defined(OS_CHROMEOS) | |
| 132 #include "chrome/browser/chromeos/settings/device_identity_provider.h" | |
| 133 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " | |
| 134 #elif !defined(OS_ANDROID) | |
| 135 #include "google_apis/gaia/dummy_identity_provider.h" | |
| 136 #endif | |
| 137 | |
| 138 #if defined(OS_ANDROID) | 130 #if defined(OS_ANDROID) |
| 139 #include "components/gcm_driver/gcm_driver_android.h" | 131 #include "components/gcm_driver/gcm_driver_android.h" |
| 140 #else | 132 #else |
| 141 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" | 133 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" |
| 142 #include "components/gcm_driver/gcm_client_factory.h" | 134 #include "components/gcm_driver/gcm_client_factory.h" |
| 143 #endif | 135 #endif |
| 144 | 136 |
| 145 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 137 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| 146 // How often to check if the persistent instance of Chrome needs to restart | 138 // How often to check if the persistent instance of Chrome needs to restart |
| 147 // to install an update. | 139 // to install an update. |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 void BrowserProcessImpl::CreateGCMDriver() { | 1016 void BrowserProcessImpl::CreateGCMDriver() { |
| 1025 DCHECK(!gcm_driver_); | 1017 DCHECK(!gcm_driver_); |
| 1026 | 1018 |
| 1027 #if defined(OS_ANDROID) | 1019 #if defined(OS_ANDROID) |
| 1028 gcm_driver_.reset(new gcm::GCMDriverAndroid); | 1020 gcm_driver_.reset(new gcm::GCMDriverAndroid); |
| 1029 #else | 1021 #else |
| 1030 base::FilePath store_path; | 1022 base::FilePath store_path; |
| 1031 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); | 1023 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); |
| 1032 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 1024 gcm_driver_ = gcm::CreateGCMDriverDesktop( |
| 1033 make_scoped_ptr(new gcm::GCMClientFactory), | 1025 make_scoped_ptr(new gcm::GCMClientFactory), |
| 1034 #if defined(OS_CHROMEOS) | |
| 1035 scoped_ptr<IdentityProvider>(new chromeos::DeviceIdentityProvider( | |
| 1036 chromeos::DeviceOAuth2TokenServiceFactory::Get())), | |
| 1037 #else | |
| 1038 scoped_ptr<IdentityProvider>(new DummyIdentityProvider), | |
| 1039 #endif // defined(OS_CHROMEOS) | |
| 1040 store_path, | 1026 store_path, |
| 1041 system_request_context()); | 1027 system_request_context()); |
| 1028 // Sign-in is not required for device-level GCM usage. However, GCM will not | |
| 1029 // be started when none is asking for it. | |
|
bartfab (slow)
2014/06/16 09:17:06
1: I do not understand this comment. Are you sayin
jianli
2014/06/16 16:52:05
I mean GCM will not be started even after we call
| |
| 1030 // TODO(jianli): To be removed when sign-in enforcement is dropped. | |
| 1031 gcm_driver_->OnSignedIn(); | |
| 1042 #endif // defined(OS_ANDROID) | 1032 #endif // defined(OS_ANDROID) |
| 1043 } | 1033 } |
| 1044 | 1034 |
| 1045 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 1035 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { |
| 1046 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 1036 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { |
| 1047 scoped_refptr<ShellIntegration::DefaultWebClientWorker> | 1037 scoped_refptr<ShellIntegration::DefaultWebClientWorker> |
| 1048 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); | 1038 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); |
| 1049 set_browser_worker->StartSetAsDefault(); | 1039 set_browser_worker->StartSetAsDefault(); |
| 1050 } | 1040 } |
| 1051 } | 1041 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1115 } | 1105 } |
| 1116 | 1106 |
| 1117 void BrowserProcessImpl::OnAutoupdateTimer() { | 1107 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1118 if (CanAutorestartForUpdate()) { | 1108 if (CanAutorestartForUpdate()) { |
| 1119 DLOG(WARNING) << "Detected update. Restarting browser."; | 1109 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1120 RestartBackgroundInstance(); | 1110 RestartBackgroundInstance(); |
| 1121 } | 1111 } |
| 1122 } | 1112 } |
| 1123 | 1113 |
| 1124 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1114 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |