Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/invalidation/invalidation_service_factory.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
20 #include "chrome/browser/signin/token_service_factory.h"
21 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 19 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
22 20
23 class TokenService;
24
25 namespace invalidation { 21 namespace invalidation {
26 22
27 // static 23 // static
28 InvalidationService* InvalidationServiceFactory::GetForProfile( 24 InvalidationService* InvalidationServiceFactory::GetForProfile(
29 Profile* profile) { 25 Profile* profile) {
30 return static_cast<InvalidationService*>( 26 return static_cast<InvalidationService*>(
31 GetInstance()->GetServiceForBrowserContext(profile, true)); 27 GetInstance()->GetServiceForBrowserContext(profile, true));
32 } 28 }
33 29
34 // static 30 // static
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (build_fake_invalidators_) { 80 if (build_fake_invalidators_) {
85 return BuildFakeInvalidationService(context); 81 return BuildFakeInvalidationService(context);
86 } 82 }
87 83
88 #if defined(OS_ANDROID) 84 #if defined(OS_ANDROID)
89 InvalidationServiceAndroid* service = new InvalidationServiceAndroid(profile); 85 InvalidationServiceAndroid* service = new InvalidationServiceAndroid(profile);
90 return service; 86 return service;
91 #else 87 #else
92 SigninManagerBase* signin_manager = 88 SigninManagerBase* signin_manager =
93 SigninManagerFactory::GetForProfile(profile); 89 SigninManagerFactory::GetForProfile(profile);
94 TokenService* token_service = TokenServiceFactory::GetForProfile(profile); 90 ProfileOAuth2TokenService* oauth2_token_service =
95 OAuth2TokenService* oauth2_token_service =
96 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 91 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
97 92
98 TiclInvalidationService* service = new TiclInvalidationService( 93 TiclInvalidationService* service = new TiclInvalidationService(
99 signin_manager, 94 signin_manager,
100 token_service,
101 oauth2_token_service, 95 oauth2_token_service,
102 profile); 96 profile);
103 service->Init(); 97 service->Init();
104 return service; 98 return service;
105 #endif 99 #endif
106 } 100 }
107 101
108 void InvalidationServiceFactory::RegisterProfilePrefs( 102 void InvalidationServiceFactory::RegisterProfilePrefs(
109 user_prefs::PrefRegistrySyncable* registry) { 103 user_prefs::PrefRegistrySyncable* registry) {
110 InvalidatorStorage::RegisterProfilePrefs(registry); 104 InvalidatorStorage::RegisterProfilePrefs(registry);
111 } 105 }
112 106
113 } // namespace invalidation 107 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698