OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 SYNC_ENGINE_NET_SERVER_CONNECTION_MANAGER_H_ | 5 #ifndef SYNC_ENGINE_NET_SERVER_CONNECTION_MANAGER_H_ |
6 #define SYNC_ENGINE_NET_SERVER_CONNECTION_MANAGER_H_ | 6 #define SYNC_ENGINE_NET_SERVER_CONNECTION_MANAGER_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 private: | 176 private: |
177 int ReadResponse(void* buffer, int length); | 177 int ReadResponse(void* buffer, int length); |
178 int ReadResponse(std::string* buffer, int length); | 178 int ReadResponse(std::string* buffer, int length); |
179 }; | 179 }; |
180 | 180 |
181 ServerConnectionManager(const std::string& server, | 181 ServerConnectionManager(const std::string& server, |
182 int port, | 182 int port, |
183 bool use_ssl, | 183 bool use_ssl, |
184 CancelationSignal* cancelation_signal); | 184 CancelationSignal* cancelation_signal); |
185 | 185 |
186 virtual ~ServerConnectionManager(); | 186 ~ServerConnectionManager() override; |
187 | 187 |
188 // POSTS buffer_in and reads a response into buffer_out. Uses our currently | 188 // POSTS buffer_in and reads a response into buffer_out. Uses our currently |
189 // set auth token in our headers. | 189 // set auth token in our headers. |
190 // | 190 // |
191 // Returns true if executed successfully. | 191 // Returns true if executed successfully. |
192 virtual bool PostBufferWithCachedAuth(PostBufferParams* params, | 192 virtual bool PostBufferWithCachedAuth(PostBufferParams* params, |
193 ScopedServerStatusWatcher* watcher); | 193 ScopedServerStatusWatcher* watcher); |
194 | 194 |
195 void AddListener(ServerConnectionEventListener* listener); | 195 void AddListener(ServerConnectionEventListener* listener); |
196 void RemoveListener(ServerConnectionEventListener* listener); | 196 void RemoveListener(ServerConnectionEventListener* listener); |
(...skipping 13 matching lines...) Expand all Loading... |
210 std::string GetServerHost() const; | 210 std::string GetServerHost() const; |
211 | 211 |
212 // Factory method to create an Connection object we can use for | 212 // Factory method to create an Connection object we can use for |
213 // communication with the server. | 213 // communication with the server. |
214 virtual Connection* MakeConnection(); | 214 virtual Connection* MakeConnection(); |
215 | 215 |
216 // Closes any active network connections to the sync server. | 216 // Closes any active network connections to the sync server. |
217 // We expect this to get called on a different thread than the valid | 217 // We expect this to get called on a different thread than the valid |
218 // ThreadChecker thread, as we want to kill any pending http traffic without | 218 // ThreadChecker thread, as we want to kill any pending http traffic without |
219 // having to wait for the request to complete. | 219 // having to wait for the request to complete. |
220 virtual void OnSignalReceived() override final; | 220 void OnSignalReceived() final; |
221 | 221 |
222 void set_client_id(const std::string& client_id) { | 222 void set_client_id(const std::string& client_id) { |
223 DCHECK(thread_checker_.CalledOnValidThread()); | 223 DCHECK(thread_checker_.CalledOnValidThread()); |
224 DCHECK(client_id_.empty()); | 224 DCHECK(client_id_.empty()); |
225 client_id_.assign(client_id); | 225 client_id_.assign(client_id); |
226 } | 226 } |
227 | 227 |
228 // Sets a new auth token and time. | 228 // Sets a new auth token and time. |
229 bool SetAuthToken(const std::string& auth_token); | 229 bool SetAuthToken(const std::string& auth_token); |
230 | 230 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 bool signal_handler_registered_; | 332 bool signal_handler_registered_; |
333 | 333 |
334 DISALLOW_COPY_AND_ASSIGN(ServerConnectionManager); | 334 DISALLOW_COPY_AND_ASSIGN(ServerConnectionManager); |
335 }; | 335 }; |
336 | 336 |
337 std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr); | 337 std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr); |
338 | 338 |
339 } // namespace syncer | 339 } // namespace syncer |
340 | 340 |
341 #endif // SYNC_ENGINE_NET_SERVER_CONNECTION_MANAGER_H_ | 341 #endif // SYNC_ENGINE_NET_SERVER_CONNECTION_MANAGER_H_ |
OLD | NEW |