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_ |