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

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

Issue 13991017: Commit InvalidationService implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More updates 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/invalidation/invalidation_service_factory.h"
6
7 #include "chrome/browser/invalidation/android_invalidation_service.h"
8 #include "chrome/browser/invalidation/invalidation_frontend.h"
9 #include "chrome/browser/invalidation/p2p_invalidation_service.h"
10 #include "chrome/browser/invalidation/ticl_invalidation_service.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_dependency_manager.h"
13 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "chrome/browser/signin/token_service_factory.h"
15
16 namespace invalidation {
17
18 // TODO(rlarocque): Re-enable this once InvalidationFrontend can
19 // extend ProfileKeyedService.
20 // // static
21 // InvalidationFrontend* InvalidationServiceFactory::GetForProfile(
22 // Profile* profile) {
23 // return static_cast<InvalidationFrontend*>(
24 // GetInstance()->GetServiceForProfile(profile, true));
25 // }
26
27 // static
28 InvalidationServiceFactory* InvalidationServiceFactory::GetInstance() {
29 return Singleton<InvalidationServiceFactory>::get();
30 }
31
32 InvalidationServiceFactory::InvalidationServiceFactory()
33 : ProfileKeyedServiceFactory("InvalidationService",
34 ProfileDependencyManager::GetInstance()) {
35 #if !defined(OS_ANDROID)
36 DependsOn(SigninManagerFactory::GetInstance());
37 DependsOn(TokenServiceFactory::GetInstance());
38 #endif
39 }
40
41 InvalidationServiceFactory::~InvalidationServiceFactory() {}
42
43 // static
44 ProfileKeyedService*
45 InvalidationServiceFactory::BuildP2PInvalidationServiceFor(Profile* profile) {
46 return new P2PInvalidationService(profile);
47 }
48
49 ProfileKeyedService* InvalidationServiceFactory::BuildServiceInstanceFor(
50 content::BrowserContext* context) const {
51 Profile* profile = static_cast<Profile*>(context);
52 #if !defined(OS_ANDROID)
akalin 2013/05/08 00:43:31 i think testing the other way would be clearer: #
rlarocque 2013/05/08 01:22:28 Done.
53 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile);
54 TokenService* token_service = TokenServiceFactory::GetForProfile(profile);
55
56 TiclInvalidationService* service = new TiclInvalidationService(
57 signin_manager, token_service, profile);
58 service->Init();
59 return service;
60 #else
61 AndroidInvalidationService* service = new AndroidInvalidationService();
62 service->Init(profile);
63 return service;
64 #endif
65 }
66
67 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698