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_CLIENT_DELEGATE_H_ |
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ | 6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CLIENT_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
11 #include "components/copresence/proto/rpcs.pb.h" | |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 class URLRequestContextGetter; | 14 class URLRequestContextGetter; |
15 } | 15 } |
16 | 16 |
17 namespace copresence { | 17 namespace copresence { |
18 | 18 |
| 19 class Message; |
19 class WhispernetClient; | 20 class WhispernetClient; |
20 | 21 |
21 enum CopresenceStatus { SUCCESS, FAIL }; | 22 enum CopresenceStatus { SUCCESS, FAIL }; |
22 | 23 |
23 // Callback type to send a status. | 24 // Callback type to send a status. |
24 typedef base::Callback<void(CopresenceStatus)> StatusCallback; | 25 typedef base::Callback<void(CopresenceStatus)> StatusCallback; |
25 | 26 |
26 // A delegate interface for users of Copresence. | 27 // A delegate interface for users of Copresence. |
27 class CopresenceClientDelegate { | 28 class CopresenceClientDelegate { |
28 public: | 29 public: |
29 // This method will be called when we have subscribed messages that need to | 30 // This method will be called when we have subscribed messages that need to |
30 // be sent to their respective apps. | 31 // be sent to their respective apps. |
31 virtual void HandleMessages( | 32 virtual void HandleMessages( |
32 const std::string& app_id, | 33 const std::string& app_id, |
33 const std::string& subscription_id, | 34 const std::string& subscription_id, |
34 const std::vector<copresence::Message>& message) = 0; | 35 const std::vector<Message>& message) = 0; |
35 | 36 |
36 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; | 37 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; |
37 | 38 |
38 virtual const std::string GetPlatformVersionString() const = 0; | 39 virtual const std::string GetPlatformVersionString() const = 0; |
39 | 40 |
40 virtual WhispernetClient* GetWhispernetClient() = 0; | 41 virtual WhispernetClient* GetWhispernetClient() = 0; |
41 }; | 42 }; |
42 | 43 |
43 } // namespace copresence | 44 } // namespace copresence |
44 | 45 |
45 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_ | 46 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CLIENT_DELEGATE_H_ |
OLD | NEW |