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

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

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 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 | Annotate | Revision Log
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 "chrome/browser/invalidation/invalidation_frontend.h" 7 #include "chrome/browser/invalidation/invalidation_frontend.h"
8 #include "chrome/browser/invalidation/invalidation_service_android.h" 8 #include "chrome/browser/invalidation/invalidation_service_android.h"
9 #include "chrome/browser/invalidation/p2p_invalidation_service.h" 9 #include "chrome/browser/invalidation/p2p_invalidation_service.h"
10 #include "chrome/browser/invalidation/ticl_invalidation_service.h" 10 #include "chrome/browser/invalidation/ticl_invalidation_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/signin_manager.h" 12 #include "chrome/browser/signin/signin_manager.h"
13 #include "chrome/browser/signin/signin_manager_factory.h" 13 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "chrome/browser/signin/token_service_factory.h" 14 #include "chrome/browser/signin/token_service_factory.h"
15 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 15 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
16 16
17 class TokenService; 17 class TokenService;
18 18
19 namespace invalidation { 19 namespace invalidation {
20 20
21 // TODO(rlarocque): Re-enable this once InvalidationFrontend can 21 // TODO(rlarocque): Re-enable this once InvalidationFrontend can
22 // extend ProfileKeyedService. 22 // extend BrowserContextKeyedService.
23 // // static 23 // // static
24 // InvalidationFrontend* InvalidationServiceFactory::GetForProfile( 24 // InvalidationFrontend* InvalidationServiceFactory::GetForProfile(
25 // Profile* profile) { 25 // Profile* profile) {
26 // return static_cast<InvalidationFrontend*>( 26 // return static_cast<InvalidationFrontend*>(
27 // GetInstance()->GetServiceForProfile(profile, true)); 27 // GetInstance()->GetServiceForBrowserContext(profile, true));
28 // } 28 // }
29 29
30 // static 30 // static
31 InvalidationServiceFactory* InvalidationServiceFactory::GetInstance() { 31 InvalidationServiceFactory* InvalidationServiceFactory::GetInstance() {
32 return Singleton<InvalidationServiceFactory>::get(); 32 return Singleton<InvalidationServiceFactory>::get();
33 } 33 }
34 34
35 InvalidationServiceFactory::InvalidationServiceFactory() 35 InvalidationServiceFactory::InvalidationServiceFactory()
36 : ProfileKeyedServiceFactory("InvalidationService", 36 : BrowserContextKeyedServiceFactory(
37 ProfileDependencyManager::GetInstance()) { 37 "InvalidationService",
38 BrowserContextDependencyManager::GetInstance()) {
38 #if !defined(OS_ANDROID) 39 #if !defined(OS_ANDROID)
39 DependsOn(SigninManagerFactory::GetInstance()); 40 DependsOn(SigninManagerFactory::GetInstance());
40 DependsOn(TokenServiceFactory::GetInstance()); 41 DependsOn(TokenServiceFactory::GetInstance());
41 #endif 42 #endif
42 } 43 }
43 44
44 InvalidationServiceFactory::~InvalidationServiceFactory() {} 45 InvalidationServiceFactory::~InvalidationServiceFactory() {}
45 46
46 // static 47 // static
47 ProfileKeyedService* 48 BrowserContextKeyedService*
48 InvalidationServiceFactory::BuildP2PInvalidationServiceFor(Profile* profile) { 49 InvalidationServiceFactory::BuildP2PInvalidationServiceFor(Profile* profile) {
49 return new P2PInvalidationService(profile); 50 return new P2PInvalidationService(profile);
50 } 51 }
51 52
52 ProfileKeyedService* InvalidationServiceFactory::BuildServiceInstanceFor( 53 BrowserContextKeyedService* InvalidationServiceFactory::BuildServiceInstanceFor(
53 content::BrowserContext* context) const { 54 content::BrowserContext* context) const {
54 Profile* profile = static_cast<Profile*>(context); 55 Profile* profile = static_cast<Profile*>(context);
55 #if defined(OS_ANDROID) 56 #if defined(OS_ANDROID)
56 InvalidationServiceAndroid* service = new InvalidationServiceAndroid(profile); 57 InvalidationServiceAndroid* service = new InvalidationServiceAndroid(profile);
57 return service; 58 return service;
58 #else 59 #else
59 SigninManagerBase* signin_manager = 60 SigninManagerBase* signin_manager =
60 SigninManagerFactory::GetForProfile(profile); 61 SigninManagerFactory::GetForProfile(profile);
61 TokenService* token_service = TokenServiceFactory::GetForProfile(profile); 62 TokenService* token_service = TokenServiceFactory::GetForProfile(profile);
62 63
63 TiclInvalidationService* service = new TiclInvalidationService( 64 TiclInvalidationService* service = new TiclInvalidationService(
64 signin_manager, token_service, profile); 65 signin_manager, token_service, profile);
65 service->Init(); 66 service->Init();
66 return service; 67 return service;
67 #endif 68 #endif
68 } 69 }
69 70
70 } // namespace invalidation 71 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698