| 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 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 | 12 |
| 13 namespace gcm { | 13 namespace gcm { |
| 14 class GCMDriver; | 14 class GCMDriver; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class URLRequestContextGetter; | 18 class URLRequestContextGetter; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace audio_modem { |
| 22 class WhispernetClient; |
| 23 } |
| 24 |
| 21 namespace copresence { | 25 namespace copresence { |
| 22 | 26 |
| 23 class Message; | 27 class Message; |
| 24 class WhispernetClient; | |
| 25 | 28 |
| 26 // AUDIO_FAIL indicates that we weren't able to hear the audio token that | 29 // AUDIO_FAIL indicates that we weren't able to hear the audio token that |
| 27 // we were playing. | 30 // we were playing. |
| 28 enum CopresenceStatus { SUCCESS, FAIL, AUDIO_FAIL }; | 31 enum CopresenceStatus { SUCCESS, FAIL, AUDIO_FAIL }; |
| 29 | 32 |
| 30 // Callback type to send a status. | 33 // Callback type to send a status. |
| 31 using StatusCallback = base::Callback<void(CopresenceStatus)>; | 34 using StatusCallback = base::Callback<void(CopresenceStatus)>; |
| 32 | 35 |
| 33 // A delegate interface for users of Copresence. | 36 // A delegate interface for users of Copresence. |
| 34 class CopresenceDelegate { | 37 class CopresenceDelegate { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 // Thw URLRequestContextGetter must outlive the CopresenceManager. | 48 // Thw URLRequestContextGetter must outlive the CopresenceManager. |
| 46 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; | 49 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; |
| 47 | 50 |
| 48 virtual const std::string GetPlatformVersionString() const = 0; | 51 virtual const std::string GetPlatformVersionString() const = 0; |
| 49 | 52 |
| 50 // This is deprecated. Clients should pass in the project ID instead. | 53 // This is deprecated. Clients should pass in the project ID instead. |
| 51 virtual const std::string GetAPIKey(const std::string& app_id) const = 0; | 54 virtual const std::string GetAPIKey(const std::string& app_id) const = 0; |
| 52 | 55 |
| 53 virtual const std::string GetProjectId(const std::string& app_id) const = 0; | 56 virtual const std::string GetProjectId(const std::string& app_id) const = 0; |
| 54 | 57 |
| 55 // Thw WhispernetClient must outlive the CopresenceManager. | 58 // The WhispernetClient must outlive the CopresenceManager. |
| 56 virtual WhispernetClient* GetWhispernetClient() = 0; | 59 virtual audio_modem::WhispernetClient* GetWhispernetClient() = 0; |
| 57 | 60 |
| 58 // Clients may optionally provide a GCMDriver to receive messages from. | 61 // Clients may optionally provide a GCMDriver to receive messages from. |
| 59 // If no driver is available, this can return null. | 62 // If no driver is available, this can return null. |
| 60 virtual gcm::GCMDriver* GetGCMDriver() = 0; | 63 virtual gcm::GCMDriver* GetGCMDriver() = 0; |
| 61 | 64 |
| 62 // Get the copresence device ID for authenticated or anonymous calls, | 65 // Get the copresence device ID for authenticated or anonymous calls, |
| 63 // as specified. If none exists, return the empty string. | 66 // as specified. If none exists, return the empty string. |
| 64 virtual const std::string GetDeviceId(bool authenticated) = 0; | 67 virtual const std::string GetDeviceId(bool authenticated) = 0; |
| 65 | 68 |
| 66 // Save a copresence device ID for authenticated or anonymous calls. | 69 // Save a copresence device ID for authenticated or anonymous calls. |
| 67 // If the device ID is empty, any stored ID should be deleted. | 70 // If the device ID is empty, any stored ID should be deleted. |
| 68 virtual void SaveDeviceId(bool authenticated, | 71 virtual void SaveDeviceId(bool authenticated, |
| 69 const std::string& device_id) = 0; | 72 const std::string& device_id) = 0; |
| 70 | 73 |
| 71 protected: | 74 protected: |
| 72 virtual ~CopresenceDelegate() {} | 75 virtual ~CopresenceDelegate() {} |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 } // namespace copresence | 78 } // namespace copresence |
| 76 | 79 |
| 77 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ | 80 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ |
| OLD | NEW |