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