| 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/invalidation/invalidation_service_factory.h" | 5 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_registry.h" | 8 #include "base/prefs/pref_registry.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/invalidation/fake_invalidation_service.h" | 10 #include "chrome/browser/invalidation/fake_invalidation_service.h" |
| 11 #include "chrome/browser/invalidation/invalidation_service.h" | 11 #include "chrome/browser/invalidation/invalidation_service.h" |
| 12 #include "chrome/browser/invalidation/invalidation_service_android.h" | 12 #include "chrome/browser/invalidation/invalidation_service_android.h" |
| 13 #include "chrome/browser/invalidation/invalidator_storage.h" | 13 #include "chrome/browser/invalidation/invalidator_storage.h" |
| 14 #include "chrome/browser/invalidation/ticl_invalidation_service.h" | 14 #include "chrome/browser/invalidation/ticl_invalidation_service.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| 16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 17 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 17 #include "chrome/browser/signin/profile_identity_provider.h" | 18 #include "chrome/browser/signin/profile_identity_provider.h" |
| 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 19 #include "chrome/browser/signin/signin_manager_factory.h" | 20 #include "chrome/browser/signin/signin_manager_factory.h" |
| 20 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 22 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 23 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 23 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 24 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 24 #include "components/signin/core/browser/signin_manager.h" | 25 #include "components/signin/core/browser/signin_manager.h" |
| 25 #include "components/user_prefs/pref_registry_syncable.h" | 26 #include "components/user_prefs/pref_registry_syncable.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 114 |
| 114 if (!identity_provider) { | 115 if (!identity_provider) { |
| 115 identity_provider.reset(new ProfileIdentityProvider( | 116 identity_provider.reset(new ProfileIdentityProvider( |
| 116 SigninManagerFactory::GetForProfile(profile), | 117 SigninManagerFactory::GetForProfile(profile), |
| 117 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 118 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 118 LoginUIServiceFactory::GetForProfile(profile))); | 119 LoginUIServiceFactory::GetForProfile(profile))); |
| 119 } | 120 } |
| 120 | 121 |
| 121 TiclInvalidationService* service = new TiclInvalidationService( | 122 TiclInvalidationService* service = new TiclInvalidationService( |
| 122 identity_provider.Pass(), | 123 identity_provider.Pass(), |
| 124 gcm::GCMProfileServiceFactory::GetForProfile(profile), |
| 123 profile->GetRequestContext(), | 125 profile->GetRequestContext(), |
| 124 profile); | 126 profile); |
| 125 service->Init(scoped_ptr<syncer::InvalidationStateTracker>( | 127 service->Init(scoped_ptr<syncer::InvalidationStateTracker>( |
| 126 new InvalidatorStorage(profile->GetPrefs()))); | 128 new InvalidatorStorage(profile->GetPrefs()))); |
| 127 return service; | 129 return service; |
| 128 #endif | 130 #endif |
| 129 } | 131 } |
| 130 | 132 |
| 131 void InvalidationServiceFactory::RegisterProfilePrefs( | 133 void InvalidationServiceFactory::RegisterProfilePrefs( |
| 132 user_prefs::PrefRegistrySyncable* registry) { | 134 user_prefs::PrefRegistrySyncable* registry) { |
| 133 registry->RegisterBooleanPref( | 135 registry->RegisterBooleanPref( |
| 134 prefs::kInvalidationServiceUseGCMChannel, | 136 prefs::kInvalidationServiceUseGCMChannel, |
| 135 false, | 137 false, |
| 136 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 138 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 137 InvalidatorStorage::RegisterProfilePrefs(registry); | 139 InvalidatorStorage::RegisterProfilePrefs(registry); |
| 138 } | 140 } |
| 139 | 141 |
| 140 } // namespace invalidation | 142 } // namespace invalidation |
| OLD | NEW |