Chromium Code Reviews| Index: chrome/browser/invalidation/android_invalidation_service.h |
| diff --git a/chrome/browser/invalidation/android_invalidation_service.h b/chrome/browser/invalidation/android_invalidation_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0f057c330a6cd3114567c7d0182c2be98dc21a54 |
| --- /dev/null |
| +++ b/chrome/browser/invalidation/android_invalidation_service.h |
| @@ -0,0 +1,69 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_INVALIDATION_ANDROID_INVALIDATION_SERVICE_H_ |
| +#define CHROME_BROWSER_INVALIDATION_ANDROID_INVALIDATION_SERVICE_H_ |
| + |
| +#include "base/threading/non_thread_safe.h" |
| +#include "chrome/browser/invalidation/invalidation_frontend.h" |
| +#include "chrome/browser/profiles/profile_keyed_service.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| +#include "sync/notifier/invalidator_registrar.h" |
| + |
| +class Profile; |
| + |
| +namespace invalidation { |
| + |
| +// This InvalidationService is used to deliver invalidations on Android. The |
| +// Android operating system has its own mechanisms for delivering invalidations. |
| +// This class uses the NotificationService to communicate with a thin wrapper |
| +// around Android's invalidations service. |
| +class AndroidInvalidationService |
| + : public base::NonThreadSafe, |
| + public ProfileKeyedService, |
| + public InvalidationFrontend, |
| + public content::NotificationObserver{ |
|
dcheng
2013/05/03 18:07:34
Nit: space.
rlarocque
2013/05/03 22:16:14
Done.
|
| + public: |
| + AndroidInvalidationService(); |
| + virtual ~AndroidInvalidationService(); |
| + |
| + void Init(Profile* profile); |
| + |
| + // InvalidationService implementation. |
| + // |
| + // Note that this implementation does not properly support Ack-tracking, |
| + // fetching the invalidator state, or querying the client's ID. Support for |
| + // exposing the client ID should be available soon; see crbug.com/172391. |
| + virtual void RegisterInvalidationHandler( |
| + syncer::InvalidationHandler* handler) OVERRIDE; |
| + virtual void UpdateRegisteredInvalidationIds( |
| + syncer::InvalidationHandler* handler, |
| + const syncer::ObjectIdSet& ids) OVERRIDE; |
| + virtual void UnregisterInvalidationHandler( |
| + syncer::InvalidationHandler* handler) OVERRIDE; |
| + virtual void AcknowledgeInvalidation( |
| + const invalidation::ObjectId& id, |
| + const syncer::AckHandle& ack_handle) OVERRIDE; |
| + virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; |
| + virtual std::string GetInvalidatorClientId() const; |
| + |
| + // content::NotificationObserver implementation. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + // The AndroidInvalidationService always reports that it is enabled. |
| + // This is used only by unit tests. |
| + void TriggerStateChangeForTest(syncer::InvalidatorState state); |
| + |
| + private: |
| + syncer::InvalidatorRegistrar invalidator_registrar_; |
| + content::NotificationRegistrar registrar_; |
| + syncer::InvalidatorState invalidator_state_; |
| +}; |
|
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.
|
| + |
| +} // namespace invalidation |
| + |
| +#endif // CHROME_BROWSER_INVALIDATION_ANDROID_INVALIDATION_SERVICE_H_ |