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

Side by Side Diff: chrome/browser/invalidation_service.h

Issue 13197004: Draft: InvalidationService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Passes tests Created 7 years, 8 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
(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_SERVICE_H_
tim (not reviewing) 2013/04/15 16:48:24 This may have been your plan given the 'Draft' tit
6 #define CHROME_BROWSER_INVALIDATION_SERVICE_H_
7
8 #include "base/threading/non_thread_safe.h"
9 #include "chrome/browser/profiles/profile_keyed_service.h"
10 #include "chrome/browser/signin/signin_global_error.h"
11 #include "chrome/browser/sync/invalidation_frontend.h"
12 #include "chrome/browser/sync/invalidations/invalidator_storage.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 class InvalidationService
27 : public base::NonThreadSafe,
28 public ProfileKeyedService,
29 public InvalidationFrontend,
30 public content::NotificationObserver,
31 public syncer::InvalidationHandler {
32 public:
33 InvalidationService(SigninManager* signin,
34 TokenService* token_service);
35 virtual ~InvalidationService();
36
37 void Init(Profile* profile);
38
39 // InvalidationFrontend implementation.
40 // It is an error to have registered handlers when Shutdown() is called.
41 virtual void RegisterInvalidationHandler(
42 syncer::InvalidationHandler* handler) OVERRIDE;
43 virtual void UpdateRegisteredInvalidationIds(
44 syncer::InvalidationHandler* handler,
45 const syncer::ObjectIdSet& ids) OVERRIDE;
46 virtual void UnregisterInvalidationHandler(
47 syncer::InvalidationHandler* handler) OVERRIDE;
48 virtual void AcknowledgeInvalidation(
49 const invalidation::ObjectId& id,
50 const syncer::AckHandle& ack_handle) OVERRIDE;
51 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
52 virtual std::string GetInvalidatorClientId() const OVERRIDE;
53
54 // content::NotificationObserver implementation.
55 virtual void Observe(int type,
56 const content::NotificationSource& source,
57 const content::NotificationDetails& details) OVERRIDE;
58
59 // syncer::InvalidationHandler implementation.
60 virtual void OnInvalidatorStateChange(
61 syncer::InvalidatorState state) OVERRIDE;
62 virtual void OnIncomingInvalidation(
63 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
64
65 // Override of ProfileKeyedService method.
66 virtual void Shutdown() OVERRIDE;
67
68 private:
69 bool IsReadyToStart();
70 bool IsStarted();
71
72 void Start();
73 void UpdateToken();
74 void Stop();
75
76 Profile* profile_;
77 SigninManager* signin_manager_;
78 TokenService* token_service_;
79
80 scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_;
81 scoped_ptr<browser_sync::InvalidatorStorage> invalidator_storage_;
82 scoped_ptr<syncer::Invalidator> invalidator_;
83
84 content::NotificationRegistrar notification_registrar_;
85
86 DISALLOW_COPY_AND_ASSIGN(InvalidationService);
87 };
88
89 #endif // CHROME_BROWSER_INVALIDATION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698