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