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

Side by Side Diff: chrome/browser/invalidation/ticl_invalidation_service.h

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 #ifndef CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_
6 #define CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_
7
8 #include "base/threading/non_thread_safe.h"
9 #include "chrome/browser/invalidation/invalidation_frontend.h"
10 #include "chrome/browser/invalidation/invalidator_storage.h"
11 #include "chrome/browser/profiles/profile_keyed_service.h"
12 #include "chrome/browser/signin/signin_global_error.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "sync/notifier/invalidation_handler.h"
16 #include "sync/notifier/invalidator_registrar.h"
17
18 class Profile;
19 class SigninManager;
20 class TokenService;
21
22 namespace syncer {
23 class Invalidator;
24 }
25
26 namespace invalidation {
27
28 // This InvalidationService wraps the C++ Invalidation Client (TICL) library.
29 // It provides invalidations for desktop platforms (Win, Mac, Linux).
30 class TiclInvalidationService
31 : public base::NonThreadSafe,
32 public ProfileKeyedService,
33 public InvalidationFrontend,
34 public content::NotificationObserver,
35 public syncer::InvalidationHandler {
36 public:
37 TiclInvalidationService(SigninManager* signin,
38 TokenService* token_service,
39 Profile* profile);
40 virtual ~TiclInvalidationService();
41
42 void Init();
43
44 // InvalidationFrontend implementation.
45 // It is an error to have registered handlers when Shutdown() is called.
46 virtual void RegisterInvalidationHandler(
47 syncer::InvalidationHandler* handler) OVERRIDE;
48 virtual void UpdateRegisteredInvalidationIds(
49 syncer::InvalidationHandler* handler,
50 const syncer::ObjectIdSet& ids) OVERRIDE;
51 virtual void UnregisterInvalidationHandler(
52 syncer::InvalidationHandler* handler) OVERRIDE;
53 virtual void AcknowledgeInvalidation(
54 const invalidation::ObjectId& id,
55 const syncer::AckHandle& ack_handle) OVERRIDE;
56 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
57 virtual std::string GetInvalidatorClientId() const;
58
59 // content::NotificationObserver implementation.
60 virtual void Observe(int type,
61 const content::NotificationSource& source,
62 const content::NotificationDetails& details) OVERRIDE;
63
64 // syncer::InvalidationHandler implementation.
65 virtual void OnInvalidatorStateChange(
66 syncer::InvalidatorState state) OVERRIDE;
67 virtual void OnIncomingInvalidation(
68 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
69
70 // Override of ProfileKeyedService methods.
71 virtual void Shutdown() OVERRIDE;
72
73 protected:
74 // Initializes with an injected invalidator.
75 void InitForTest(syncer::Invalidator* invalidator);
76
77 friend class TiclInvalidationServiceTestDelegate;
78
79 private:
80 bool IsReadyToStart();
81 bool IsStarted();
82
83 void Start();
84 void UpdateToken();
85 void Stop();
86
87 Profile *const profile_;
88 SigninManager *const signin_manager_;
89 TokenService *const token_service_;
90
91 scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_;
akalin 2013/05/08 00:43:31 include scoped_ptr.h for scoped_ptr
rlarocque 2013/05/08 01:22:28 Done.
92 scoped_ptr<InvalidatorStorage> invalidator_storage_;
93 scoped_ptr<syncer::Invalidator> invalidator_;
94
95 content::NotificationRegistrar notification_registrar_;
96
97 DISALLOW_COPY_AND_ASSIGN(TiclInvalidationService);
98 };
99
100 }
101
102 #endif // CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698