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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 42 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 43 } | 43 } |
| 44 | 44 |
| 45 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
| 46 GCMProfileService::GCMProfileService(Profile* profile) | 46 GCMProfileService::GCMProfileService(Profile* profile) |
| 47 : profile_(profile), | 47 : profile_(profile), |
| 48 push_messaging_service_(this) { | 48 push_messaging_service_(this) { |
| 49 DCHECK(!profile->IsOffTheRecord()); | 49 DCHECK(!profile->IsOffTheRecord()); |
| 50 | 50 |
| 51 driver_.reset(new GCMDriverAndroid); | 51 driver_.reset(new GCMDriverAndroid); |
| 52 } | |
|
fgorski
2014/06/10 17:09:27
I think I prefer having 2 distinct method. If you
johnme
2014/06/10 20:33:48
Done, in fact I moved this code to PushMessagingSe
| |
| 53 #else | 52 #else |
| 54 GCMProfileService::GCMProfileService( | 53 GCMProfileService::GCMProfileService( |
| 55 Profile* profile, | 54 Profile* profile, |
| 56 scoped_ptr<GCMClientFactory> gcm_client_factory) | 55 scoped_ptr<GCMClientFactory> gcm_client_factory) |
| 57 : profile_(profile), | 56 : profile_(profile), |
| 58 push_messaging_service_(this) { | 57 push_messaging_service_(this) { |
| 59 DCHECK(!profile->IsOffTheRecord()); | 58 DCHECK(!profile->IsOffTheRecord()); |
| 60 | 59 |
| 61 driver_ = CreateGCMDriverDesktop( | 60 driver_ = CreateGCMDriverDesktop( |
| 62 gcm_client_factory.Pass(), | 61 gcm_client_factory.Pass(), |
| 63 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( | 62 scoped_ptr<IdentityProvider>(new ProfileIdentityProvider( |
| 64 SigninManagerFactory::GetForProfile(profile_), | 63 SigninManagerFactory::GetForProfile(profile_), |
| 65 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), | 64 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), |
| 66 LoginUIServiceFactory::GetForProfile(profile_))), | 65 LoginUIServiceFactory::GetForProfile(profile_))), |
| 67 profile_->GetPath().Append(chrome::kGCMStoreDirname), | 66 profile_->GetPath().Append(chrome::kGCMStoreDirname), |
| 68 profile_->GetRequestContext()); | 67 profile_->GetRequestContext()); |
| 68 #endif // defined(OS_ANDROID) | |
| 69 | |
| 70 base::Closure lazy_load_app_handlers = base::Bind( | |
| 71 PushMessagingServiceImpl::LazyLoadAppHandlers, | |
| 72 push_messaging_service_.GetWeakPtr()); | |
| 73 driver_.SetLazyLoadAppHandlersClosure(lazy_load_app_handlers); | |
| 69 } | 74 } |
| 70 #endif // defined(OS_ANDROID) | |
| 71 | 75 |
| 72 GCMProfileService::GCMProfileService() | 76 GCMProfileService::GCMProfileService() |
| 73 : profile_(NULL), | 77 : profile_(NULL), |
| 74 push_messaging_service_(this) { | 78 push_messaging_service_(this) { |
| 75 } | 79 } |
| 76 | 80 |
| 77 GCMProfileService::~GCMProfileService() { | 81 GCMProfileService::~GCMProfileService() { |
| 78 } | 82 } |
| 79 | 83 |
| 80 void GCMProfileService::AddAppHandler(const std::string& app_id, | 84 void GCMProfileService::AddAppHandler(const std::string& app_id, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 100 driver_->Shutdown(); | 104 driver_->Shutdown(); |
| 101 driver_.reset(); | 105 driver_.reset(); |
| 102 } | 106 } |
| 103 } | 107 } |
| 104 | 108 |
| 105 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { | 109 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { |
| 106 driver_.reset(driver); | 110 driver_.reset(driver); |
| 107 } | 111 } |
| 108 | 112 |
| 109 } // namespace gcm | 113 } // namespace gcm |
| OLD | NEW |