| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ | 5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ |
| 6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ | 6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 using StatusCallback = base::Callback<void(CopresenceStatus)>; | 31 using StatusCallback = base::Callback<void(CopresenceStatus)>; |
| 32 | 32 |
| 33 // A delegate interface for users of Copresence. | 33 // A delegate interface for users of Copresence. |
| 34 class CopresenceDelegate { | 34 class CopresenceDelegate { |
| 35 public: | 35 public: |
| 36 // This method will be called when we have subscribed messages | 36 // This method will be called when we have subscribed messages |
| 37 // that need to be sent to their respective apps. | 37 // that need to be sent to their respective apps. |
| 38 virtual void HandleMessages( | 38 virtual void HandleMessages( |
| 39 const std::string& app_id, | 39 const std::string& app_id, |
| 40 const std::string& subscription_id, | 40 const std::string& subscription_id, |
| 41 const std::vector<Message>& message) = 0; | 41 const std::vector<Message>& messages) = 0; |
| 42 | 42 |
| 43 virtual void HandleStatusUpdate(CopresenceStatus status) = 0; | 43 virtual void HandleStatusUpdate(CopresenceStatus status) = 0; |
| 44 | 44 |
| 45 // Thw URLRequestContextGetter must outlive the CopresenceManager. | 45 // Thw URLRequestContextGetter must outlive the CopresenceManager. |
| 46 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; | 46 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; |
| 47 | 47 |
| 48 virtual const std::string GetPlatformVersionString() const = 0; | 48 virtual const std::string GetPlatformVersionString() const = 0; |
| 49 | 49 |
| 50 virtual const std::string GetAPIKey(const std::string& app_id) const = 0; | 50 virtual const std::string GetAPIKey(const std::string& app_id) const = 0; |
| 51 | 51 |
| 52 // Thw WhispernetClient must outlive the CopresenceManager. | 52 // Thw WhispernetClient must outlive the CopresenceManager. |
| 53 virtual WhispernetClient* GetWhispernetClient() = 0; | 53 virtual WhispernetClient* GetWhispernetClient() = 0; |
| 54 | 54 |
| 55 // Clients may optionally provide a GCMDriver to receive messages from. | 55 // Clients may optionally provide a GCMDriver to receive messages from. |
| 56 // If no driver is available, this can return null. | 56 // If no driver is available, this can return null. |
| 57 virtual gcm::GCMDriver* GetGCMDriver() = 0; | 57 virtual gcm::GCMDriver* GetGCMDriver() = 0; |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 virtual ~CopresenceDelegate() {} | 60 virtual ~CopresenceDelegate() {} |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace copresence | 63 } // namespace copresence |
| 64 | 64 |
| 65 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ | 65 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ |
| OLD | NEW |