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

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

Issue 15580002: Make use of InvalidationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_ 5 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_
6 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_ 6 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
11 #include "chrome/browser/invalidation/invalidation_frontend.h" 11 #include "chrome/browser/invalidation/invalidation_service.h"
12 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 12 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "sync/notifier/invalidator_registrar.h" 15 #include "sync/notifier/invalidator_registrar.h"
16 16
17 class Profile; 17 class Profile;
18 18
19 namespace invalidation { 19 namespace invalidation {
20 20
21 // This InvalidationService is used to deliver invalidations on Android. The 21 // This InvalidationService is used to deliver invalidations on Android. The
22 // Android operating system has its own mechanisms for delivering invalidations. 22 // Android operating system has its own mechanisms for delivering invalidations.
23 // This class uses the NotificationService to communicate with a thin wrapper 23 // This class uses the NotificationService to communicate with a thin wrapper
24 // around Android's invalidations service. 24 // around Android's invalidations service.
25 class InvalidationServiceAndroid 25 class InvalidationServiceAndroid
26 : public base::NonThreadSafe, 26 : public base::NonThreadSafe,
27 public BrowserContextKeyedService, 27 public InvalidationService,
28 public InvalidationFrontend,
29 public content::NotificationObserver { 28 public content::NotificationObserver {
30 public: 29 public:
31 explicit InvalidationServiceAndroid(Profile* profile); 30 explicit InvalidationServiceAndroid(Profile* profile);
32 virtual ~InvalidationServiceAndroid(); 31 virtual ~InvalidationServiceAndroid();
33 32
34 // InvalidationService implementation. 33 // InvalidationService implementation.
35 // 34 //
36 // Note that this implementation does not properly support Ack-tracking, 35 // Note that this implementation does not properly support Ack-tracking,
37 // fetching the invalidator state, or querying the client's ID. Support for 36 // fetching the invalidator state, or querying the client's ID. Support for
38 // exposing the client ID should be available soon; see crbug.com/172391. 37 // exposing the client ID should be available soon; see crbug.com/172391.
39 virtual void RegisterInvalidationHandler( 38 virtual void RegisterInvalidationHandler(
40 syncer::InvalidationHandler* handler) OVERRIDE; 39 syncer::InvalidationHandler* handler) OVERRIDE;
41 virtual void UpdateRegisteredInvalidationIds( 40 virtual void UpdateRegisteredInvalidationIds(
42 syncer::InvalidationHandler* handler, 41 syncer::InvalidationHandler* handler,
43 const syncer::ObjectIdSet& ids) OVERRIDE; 42 const syncer::ObjectIdSet& ids) OVERRIDE;
44 virtual void UnregisterInvalidationHandler( 43 virtual void UnregisterInvalidationHandler(
45 syncer::InvalidationHandler* handler) OVERRIDE; 44 syncer::InvalidationHandler* handler) OVERRIDE;
46 virtual void AcknowledgeInvalidation( 45 virtual void AcknowledgeInvalidation(
47 const invalidation::ObjectId& id, 46 const invalidation::ObjectId& id,
48 const syncer::AckHandle& ack_handle) OVERRIDE; 47 const syncer::AckHandle& ack_handle) OVERRIDE;
49 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; 48 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
50 virtual std::string GetInvalidatorClientId() const; 49 virtual std::string GetInvalidatorClientId() const OVERRIDE;
51 50
52 // content::NotificationObserver implementation. 51 // content::NotificationObserver implementation.
53 virtual void Observe(int type, 52 virtual void Observe(int type,
54 const content::NotificationSource& source, 53 const content::NotificationSource& source,
55 const content::NotificationDetails& details) OVERRIDE; 54 const content::NotificationDetails& details) OVERRIDE;
56 55
57 // The InvalidationServiceAndroid always reports that it is enabled. 56 // The InvalidationServiceAndroid always reports that it is enabled.
58 // This is used only by unit tests. 57 // This is used only by unit tests.
59 void TriggerStateChangeForTest(syncer::InvalidatorState state); 58 void TriggerStateChangeForTest(syncer::InvalidatorState state);
60 59
61 private: 60 private:
62 syncer::InvalidatorRegistrar invalidator_registrar_; 61 syncer::InvalidatorRegistrar invalidator_registrar_;
63 content::NotificationRegistrar registrar_; 62 content::NotificationRegistrar registrar_;
64 syncer::InvalidatorState invalidator_state_; 63 syncer::InvalidatorState invalidator_state_;
65 64
66 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceAndroid); 65 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceAndroid);
67 }; 66 };
68 67
69 } // namespace invalidation 68 } // namespace invalidation
70 69
71 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_ 70 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698