Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/services/gcm/gcm_profile_service.h" | 5 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 11 #include "components/pref_registry/pref_registry_syncable.h" | 11 #include "components/pref_registry/pref_registry_syncable.h" |
| 12 | 12 |
| 13 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
| 14 #include "components/gcm_driver/gcm_driver_android.h" | 14 #include "components/gcm_driver/gcm_driver_android.h" |
| 15 #else | 15 #else |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #if defined(OS_CHROMEOS) | |
| 18 #include "chrome/browser/services/gcm/chromeos_gcm_app_handler.h" | |
| 19 #endif | |
| 17 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" | 20 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" |
| 18 #include "chrome/browser/signin/profile_identity_provider.h" | 21 #include "chrome/browser/signin/profile_identity_provider.h" |
| 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 20 #include "chrome/browser/signin/signin_manager_factory.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
| 21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 24 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 22 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 23 #include "components/gcm_driver/gcm_client_factory.h" | 26 #include "components/gcm_driver/gcm_client_factory.h" |
| 24 #include "components/signin/core/browser/signin_manager.h" | 27 #include "components/signin/core/browser/signin_manager.h" |
| 25 #include "google_apis/gaia/identity_provider.h" | 28 #include "google_apis/gaia/identity_provider.h" |
| 26 #include "net/url_request/url_request_context_getter.h" | 29 #include "net/url_request/url_request_context_getter.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 scoped_ptr<GCMClientFactory> gcm_client_factory) | 117 scoped_ptr<GCMClientFactory> gcm_client_factory) |
| 115 : profile_(profile), | 118 : profile_(profile), |
| 116 push_messaging_service_(this) { | 119 push_messaging_service_(this) { |
| 117 DCHECK(!profile->IsOffTheRecord()); | 120 DCHECK(!profile->IsOffTheRecord()); |
| 118 | 121 |
| 119 driver_ = CreateGCMDriverDesktop( | 122 driver_ = CreateGCMDriverDesktop( |
| 120 gcm_client_factory.Pass(), | 123 gcm_client_factory.Pass(), |
| 121 profile_->GetPath().Append(chrome::kGCMStoreDirname), | 124 profile_->GetPath().Append(chrome::kGCMStoreDirname), |
| 122 profile_->GetRequestContext()); | 125 profile_->GetRequestContext()); |
| 123 | 126 |
| 127 #ifdef CHROMEOS | |
| 128 driver_->AddAppHandler("ChromeOSGCMAppHandler", | |
| 129 new gcm::ChromeOSGCMAppHandler()); | |
|
Nicolas Zea
2014/08/21 21:22:19
Note that this will leak, as the driver doesn't ta
fgorski
2014/08/21 21:38:26
there is no namespace specified for that purpose.
Luigi Semenzato
2014/08/22 01:08:19
Done, although I suspect the app id needs to be de
| |
| 130 #endif | |
| 131 | |
| 124 identity_observer_.reset(new IdentityObserver(profile, driver_.get())); | 132 identity_observer_.reset(new IdentityObserver(profile, driver_.get())); |
| 125 } | 133 } |
| 126 #endif // defined(OS_ANDROID) | 134 #endif // defined(OS_ANDROID) |
| 127 | 135 |
| 128 GCMProfileService::GCMProfileService() | 136 GCMProfileService::GCMProfileService() |
| 129 : profile_(NULL), | 137 : profile_(NULL), |
| 130 push_messaging_service_(this) { | 138 push_messaging_service_(this) { |
| 131 } | 139 } |
| 132 | 140 |
| 133 GCMProfileService::~GCMProfileService() { | 141 GCMProfileService::~GCMProfileService() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 return identity_observer_ ? identity_observer_->SignedInUserName() | 177 return identity_observer_ ? identity_observer_->SignedInUserName() |
| 170 : std::string(); | 178 : std::string(); |
| 171 #endif // defined(OS_ANDROID) | 179 #endif // defined(OS_ANDROID) |
| 172 } | 180 } |
| 173 | 181 |
| 174 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { | 182 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { |
| 175 driver_.reset(driver); | 183 driver_.reset(driver); |
| 176 } | 184 } |
| 177 | 185 |
| 178 } // namespace gcm | 186 } // namespace gcm |
| OLD | NEW |