OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_COPRESENCE_INTERFACE_COPRESENCE_DELGATE_H_ | |
Charlie
2014/07/31 02:37:16
Update define. Watch the spelling of "delegate".
rkc
2014/07/31 06:08:17
Done.
| |
6 #define COMPONENTS_COPRESENCE_INTERFACE_COPRESENCE_DELGATE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/callback_forward.h" | |
11 #include "components/copresence/proto/rpcs.pb.h" | |
12 | |
13 namespace net { | |
14 class URLRequestContextGetter; | |
15 } | |
16 | |
17 namespace copresence { | |
18 | |
19 enum CopresenceStatus { SUCCESS, FAIL }; | |
20 | |
21 // Callback type to send a status. | |
22 typedef base::Callback<void(CopresenceStatus)> StatusCallback; | |
23 | |
24 // A delegate interface for users of Copresence. | |
25 class CopresenceClientDelegate { | |
26 public: | |
27 // This method will be called when we have subscribed messages that need to | |
28 // be sent to their respective apps. | |
29 virtual void HandleMessages( | |
30 const std::string& app_id, | |
31 const std::string& subscription_id, | |
32 const std::vector<copresence::Message>& message) = 0; | |
33 | |
34 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; | |
35 | |
36 virtual const std::string GetPlatformVersionString() const = 0; | |
37 | |
38 // Methods to set and and get our device ID. This needs to be saved to | |
39 // persistent storage to avoid flooding the Copresence server with generate | |
40 // id requests. | |
41 virtual const std::string GetDeviceId() const = 0; | |
42 virtual void SaveDeviceId(const std::string& device_id) = 0; | |
43 }; | |
44 | |
45 } // namespace copresence | |
46 | |
47 #endif // COMPONENTS_COPRESENCE_INTERFACE_COPRESENCE_DELGATE_H_ | |
OLD | NEW |