| Index: chrome/browser/invalidation/ticl_invalidation_service.h
|
| diff --git a/chrome/browser/invalidation/ticl_invalidation_service.h b/chrome/browser/invalidation/ticl_invalidation_service.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b92e385ea060c1ebefeaf54fdd1070bca21c0183
|
| --- /dev/null
|
| +++ b/chrome/browser/invalidation/ticl_invalidation_service.h
|
| @@ -0,0 +1,102 @@
|
| +// 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_TICL_INVALIDATION_SERVICE_H_
|
| +#define CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_
|
| +
|
| +#include "base/threading/non_thread_safe.h"
|
| +#include "chrome/browser/invalidation/invalidation_frontend.h"
|
| +#include "chrome/browser/invalidation/invalidator_storage.h"
|
| +#include "chrome/browser/profiles/profile_keyed_service.h"
|
| +#include "chrome/browser/signin/signin_global_error.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| +#include "sync/notifier/invalidation_handler.h"
|
| +#include "sync/notifier/invalidator_registrar.h"
|
| +
|
| +class Profile;
|
| +class SigninManager;
|
| +class TokenService;
|
| +
|
| +namespace syncer {
|
| +class Invalidator;
|
| +}
|
| +
|
| +namespace invalidation {
|
| +
|
| +// This InvalidationService wraps the C++ Invalidation Client (TICL) library.
|
| +// It provides invalidations for desktop platforms (Win, Mac, Linux).
|
| +class TiclInvalidationService
|
| + : public base::NonThreadSafe,
|
| + public ProfileKeyedService,
|
| + public InvalidationFrontend,
|
| + public content::NotificationObserver,
|
| + public syncer::InvalidationHandler {
|
| + public:
|
| + TiclInvalidationService(SigninManager* signin,
|
| + TokenService* token_service,
|
| + Profile* profile);
|
| + virtual ~TiclInvalidationService();
|
| +
|
| + void Init();
|
| +
|
| + // InvalidationFrontend implementation.
|
| + // It is an error to have registered handlers when Shutdown() is called.
|
| + 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;
|
| +
|
| + // syncer::InvalidationHandler implementation.
|
| + virtual void OnInvalidatorStateChange(
|
| + syncer::InvalidatorState state) OVERRIDE;
|
| + virtual void OnIncomingInvalidation(
|
| + const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
|
| +
|
| + // Override of ProfileKeyedService methods.
|
| + virtual void Shutdown() OVERRIDE;
|
| +
|
| + protected:
|
| + // Initializes with an injected invalidator.
|
| + void InitForTest(syncer::Invalidator* invalidator);
|
| +
|
| + friend class TiclInvalidationServiceTestDelegate;
|
| +
|
| + private:
|
| + bool IsReadyToStart();
|
| + bool IsStarted();
|
| +
|
| + void Start();
|
| + void UpdateToken();
|
| + void Stop();
|
| +
|
| + Profile *const profile_;
|
| + SigninManager *const signin_manager_;
|
| + TokenService *const token_service_;
|
| +
|
| + scoped_ptr<syncer::InvalidatorRegistrar> invalidator_registrar_;
|
| + scoped_ptr<InvalidatorStorage> invalidator_storage_;
|
| + scoped_ptr<syncer::Invalidator> invalidator_;
|
| +
|
| + content::NotificationRegistrar notification_registrar_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(TiclInvalidationService);
|
| +};
|
| +
|
| +}
|
| +
|
| +#endif // CHROME_BROWSER_INVALIDATION_TICL_INVALIDATION_SERVICE_H_
|
|
|