Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / components / copresence / public / copresence_delegate.h
index 0b83087..e138d66 100644 (file)
 
 #include "base/callback_forward.h"
 
+namespace gcm {
+class GCMDriver;
+}
+
 namespace net {
 class URLRequestContextGetter;
 }
@@ -19,7 +23,9 @@ namespace copresence {
 class Message;
 class WhispernetClient;
 
-enum CopresenceStatus { SUCCESS, FAIL };
+// AUDIO_FAIL indicates that we weren't able to hear the audio token that
+// we were playing.
+enum CopresenceStatus { SUCCESS, FAIL, AUDIO_FAIL };
 
 // Callback type to send a status.
 typedef base::Callback<void(CopresenceStatus)> StatusCallback;
@@ -27,20 +33,30 @@ typedef base::Callback<void(CopresenceStatus)> StatusCallback;
 // A delegate interface for users of Copresence.
 class CopresenceDelegate {
  public:
-  // This method will be called when we have subscribed messages that need to
-  // be sent to their respective apps.
+  virtual ~CopresenceDelegate() {}
+
+  // This method will be called when we have subscribed messages
+  // that need to be sent to their respective apps.
   virtual void HandleMessages(
       const std::string& app_id,
       const std::string& subscription_id,
       const std::vector<Message>& message) = 0;
 
+  virtual void HandleStatusUpdate(CopresenceStatus status) = 0;
+
+  // Thw URLRequestContextGetter must outlive the CopresenceManager.
   virtual net::URLRequestContextGetter* GetRequestContext() const = 0;
 
   virtual const std::string GetPlatformVersionString() const = 0;
 
-  virtual const std::string GetAPIKey() const = 0;
+  virtual const std::string GetAPIKey(const std::string& app_id) const = 0;
 
+  // Thw WhispernetClient must outlive the CopresenceManager.
   virtual WhispernetClient* GetWhispernetClient() = 0;
+
+  // Clients may optionally provide a GCMDriver to receive messages from.
+  // If no driver is available, this can return null.
+  virtual gcm::GCMDriver* GetGCMDriver() = 0;
 };
 
 }  // namespace copresence