Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: components/copresence/rpc/rpc_handler.h

Issue 824593003: Revert of Adding CopresenceState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_delegate.h" 17 #include "components/copresence/public/copresence_delegate.h"
18 #include "components/copresence/timed_map.h" 18 #include "components/copresence/timed_map.h"
19 19
20 namespace copresence { 20 namespace copresence {
21 21
22 struct AudioToken; 22 struct AudioToken;
23 class CopresenceDelegate; 23 class CopresenceDelegate;
24 class CopresenceStateImpl;
25 class DirectiveHandler; 24 class DirectiveHandler;
26 class GCMHandler; 25 class GCMHandler;
27 class HttpPost; 26 class HttpPost;
28 class ReportRequest; 27 class ReportRequest;
29 class RequestHeader; 28 class RequestHeader;
30 class SubscribedMessage; 29 class SubscribedMessage;
31 30
32 // This class currently handles all communication with the copresence server. 31 // This class currently handles all communication with the copresence server.
33 class RpcHandler { 32 class RpcHandler {
34 public: 33 public:
(...skipping 24 matching lines...) Expand all
59 scoped_ptr<google::protobuf::MessageLite>, 58 scoped_ptr<google::protobuf::MessageLite>,
60 const PostCleanupCallback&)> PostCallback; 59 const PostCleanupCallback&)> PostCallback;
61 60
62 // Report rpc name to send to Apiary. 61 // Report rpc name to send to Apiary.
63 static const char kReportRequestRpcName[]; 62 static const char kReportRequestRpcName[];
64 63
65 // Constructor. |delegate| and |directive_handler| 64 // Constructor. |delegate| and |directive_handler|
66 // are owned by the caller and must outlive the RpcHandler. 65 // are owned by the caller and must outlive the RpcHandler.
67 // |server_post_callback| should be set only by tests. 66 // |server_post_callback| should be set only by tests.
68 RpcHandler(CopresenceDelegate* delegate, 67 RpcHandler(CopresenceDelegate* delegate,
69 CopresenceStateImpl* state,
70 DirectiveHandler* directive_handler, 68 DirectiveHandler* directive_handler,
71 GCMHandler* gcm_handler, 69 GCMHandler* gcm_handler,
72 const PostCallback& server_post_callback = PostCallback()); 70 const PostCallback& server_post_callback = PostCallback());
73 71
74 virtual ~RpcHandler(); 72 virtual ~RpcHandler();
75 73
76 // Send a ReportRequest from a specific app, and get notified of completion. 74 // Send a ReportRequest from a specific app, and get notified of completion.
77 void SendReportRequest(scoped_ptr<ReportRequest> request, 75 void SendReportRequest(scoped_ptr<ReportRequest> request,
78 const std::string& app_id, 76 const std::string& app_id,
79 const std::string& auth_token, 77 const std::string& auth_token,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // to contact the server, but it can be overridden for testing. 152 // to contact the server, but it can be overridden for testing.
155 void SendHttpPost(net::URLRequestContextGetter* url_context_getter, 153 void SendHttpPost(net::URLRequestContextGetter* url_context_getter,
156 const std::string& rpc_name, 154 const std::string& rpc_name,
157 const std::string& api_key, 155 const std::string& api_key,
158 const std::string& auth_token, 156 const std::string& auth_token,
159 scoped_ptr<google::protobuf::MessageLite> request_proto, 157 scoped_ptr<google::protobuf::MessageLite> request_proto,
160 const PostCleanupCallback& callback); 158 const PostCleanupCallback& callback);
161 159
162 // These belong to the caller. 160 // These belong to the caller.
163 CopresenceDelegate* const delegate_; 161 CopresenceDelegate* const delegate_;
164 CopresenceStateImpl* state_;
165 DirectiveHandler* const directive_handler_; 162 DirectiveHandler* const directive_handler_;
166 GCMHandler* const gcm_handler_; 163 GCMHandler* const gcm_handler_;
167 164
168 PostCallback server_post_callback_; 165 PostCallback server_post_callback_;
169 166
170 ScopedVector<PendingRequest> pending_requests_queue_; 167 ScopedVector<PendingRequest> pending_requests_queue_;
171 TimedMap<std::string, bool> invalid_audio_token_cache_; 168 TimedMap<std::string, bool> invalid_audio_token_cache_;
172 std::map<std::string, std::string> device_id_by_auth_token_; 169 std::map<std::string, std::string> device_id_by_auth_token_;
173 std::set<HttpPost*> pending_posts_; 170 std::set<HttpPost*> pending_posts_;
174 std::string gcm_id_; 171 std::string gcm_id_;
175 172
176 DISALLOW_COPY_AND_ASSIGN(RpcHandler); 173 DISALLOW_COPY_AND_ASSIGN(RpcHandler);
177 }; 174 };
178 175
179 } // namespace copresence 176 } // namespace copresence
180 177
181 #endif // COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_ 178 #endif // COMPONENTS_COPRESENCE_RPC_RPC_HANDLER_H_
OLDNEW
« no previous file with comments | « components/copresence/public/copresence_state.h ('k') | components/copresence/rpc/rpc_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698