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_RPC_RPC_HANDLER_H_ | 5 #ifndef COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ |
6 #define COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ | 6 #define COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "components/copresence/proto/enums.pb.h" | 16 #include "components/copresence/proto/enums.pb.h" |
17 #include "components/copresence/public/copresence_constants.h" | 17 #include "components/copresence/public/copresence_constants.h" |
18 #include "components/copresence/public/copresence_delegate.h" | 18 #include "components/copresence/public/copresence_delegate.h" |
19 #include "components/copresence/timed_map.h" | 19 #include "components/copresence/timed_map.h" |
20 | 20 |
| 21 namespace audio_modem { |
| 22 struct AudioToken; |
| 23 } |
| 24 |
21 namespace copresence { | 25 namespace copresence { |
22 | 26 |
23 struct AudioToken; | |
24 class CopresenceDelegate; | 27 class CopresenceDelegate; |
25 class CopresenceStateImpl; | 28 class CopresenceStateImpl; |
26 class DirectiveHandler; | 29 class DirectiveHandler; |
27 class GCMHandler; | 30 class GCMHandler; |
28 class HttpPost; | 31 class HttpPost; |
29 class ReportRequest; | 32 class ReportRequest; |
30 class RequestHeader; | 33 class RequestHeader; |
31 class SubscribedMessage; | 34 class SubscribedMessage; |
32 | 35 |
33 // This class currently handles all communication with the copresence server. | 36 // This class currently handles all communication with the copresence server. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 virtual ~RpcHandler(); | 81 virtual ~RpcHandler(); |
79 | 82 |
80 // Send a ReportRequest from a specific app, and get notified of completion. | 83 // Send a ReportRequest from a specific app, and get notified of completion. |
81 void SendReportRequest(scoped_ptr<ReportRequest> request, | 84 void SendReportRequest(scoped_ptr<ReportRequest> request, |
82 const std::string& app_id, | 85 const std::string& app_id, |
83 const std::string& auth_token, | 86 const std::string& auth_token, |
84 const StatusCallback& callback); | 87 const StatusCallback& callback); |
85 | 88 |
86 // Report a set of tokens to the server for a given medium. | 89 // Report a set of tokens to the server for a given medium. |
87 // Uses all active auth tokens (if any). | 90 // Uses all active auth tokens (if any). |
88 void ReportTokens(const std::vector<AudioToken>& tokens); | 91 void ReportTokens(const std::vector<audio_modem::AudioToken>& tokens); |
89 | 92 |
90 private: | 93 private: |
91 // A queued ReportRequest along with its metadata. | 94 // A queued ReportRequest along with its metadata. |
92 struct PendingRequest { | 95 struct PendingRequest { |
93 PendingRequest(scoped_ptr<ReportRequest> report, | 96 PendingRequest(scoped_ptr<ReportRequest> report, |
94 const std::string& app_id, | 97 const std::string& app_id, |
95 bool authenticated, | 98 bool authenticated, |
96 const StatusCallback& callback); | 99 const StatusCallback& callback); |
97 ~PendingRequest(); | 100 ~PendingRequest(); |
98 | 101 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 std::set<bool> pending_registrations_; | 180 std::set<bool> pending_registrations_; |
178 std::string auth_token_; | 181 std::string auth_token_; |
179 std::string gcm_id_; | 182 std::string gcm_id_; |
180 | 183 |
181 DISALLOW_COPY_AND_ASSIGN(RpcHandler); | 184 DISALLOW_COPY_AND_ASSIGN(RpcHandler); |
182 }; | 185 }; |
183 | 186 |
184 } // namespace copresence | 187 } // namespace copresence |
185 | 188 |
186 #endif // COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ | 189 #endif // COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ |
OLD | NEW |