Index: components/copresence/interface/copresence_delegate.h |
diff --git a/components/copresence/interface/copresence_delegate.h b/components/copresence/interface/copresence_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9c627c9f24ca8d23b6f215a04fe796008ad8abed |
--- /dev/null |
+++ b/components/copresence/interface/copresence_delegate.h |
@@ -0,0 +1,52 @@ |
+// Copyright 2014 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 COMPONENTS_COPRESENCE_INTERFACE_COPRESENCE_DELGATE_H_ |
+#define COMPONENTS_COPRESENCE_INTERFACE_COPRESENCE_DELGATE_H_ |
+ |
+#include <string> |
+ |
+#include "base/callback_forward.h" |
+#include "components/copresence/proto/rpcs.pb.h" |
+ |
+namespace net { |
+class URLRequestContextGetter; |
+} |
+ |
+namespace copresence { |
+ |
+// This enum (and the following callback) aren't strictly a part of this |
+// interface, but they are needed by other methods in CopresenceClient to |
+// talk back to the user of Copresence, hence they seem to belong here. |
+enum CopresenceStatus { SUCCESS, FAIL }; |
+ |
+// Callback type to send a status. |
+typedef base::Callback<void(CopresenceStatus)> StatusCallback; |
+ |
+// A delegate interface for the users of Copresence. |
+class CopresenceDelegate { |
+ public: |
+ // This method will be called when we have subscribed messages that need to |
+ // be sent back their respective apps. |
+ virtual void HandleMessages( |
+ const std::string& app_id, |
+ const std::string& subscription_id, |
+ const std::vector<copresence::Message>& message) = 0; |
+ |
+ // This is used by use to be able to send HttpPosts to the copresence server. |
+ virtual net::URLRequestContextGetter* GetRequestContext() const = 0; |
+ |
+ // Only needed for analytics and debugging on the server, can be empty. |
+ virtual const std::string GetPlatformVersionString() const = 0; |
+ |
+ // Methods to set and and get our device ID. This needs to be saved to |
+ // persistent storage to avoid flooding the Copresence server with generate |
+ // id requests. |
+ virtual const std::string GetDeviceId() const = 0; |
+ virtual void SaveDeviceId(const std::string& device_id) = 0; |
+}; |
+ |
+} // namespace copresence |
+ |
+#endif // COMPONENTS_COPRESENCE_INTERFACE_COPRESENCE_DELGATE_H_ |