| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "components/sync/engine_impl/net/server_connection_manager.h" | 5 #include "components/sync/engine_impl/net/server_connection_manager.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 if (server_status != HttpResponse::SYNC_AUTH_ERROR && | 233 if (server_status != HttpResponse::SYNC_AUTH_ERROR && |
| 234 server_status_ == server_status) { | 234 server_status_ == server_status) { |
| 235 return; | 235 return; |
| 236 } | 236 } |
| 237 server_status_ = server_status; | 237 server_status_ = server_status; |
| 238 NotifyStatusChanged(); | 238 NotifyStatusChanged(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void ServerConnectionManager::NotifyStatusChanged() { | 241 void ServerConnectionManager::NotifyStatusChanged() { |
| 242 DCHECK(thread_checker_.CalledOnValidThread()); | 242 DCHECK(thread_checker_.CalledOnValidThread()); |
| 243 FOR_EACH_OBSERVER( | 243 for (auto& observer : listeners_) |
| 244 ServerConnectionEventListener, listeners_, | 244 observer.OnServerConnectionEvent(ServerConnectionEvent(server_status_)); |
| 245 OnServerConnectionEvent(ServerConnectionEvent(server_status_))); | |
| 246 } | 245 } |
| 247 | 246 |
| 248 bool ServerConnectionManager::PostBufferWithCachedAuth( | 247 bool ServerConnectionManager::PostBufferWithCachedAuth( |
| 249 PostBufferParams* params) { | 248 PostBufferParams* params) { |
| 250 DCHECK(thread_checker_.CalledOnValidThread()); | 249 DCHECK(thread_checker_.CalledOnValidThread()); |
| 251 string path = | 250 string path = |
| 252 MakeSyncServerPath(proto_sync_path(), MakeSyncQueryString(client_id_)); | 251 MakeSyncServerPath(proto_sync_path(), MakeSyncQueryString(client_id_)); |
| 253 bool result = PostBufferToPath(params, path, auth_token()); | 252 bool result = PostBufferToPath(params, path, auth_token()); |
| 254 SetServerStatus(params->response.server_status); | 253 SetServerStatus(params->response.server_status); |
| 255 return result; | 254 return result; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 327 |
| 329 std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr) { | 328 std::ostream& operator<<(std::ostream& s, const struct HttpResponse& hr) { |
| 330 s << " Response Code (bogus on error): " << hr.response_code; | 329 s << " Response Code (bogus on error): " << hr.response_code; |
| 331 s << " Content-Length (bogus on error): " << hr.content_length; | 330 s << " Content-Length (bogus on error): " << hr.content_length; |
| 332 s << " Server Status: " | 331 s << " Server Status: " |
| 333 << HttpResponse::GetServerConnectionCodeString(hr.server_status); | 332 << HttpResponse::GetServerConnectionCodeString(hr.server_status); |
| 334 return s; | 333 return s; |
| 335 } | 334 } |
| 336 | 335 |
| 337 } // namespace syncer | 336 } // namespace syncer |
| OLD | NEW |