Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3221)

Unified Diff: chrome/browser/p2p_invalidation_service.h

Issue 13197004: Draft: InvalidationService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Passes tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/p2p_invalidation_service.h
diff --git a/chrome/browser/p2p_invalidation_service.h b/chrome/browser/p2p_invalidation_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..b99dd9f3b7162cc683fe44e04a3a61211ee049f0
--- /dev/null
+++ b/chrome/browser/p2p_invalidation_service.h
@@ -0,0 +1,58 @@
+// 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.
+
+#include "base/threading/non_thread_safe.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "chrome/browser/sync/invalidation_frontend.h"
+#include "sync/notifier/object_id_invalidation_map.h"
+
+#ifndef CHROME_BROWSER_P2P_INVALIDATION_SERVICE_H_
+#define CHROME_BROWSER_P2P_INVALIDATION_SERVICE_H_
+
+namespace syncer {
+class P2PInvalidator;
+}
+
+class Profile;
+
+// A wrapper around P2PInvalidator.
+class P2PInvalidationService
+ : public base::NonThreadSafe,
+ public ProfileKeyedService,
+ public InvalidationFrontend {
+ public:
+ P2PInvalidationService();
+ virtual ~P2PInvalidationService();
+
+ // Overrides ProfileKeyedService method.
+ virtual void Shutdown() OVERRIDE;
+
+ // 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 OVERRIDE;
+
+ void Init(Profile* profile);
+ void UpdateCredentials(const std::string& username,
+ const std::string& password);
+
+ virtual void SendInvalidation(
+ const syncer::ObjectIdInvalidationMap& invalidation_map);
+
+ private:
+ scoped_ptr<syncer::P2PInvalidator> invalidator_;
+ std::string invalidator_id_;
+};
+
+#endif // CHROME_BROWSER_P2P_INVALIDATION_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698