| 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 #include "sync/internal_api/public/http_bridge.h" | 5 #include "sync/internal_api/public/http_bridge.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 HttpBridge::URLFetchState::~URLFetchState() {} | 132 HttpBridge::URLFetchState::~URLFetchState() {} |
| 133 | 133 |
| 134 HttpBridge::HttpBridge( | 134 HttpBridge::HttpBridge( |
| 135 const std::string& user_agent, | 135 const std::string& user_agent, |
| 136 const scoped_refptr<net::URLRequestContextGetter>& context_getter, | 136 const scoped_refptr<net::URLRequestContextGetter>& context_getter, |
| 137 const NetworkTimeUpdateCallback& network_time_update_callback, | 137 const NetworkTimeUpdateCallback& network_time_update_callback, |
| 138 const BindToTrackerCallback& bind_to_tracker_callback) | 138 const BindToTrackerCallback& bind_to_tracker_callback) |
| 139 : created_on_loop_(base::MessageLoop::current()), | 139 : created_on_loop_(base::MessageLoop::current()), |
| 140 user_agent_(user_agent), | 140 user_agent_(user_agent), |
| 141 http_post_completed_(false, false), | 141 http_post_completed_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 142 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 142 request_context_getter_(context_getter), | 143 request_context_getter_(context_getter), |
| 143 network_task_runner_(request_context_getter_->GetNetworkTaskRunner()), | 144 network_task_runner_(request_context_getter_->GetNetworkTaskRunner()), |
| 144 network_time_update_callback_(network_time_update_callback), | 145 network_time_update_callback_(network_time_update_callback), |
| 145 bind_to_tracker_callback_(bind_to_tracker_callback) {} | 146 bind_to_tracker_callback_(bind_to_tracker_callback) {} |
| 146 | 147 |
| 147 HttpBridge::~HttpBridge() { | 148 HttpBridge::~HttpBridge() { |
| 148 } | 149 } |
| 149 | 150 |
| 150 void HttpBridge::SetExtraRequestHeaders(const char * headers) { | 151 void HttpBridge::SetExtraRequestHeaders(const char * headers) { |
| 151 DCHECK(extra_headers_.empty()) | 152 DCHECK(extra_headers_.empty()) |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 int64_t sane_time_ms = 0; | 455 int64_t sane_time_ms = 0; |
| 455 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { | 456 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { |
| 456 network_time_update_callback_.Run( | 457 network_time_update_callback_.Run( |
| 457 base::Time::FromJsTime(sane_time_ms), | 458 base::Time::FromJsTime(sane_time_ms), |
| 458 base::TimeDelta::FromMilliseconds(1), | 459 base::TimeDelta::FromMilliseconds(1), |
| 459 fetch_state_.end_time - fetch_state_.start_time); | 460 fetch_state_.end_time - fetch_state_.start_time); |
| 460 } | 461 } |
| 461 } | 462 } |
| 462 | 463 |
| 463 } // namespace syncer | 464 } // namespace syncer |
| OLD | NEW |