OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/resolve_proxy_msg_helper.h" | 5 #include "content/browser/resolve_proxy_msg_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
11 #include "net/base/load_flags.h" | |
12 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
13 #include "net/url_request/url_request_context.h" | 12 #include "net/url_request/url_request_context.h" |
14 #include "net/url_request/url_request_context_getter.h" | 13 #include "net/url_request/url_request_context_getter.h" |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 | 16 |
18 ResolveProxyMsgHelper::ResolveProxyMsgHelper( | 17 ResolveProxyMsgHelper::ResolveProxyMsgHelper( |
19 net::URLRequestContextGetter* getter) | 18 net::URLRequestContextGetter* getter) |
20 : BrowserMessageFilter(ViewMsgStart), | 19 : BrowserMessageFilter(ViewMsgStart), |
21 context_getter_(getter), | 20 context_getter_(getter), |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Verify the request wasn't started yet. | 84 // Verify the request wasn't started yet. |
86 DCHECK(NULL == req.pac_req); | 85 DCHECK(NULL == req.pac_req); |
87 | 86 |
88 if (context_getter_.get()) { | 87 if (context_getter_.get()) { |
89 proxy_service_ = context_getter_->GetURLRequestContext()->proxy_service(); | 88 proxy_service_ = context_getter_->GetURLRequestContext()->proxy_service(); |
90 context_getter_ = NULL; | 89 context_getter_ = NULL; |
91 } | 90 } |
92 | 91 |
93 // Start the request. | 92 // Start the request. |
94 int result = proxy_service_->ResolveProxy( | 93 int result = proxy_service_->ResolveProxy( |
95 req.url, std::string(), net::LOAD_NORMAL, &proxy_info_, | 94 req.url, std::string(), &proxy_info_, |
96 base::Bind(&ResolveProxyMsgHelper::OnResolveProxyCompleted, | 95 base::Bind(&ResolveProxyMsgHelper::OnResolveProxyCompleted, |
97 base::Unretained(this)), | 96 base::Unretained(this)), |
98 &req.pac_req, NULL, net::BoundNetLog()); | 97 &req.pac_req, NULL, net::BoundNetLog()); |
99 | 98 |
100 // Completed synchronously. | 99 // Completed synchronously. |
101 if (result != net::ERR_IO_PENDING) | 100 if (result != net::ERR_IO_PENDING) |
102 OnResolveProxyCompleted(result); | 101 OnResolveProxyCompleted(result); |
103 } | 102 } |
104 | 103 |
105 } // namespace content | 104 } // namespace content |
OLD | NEW |