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 "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 DCHECK(session); | 144 DCHECK(session); |
145 set_http_transaction_factory(new net::HttpNetworkLayer(session)); | 145 set_http_transaction_factory(new net::HttpNetworkLayer(session)); |
146 | 146 |
147 // TODO(timsteele): We don't currently listen for pref changes of these | 147 // TODO(timsteele): We don't currently listen for pref changes of these |
148 // fields or CookiePolicy; I'm not sure we want to strictly follow the | 148 // fields or CookiePolicy; I'm not sure we want to strictly follow the |
149 // default settings, since for example if the user chooses to block all | 149 // default settings, since for example if the user chooses to block all |
150 // cookies, sync will start failing. Also it seems like accept_lang/charset | 150 // cookies, sync will start failing. Also it seems like accept_lang/charset |
151 // should be tied to whatever the sync servers expect (if anything). These | 151 // should be tied to whatever the sync servers expect (if anything). These |
152 // fields should probably just be settable by sync backend; though we should | 152 // fields should probably just be settable by sync backend; though we should |
153 // figure out if we need to give the user explicit control over policies etc. | 153 // figure out if we need to give the user explicit control over policies etc. |
| 154 std::string accepted_language_list; |
| 155 if (baseline_context->http_user_agent_settings()) { |
| 156 accepted_language_list = |
| 157 baseline_context->http_user_agent_settings()->GetAcceptLanguage(); |
| 158 } |
154 http_user_agent_settings_.reset(new net::StaticHttpUserAgentSettings( | 159 http_user_agent_settings_.reset(new net::StaticHttpUserAgentSettings( |
155 baseline_context->GetAcceptLanguage(), | 160 accepted_language_list, |
156 user_agent)); | 161 user_agent)); |
157 set_http_user_agent_settings(http_user_agent_settings_.get()); | 162 set_http_user_agent_settings(http_user_agent_settings_.get()); |
158 | 163 |
159 set_net_log(baseline_context->net_log()); | 164 set_net_log(baseline_context->net_log()); |
160 } | 165 } |
161 | 166 |
162 HttpBridge::RequestContext::~RequestContext() { | 167 HttpBridge::RequestContext::~RequestContext() { |
163 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 168 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
164 delete http_transaction_factory(); | 169 delete http_transaction_factory(); |
165 } | 170 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 int64 sane_time_ms = 0; | 388 int64 sane_time_ms = 0; |
384 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { | 389 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { |
385 network_time_update_callback_.Run( | 390 network_time_update_callback_.Run( |
386 base::Time::FromJsTime(sane_time_ms), | 391 base::Time::FromJsTime(sane_time_ms), |
387 base::TimeDelta::FromMilliseconds(1), | 392 base::TimeDelta::FromMilliseconds(1), |
388 fetch_state_.end_time - fetch_state_.start_time); | 393 fetch_state_.end_time - fetch_state_.start_time); |
389 } | 394 } |
390 } | 395 } |
391 | 396 |
392 } // namespace syncer | 397 } // namespace syncer |
OLD | NEW |