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 11 matching lines...) Expand all Loading... |
22 enum CopresenceStatus { SUCCESS, FAIL }; | 22 enum CopresenceStatus { SUCCESS, FAIL }; |
23 | 23 |
24 // Callback type to send a status. | 24 // Callback type to send a status. |
25 typedef base::Callback<void(CopresenceStatus)> StatusCallback; | 25 typedef base::Callback<void(CopresenceStatus)> StatusCallback; |
26 | 26 |
27 // A delegate interface for users of Copresence. | 27 // A delegate interface for users of Copresence. |
28 class CopresenceDelegate { | 28 class CopresenceDelegate { |
29 public: | 29 public: |
30 virtual ~CopresenceDelegate() {} | 30 virtual ~CopresenceDelegate() {} |
31 | 31 |
32 // This method will be called when we have subscribed messages that need to | 32 // This method will be called when we have subscribed messages |
33 // be sent to their respective apps. | 33 // that need to be sent to their respective apps. |
34 virtual void HandleMessages( | 34 virtual void HandleMessages( |
35 const std::string& app_id, | 35 const std::string& app_id, |
36 const std::string& subscription_id, | 36 const std::string& subscription_id, |
37 const std::vector<Message>& message) = 0; | 37 const std::vector<Message>& message) = 0; |
38 | 38 |
| 39 // Thw URLRequestContextGetter must outlive the CopresenceManager. |
39 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; | 40 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; |
40 | 41 |
41 virtual const std::string GetPlatformVersionString() const = 0; | 42 virtual const std::string GetPlatformVersionString() const = 0; |
42 | 43 |
43 virtual const std::string GetAPIKey(const std::string& app_id) const = 0; | 44 virtual const std::string GetAPIKey(const std::string& app_id) const = 0; |
44 virtual const std::string GetAuthToken() const = 0; | 45 virtual const std::string GetAuthToken() const = 0; |
45 | 46 |
| 47 // Thw WhispernetClient must outlive the CopresenceManager. |
46 virtual WhispernetClient* GetWhispernetClient() = 0; | 48 virtual WhispernetClient* GetWhispernetClient() = 0; |
47 }; | 49 }; |
48 | 50 |
49 } // namespace copresence | 51 } // namespace copresence |
50 | 52 |
51 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ | 53 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ |
OLD | NEW |