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