| Index: chrome/browser/invalidation/invalidation_service_android.h
|
| diff --git a/chrome/browser/invalidation/invalidation_service_android.h b/chrome/browser/invalidation/invalidation_service_android.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8f51b13526ac31c973e5d3344bdb4bcdb447aac4
|
| --- /dev/null
|
| +++ b/chrome/browser/invalidation/invalidation_service_android.h
|
| @@ -0,0 +1,71 @@
|
| +// 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_INVALIDATION_SERVICE_ANDROID_H_
|
| +#define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/compiler_specific.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 InvalidationServiceAndroid
|
| + : public base::NonThreadSafe,
|
| + public ProfileKeyedService,
|
| + public InvalidationFrontend,
|
| + public content::NotificationObserver {
|
| + public:
|
| + explicit InvalidationServiceAndroid(Profile* profile);
|
| + virtual ~InvalidationServiceAndroid();
|
| +
|
| + // 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 InvalidationServiceAndroid 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_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(InvalidationServiceAndroid);
|
| +};
|
| +
|
| +} // namespace invalidation
|
| +
|
| +#endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_
|
|
|