Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 // SERVER_CONNECTION_OK is returned when request was handled correctly. | 61 // SERVER_CONNECTION_OK is returned when request was handled correctly. |
| 62 SERVER_CONNECTION_OK, | 62 SERVER_CONNECTION_OK, |
| 63 | 63 |
| 64 // RETRY is returned when a Commit request fails with a RETRY response from | 64 // RETRY is returned when a Commit request fails with a RETRY response from |
| 65 // the server. | 65 // the server. |
| 66 // | 66 // |
| 67 // TODO(idana): the server no longer returns RETRY so we should remove this | 67 // TODO(idana): the server no longer returns RETRY so we should remove this |
| 68 // value. | 68 // value. |
| 69 RETRY, | 69 RETRY, |
| 70 | |
| 71 // TOKEN_REFRESHED is not really a response from server, but a state of | |
| 72 // connection after AUTH_ERROR when new access token was issued but not yet | |
|
tim (not reviewing)
2013/05/23 19:03:42
Issued by who? Not sure I know what this is about
pavely
2013/05/30 07:42:12
Removed this.
| |
| 73 // used in requests to server. | |
| 74 TOKEN_REFRESHED, | |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 // The HTTP Status code. | 77 // The HTTP Status code. |
| 73 int64 response_code; | 78 int64 response_code; |
| 74 | 79 |
| 75 // The value of the Content-length header. | 80 // The value of the Content-length header. |
| 76 int64 content_length; | 81 int64 content_length; |
| 77 | 82 |
| 78 // The size of a download request's payload. | 83 // The size of a download request's payload. |
| 79 int64 payload_length; | 84 int64 payload_length; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 const std::string auth_token() const { | 254 const std::string auth_token() const { |
| 250 DCHECK(thread_checker_.CalledOnValidThread()); | 255 DCHECK(thread_checker_.CalledOnValidThread()); |
| 251 return auth_token_; | 256 return auth_token_; |
| 252 } | 257 } |
| 253 | 258 |
| 254 protected: | 259 protected: |
| 255 inline std::string proto_sync_path() const { | 260 inline std::string proto_sync_path() const { |
| 256 return proto_sync_path_; | 261 return proto_sync_path_; |
| 257 } | 262 } |
| 258 | 263 |
| 264 public: | |
|
tim (not reviewing)
2013/05/23 19:03:42
Move the call up to the public section instead.
pavely
2013/05/30 07:42:12
I reverted this change.
| |
| 259 // Updates server_status_ and notifies listeners if server_status_ changed | 265 // Updates server_status_ and notifies listeners if server_status_ changed |
| 260 void SetServerStatus(HttpResponse::ServerConnectionCode server_status); | 266 void SetServerStatus(HttpResponse::ServerConnectionCode server_status); |
| 261 | 267 |
| 268 protected: | |
|
tim (not reviewing)
2013/05/23 19:03:42
indent is off.
| |
| 262 // NOTE: Tests rely on this protected function being virtual. | 269 // NOTE: Tests rely on this protected function being virtual. |
| 263 // | 270 // |
| 264 // Internal PostBuffer base function. | 271 // Internal PostBuffer base function. |
| 265 virtual bool PostBufferToPath(PostBufferParams*, | 272 virtual bool PostBufferToPath(PostBufferParams*, |
| 266 const std::string& path, | 273 const std::string& path, |
| 267 const std::string& auth_token, | 274 const std::string& auth_token, |
| 268 ScopedServerStatusWatcher* watcher); | 275 ScopedServerStatusWatcher* watcher); |
| 269 | 276 |
| 270 // An internal helper to clear our auth_token_ and cache the old version | 277 // An internal helper to clear our auth_token_ and cache the old version |
| 271 // in |previously_invalidated_token_| to shelter us from retrying with a | 278 // in |previously_invalidated_token_| to shelter us from retrying with a |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 void NotifyStatusChanged(); | 350 void NotifyStatusChanged(); |
| 344 | 351 |
| 345 DISALLOW_COPY_AND_ASSIGN(ServerConnectionManager); | 352 DISALLOW_COPY_AND_ASSIGN(ServerConnectionManager); |
| 346 }; | 353 }; |
| 347 | 354 |
| 348 std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr); | 355 std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr); |
| 349 | 356 |
| 350 } // namespace syncer | 357 } // namespace syncer |
| 351 | 358 |
| 352 #endif // SYNC_ENGINE_NET_SERVER_CONNECTION_MANAGER_H_ | 359 #endif // SYNC_ENGINE_NET_SERVER_CONNECTION_MANAGER_H_ |
| OLD | NEW |