| 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/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_util.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| 11 #include "chrome/browser/profile.h" | 11 #include "chrome/browser/profile.h" |
| 12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
| 13 #include "net/base/cookie_monster.h" | 13 #include "net/base/cookie_monster.h" |
| 14 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
| 15 #include "net/http/http_cache.h" | 15 #include "net/http/http_cache.h" |
| 16 #include "net/http/http_network_layer.h" | 16 #include "net/http/http_network_layer.h" |
| 17 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 18 #include "net/proxy/proxy_service.h" | 18 #include "net/proxy/proxy_service.h" |
| 19 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 extra_headers_.assign(headers); | 136 extra_headers_.assign(headers); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void HttpBridge::SetURL(const char* url, int port) { | 139 void HttpBridge::SetURL(const char* url, int port) { |
| 140 DCHECK_EQ(MessageLoop::current(), created_on_loop_); | 140 DCHECK_EQ(MessageLoop::current(), created_on_loop_); |
| 141 DCHECK(!request_completed_); | 141 DCHECK(!request_completed_); |
| 142 DCHECK(url_for_request_.is_empty()) | 142 DCHECK(url_for_request_.is_empty()) |
| 143 << "HttpBridge::SetURL called more than once?!"; | 143 << "HttpBridge::SetURL called more than once?!"; |
| 144 GURL temp(url); | 144 GURL temp(url); |
| 145 GURL::Replacements replacements; | 145 GURL::Replacements replacements; |
| 146 std::string port_str = IntToString(port); | 146 std::string port_str = base::IntToString(port); |
| 147 replacements.SetPort(port_str.c_str(), | 147 replacements.SetPort(port_str.c_str(), |
| 148 url_parse::Component(0, port_str.length())); | 148 url_parse::Component(0, port_str.length())); |
| 149 url_for_request_ = temp.ReplaceComponents(replacements); | 149 url_for_request_ = temp.ReplaceComponents(replacements); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void HttpBridge::SetPostPayload(const char* content_type, | 152 void HttpBridge::SetPostPayload(const char* content_type, |
| 153 int content_length, | 153 int content_length, |
| 154 const char* content) { | 154 const char* content) { |
| 155 DCHECK_EQ(MessageLoop::current(), created_on_loop_); | 155 DCHECK_EQ(MessageLoop::current(), created_on_loop_); |
| 156 DCHECK(!request_completed_); | 156 DCHECK(!request_completed_); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. | 239 // URLFetcher, so it seems most natural / "polite" to let the stack unwind. |
| 240 MessageLoop::current()->DeleteSoon(FROM_HERE, url_poster_); | 240 MessageLoop::current()->DeleteSoon(FROM_HERE, url_poster_); |
| 241 url_poster_ = NULL; | 241 url_poster_ = NULL; |
| 242 | 242 |
| 243 // Wake the blocked syncer thread in MakeSynchronousPost. | 243 // Wake the blocked syncer thread in MakeSynchronousPost. |
| 244 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! | 244 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! |
| 245 http_post_completed_.Signal(); | 245 http_post_completed_.Signal(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace browser_sync | 248 } // namespace browser_sync |
| OLD | NEW |