| 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/prefs/pref_registry.h" | 7 #include "base/prefs/pref_registry.h" |
| 8 #include "chrome/browser/invalidation/fake_invalidation_service.h" | 8 #include "chrome/browser/invalidation/fake_invalidation_service.h" |
| 9 #include "chrome/browser/invalidation/invalidation_service.h" | 9 #include "chrome/browser/invalidation/invalidation_service.h" |
| 10 #include "chrome/browser/invalidation/invalidation_service_android.h" | 10 #include "chrome/browser/invalidation/invalidation_service_android.h" |
| 11 #include "chrome/browser/invalidation/invalidator_storage.h" | 11 #include "chrome/browser/invalidation/invalidator_storage.h" |
| 12 #include "chrome/browser/invalidation/p2p_invalidation_service.h" | 12 #include "chrome/browser/invalidation/p2p_invalidation_service.h" |
| 13 #include "chrome/browser/invalidation/ticl_invalidation_service.h" | 13 #include "chrome/browser/invalidation/ticl_invalidation_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 17 #include "chrome/browser/signin/signin_manager.h" | 17 #include "chrome/browser/signin/signin_manager.h" |
| 18 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
| 19 #include "chrome/browser/signin/token_service.h" | 19 #include "chrome/browser/signin/token_service.h" |
| 20 #include "chrome/browser/signin/token_service_factory.h" | 20 #include "chrome/browser/signin/token_service_factory.h" |
| 21 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 21 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 22 | 22 |
| 23 #if defined(OS_ANDROID) |
| 24 #include "chrome/browser/invalidation/invalidation_controller_android.h" |
| 25 #endif // defined(OS_ANDROID) |
| 26 |
| 23 class TokenService; | 27 class TokenService; |
| 24 | 28 |
| 25 namespace invalidation { | 29 namespace invalidation { |
| 26 | 30 |
| 27 // static | 31 // static |
| 28 InvalidationService* InvalidationServiceFactory::GetForProfile( | 32 InvalidationService* InvalidationServiceFactory::GetForProfile( |
| 29 Profile* profile) { | 33 Profile* profile) { |
| 30 return static_cast<InvalidationService*>( | 34 return static_cast<InvalidationService*>( |
| 31 GetInstance()->GetServiceForBrowserContext(profile, true)); | 35 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 32 } | 36 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 83 |
| 80 BrowserContextKeyedService* InvalidationServiceFactory::BuildServiceInstanceFor( | 84 BrowserContextKeyedService* InvalidationServiceFactory::BuildServiceInstanceFor( |
| 81 content::BrowserContext* context) const { | 85 content::BrowserContext* context) const { |
| 82 Profile* profile = static_cast<Profile*>(context); | 86 Profile* profile = static_cast<Profile*>(context); |
| 83 | 87 |
| 84 if (build_fake_invalidators_) { | 88 if (build_fake_invalidators_) { |
| 85 return BuildFakeInvalidationService(context); | 89 return BuildFakeInvalidationService(context); |
| 86 } | 90 } |
| 87 | 91 |
| 88 #if defined(OS_ANDROID) | 92 #if defined(OS_ANDROID) |
| 89 InvalidationServiceAndroid* service = new InvalidationServiceAndroid(profile); | 93 InvalidationServiceAndroid* service = new InvalidationServiceAndroid( |
| 94 profile, |
| 95 new InvalidationControllerAndroid()); |
| 90 return service; | 96 return service; |
| 91 #else | 97 #else |
| 92 SigninManagerBase* signin_manager = | 98 SigninManagerBase* signin_manager = |
| 93 SigninManagerFactory::GetForProfile(profile); | 99 SigninManagerFactory::GetForProfile(profile); |
| 94 TokenService* token_service = TokenServiceFactory::GetForProfile(profile); | 100 TokenService* token_service = TokenServiceFactory::GetForProfile(profile); |
| 95 OAuth2TokenService* oauth2_token_service = | 101 OAuth2TokenService* oauth2_token_service = |
| 96 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 102 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 97 | 103 |
| 98 TiclInvalidationService* service = new TiclInvalidationService( | 104 TiclInvalidationService* service = new TiclInvalidationService( |
| 99 signin_manager, | 105 signin_manager, |
| 100 token_service, | 106 token_service, |
| 101 oauth2_token_service, | 107 oauth2_token_service, |
| 102 profile); | 108 profile); |
| 103 service->Init(); | 109 service->Init(); |
| 104 return service; | 110 return service; |
| 105 #endif | 111 #endif |
| 106 } | 112 } |
| 107 | 113 |
| 108 void InvalidationServiceFactory::RegisterProfilePrefs( | 114 void InvalidationServiceFactory::RegisterProfilePrefs( |
| 109 user_prefs::PrefRegistrySyncable* registry) { | 115 user_prefs::PrefRegistrySyncable* registry) { |
| 110 InvalidatorStorage::RegisterProfilePrefs(registry); | 116 InvalidatorStorage::RegisterProfilePrefs(registry); |
| 111 } | 117 } |
| 112 | 118 |
| 113 } // namespace invalidation | 119 } // namespace invalidation |
| OLD | NEW |