| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/sync/engine/net/server_connection_manager.h" | 5 #include "chrome/browser/sync/engine/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 <string> | 10 #include <string> |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 // For unit tests. | 322 // For unit tests. |
| 323 if (server_url.empty()) | 323 if (server_url.empty()) |
| 324 return std::string(); | 324 return std::string(); |
| 325 // We just want the hostname, so we don't need to switch on use_ssl. | 325 // We just want the hostname, so we don't need to switch on use_ssl. |
| 326 server_url = "http://" + server_url; | 326 server_url = "http://" + server_url; |
| 327 GURL gurl(server_url); | 327 GURL gurl(server_url); |
| 328 DCHECK(gurl.is_valid()) << gurl; | 328 DCHECK(gurl.is_valid()) << gurl; |
| 329 return gurl.host(); | 329 return gurl.host(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 ServerConnectionManager::Post* ServerConnectionManager::MakePost() { |
| 333 return NULL; // For testing. |
| 334 } |
| 335 |
| 332 bool FillMessageWithShareDetails(sync_pb::ClientToServerMessage* csm, | 336 bool FillMessageWithShareDetails(sync_pb::ClientToServerMessage* csm, |
| 333 syncable::DirectoryManager* manager, | 337 syncable::DirectoryManager* manager, |
| 334 const std::string& share) { | 338 const std::string& share) { |
| 335 syncable::ScopedDirLookup dir(manager, share); | 339 syncable::ScopedDirLookup dir(manager, share); |
| 336 if (!dir.good()) { | 340 if (!dir.good()) { |
| 337 VLOG(1) << "Dir lookup failed"; | 341 VLOG(1) << "Dir lookup failed"; |
| 338 return false; | 342 return false; |
| 339 } | 343 } |
| 340 string birthday = dir->store_birthday(); | 344 string birthday = dir->store_birthday(); |
| 341 if (!birthday.empty()) | 345 if (!birthday.empty()) |
| 342 csm->set_store_birthday(birthday); | 346 csm->set_store_birthday(birthday); |
| 343 csm->set_share(share); | 347 csm->set_share(share); |
| 344 return true; | 348 return true; |
| 345 } | 349 } |
| 346 | 350 |
| 347 std::ostream& operator << (std::ostream& s, const struct HttpResponse& hr) { | 351 std::ostream& operator << (std::ostream& s, const struct HttpResponse& hr) { |
| 348 s << " Response Code (bogus on error): " << hr.response_code; | 352 s << " Response Code (bogus on error): " << hr.response_code; |
| 349 s << " Content-Length (bogus on error): " << hr.content_length; | 353 s << " Content-Length (bogus on error): " << hr.content_length; |
| 350 s << " Server Status: " << hr.server_status; | 354 s << " Server Status: " << hr.server_status; |
| 351 return s; | 355 return s; |
| 352 } | 356 } |
| 353 | 357 |
| 354 } // namespace browser_sync | 358 } // namespace browser_sync |
| OLD | NEW |