| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/glue/http_bridge.h" | 5 #include "chrome/browser/sync/glue/http_bridge.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| 11 #include "content/common/content_client.h" |
| 11 #include "net/base/cookie_monster.h" | 12 #include "net/base/cookie_monster.h" |
| 12 #include "net/base/host_resolver.h" | 13 #include "net/base/host_resolver.h" |
| 13 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
| 14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 15 #include "net/http/http_cache.h" | 16 #include "net/http/http_cache.h" |
| 16 #include "net/http/http_network_layer.h" | 17 #include "net/http/http_network_layer.h" |
| 17 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
| 18 #include "net/proxy/proxy_service.h" | 19 #include "net/proxy/proxy_service.h" |
| 19 #include "net/url_request/url_request_context.h" | 20 #include "net/url_request/url_request_context.h" |
| 20 #include "net/url_request/url_request_status.h" | 21 #include "net/url_request/url_request_status.h" |
| 21 #include "webkit/glue/webkit_glue.h" | |
| 22 | 22 |
| 23 namespace browser_sync { | 23 namespace browser_sync { |
| 24 | 24 |
| 25 HttpBridge::RequestContextGetter::RequestContextGetter( | 25 HttpBridge::RequestContextGetter::RequestContextGetter( |
| 26 net::URLRequestContextGetter* baseline_context_getter) | 26 net::URLRequestContextGetter* baseline_context_getter) |
| 27 : baseline_context_getter_(baseline_context_getter) { | 27 : baseline_context_getter_(baseline_context_getter) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 net::URLRequestContext* | 30 net::URLRequestContext* |
| 31 HttpBridge::RequestContextGetter::GetURLRequestContext() { | 31 HttpBridge::RequestContextGetter::GetURLRequestContext() { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // default settings, since for example if the user chooses to block all | 95 // default settings, since for example if the user chooses to block all |
| 96 // cookies, sync will start failing. Also it seems like accept_lang/charset | 96 // cookies, sync will start failing. Also it seems like accept_lang/charset |
| 97 // should be tied to whatever the sync servers expect (if anything). These | 97 // should be tied to whatever the sync servers expect (if anything). These |
| 98 // fields should probably just be settable by sync backend; though we should | 98 // fields should probably just be settable by sync backend; though we should |
| 99 // figure out if we need to give the user explicit control over policies etc. | 99 // figure out if we need to give the user explicit control over policies etc. |
| 100 set_accept_language(baseline_context->accept_language()); | 100 set_accept_language(baseline_context->accept_language()); |
| 101 set_accept_charset(baseline_context->accept_charset()); | 101 set_accept_charset(baseline_context->accept_charset()); |
| 102 | 102 |
| 103 // We default to the browser's user agent. This can (and should) be overridden | 103 // We default to the browser's user agent. This can (and should) be overridden |
| 104 // with set_user_agent. | 104 // with set_user_agent. |
| 105 set_user_agent(webkit_glue::GetUserAgent(GURL())); | 105 set_user_agent(content::GetUserAgent(GURL())); |
| 106 | 106 |
| 107 set_net_log(baseline_context->net_log()); | 107 set_net_log(baseline_context->net_log()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 HttpBridge::RequestContext::~RequestContext() { | 110 HttpBridge::RequestContext::~RequestContext() { |
| 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 112 delete http_transaction_factory(); | 112 delete http_transaction_factory(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 HttpBridge::URLFetchState::URLFetchState() : url_poster(NULL), | 115 HttpBridge::URLFetchState::URLFetchState() : url_poster(NULL), |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. | 290 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. |
| 291 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster); | 291 MessageLoop::current()->DeleteSoon(FROM_HERE, fetch_state_.url_poster); |
| 292 fetch_state_.url_poster = NULL; | 292 fetch_state_.url_poster = NULL; |
| 293 | 293 |
| 294 // Wake the blocked syncer thread in MakeSynchronousPost. | 294 // Wake the blocked syncer thread in MakeSynchronousPost. |
| 295 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! | 295 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! |
| 296 http_post_completed_.Signal(); | 296 http_post_completed_.Signal(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 } // namespace browser_sync | 299 } // namespace browser_sync |
| OLD | NEW |