| OLD | NEW |
| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
| 12 #include "chrome/browser/invalidation/invalidation_logger.h" | 12 #include "chrome/browser/invalidation/invalidation_logger.h" |
| 13 #include "chrome/browser/invalidation/invalidation_service.h" | 13 #include "chrome/browser/invalidation/invalidation_service.h" |
| 14 #include "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "sync/notifier/invalidator_registrar.h" | 17 #include "sync/notifier/invalidator_registrar.h" |
| 18 | 18 |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 namespace invalidation { | 21 namespace invalidation { |
| 22 class InvalidationControllerAndroid; | 22 class InvalidationControllerAndroid; |
| 23 class InvalidationLogger; |
| 23 | 24 |
| 24 // This InvalidationService is used to deliver invalidations on Android. The | 25 // This InvalidationService is used to deliver invalidations on Android. The |
| 25 // Android operating system has its own mechanisms for delivering invalidations. | 26 // Android operating system has its own mechanisms for delivering invalidations. |
| 26 // This class uses the NotificationService to communicate with a thin wrapper | 27 // This class uses the NotificationService to communicate with a thin wrapper |
| 27 // around Android's invalidations service. | 28 // around Android's invalidations service. |
| 28 class InvalidationServiceAndroid | 29 class InvalidationServiceAndroid |
| 29 : public base::NonThreadSafe, | 30 : public base::NonThreadSafe, |
| 30 public InvalidationService, | 31 public InvalidationService, |
| 31 public content::NotificationObserver { | 32 public content::NotificationObserver { |
| 32 public: | 33 public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 46 virtual void UpdateRegisteredInvalidationIds( | 47 virtual void UpdateRegisteredInvalidationIds( |
| 47 syncer::InvalidationHandler* handler, | 48 syncer::InvalidationHandler* handler, |
| 48 const syncer::ObjectIdSet& ids) OVERRIDE; | 49 const syncer::ObjectIdSet& ids) OVERRIDE; |
| 49 virtual void UnregisterInvalidationHandler( | 50 virtual void UnregisterInvalidationHandler( |
| 50 syncer::InvalidationHandler* handler) OVERRIDE; | 51 syncer::InvalidationHandler* handler) OVERRIDE; |
| 51 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; | 52 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; |
| 52 virtual std::string GetInvalidatorClientId() const OVERRIDE; | 53 virtual std::string GetInvalidatorClientId() const OVERRIDE; |
| 53 virtual InvalidationLogger* GetInvalidationLogger() OVERRIDE; | 54 virtual InvalidationLogger* GetInvalidationLogger() OVERRIDE; |
| 54 virtual void RequestDetailedStatus( | 55 virtual void RequestDetailedStatus( |
| 55 base::Callback<void(const base::DictionaryValue&)> caller) OVERRIDE; | 56 base::Callback<void(const base::DictionaryValue&)> caller) OVERRIDE; |
| 57 virtual InvalidationAuthProvider* GetInvalidationAuthProvider() OVERRIDE; |
| 56 | 58 |
| 57 // content::NotificationObserver implementation. | 59 // content::NotificationObserver implementation. |
| 58 virtual void Observe(int type, | 60 virtual void Observe(int type, |
| 59 const content::NotificationSource& source, | 61 const content::NotificationSource& source, |
| 60 const content::NotificationDetails& details) OVERRIDE; | 62 const content::NotificationDetails& details) OVERRIDE; |
| 61 | 63 |
| 62 // The InvalidationServiceAndroid always reports that it is enabled. | 64 // The InvalidationServiceAndroid always reports that it is enabled. |
| 63 // This is used only by unit tests. | 65 // This is used only by unit tests. |
| 64 void TriggerStateChangeForTest(syncer::InvalidatorState state); | 66 void TriggerStateChangeForTest(syncer::InvalidatorState state); |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 syncer::InvalidatorRegistrar invalidator_registrar_; | 69 syncer::InvalidatorRegistrar invalidator_registrar_; |
| 68 content::NotificationRegistrar registrar_; | 70 content::NotificationRegistrar registrar_; |
| 69 syncer::InvalidatorState invalidator_state_; | 71 syncer::InvalidatorState invalidator_state_; |
| 70 scoped_ptr<InvalidationControllerAndroid> invalidation_controller_; | 72 scoped_ptr<InvalidationControllerAndroid> invalidation_controller_; |
| 71 | 73 |
| 72 // The invalidation logger object we use to record state changes | 74 // The invalidation logger object we use to record state changes |
| 73 // and invalidations. | 75 // and invalidations. |
| 74 InvalidationLogger logger_; | 76 InvalidationLogger logger_; |
| 75 | 77 |
| 76 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceAndroid); | 78 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceAndroid); |
| 77 }; | 79 }; |
| 78 | 80 |
| 79 } // namespace invalidation | 81 } // namespace invalidation |
| 80 | 82 |
| 81 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_ | 83 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_ |
| OLD | NEW |