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" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (!pending_requests_.empty()) | 76 if (!pending_requests_.empty()) |
77 StartPendingRequest(); | 77 StartPendingRequest(); |
78 } | 78 } |
79 | 79 |
80 void ResolveProxyMsgHelper::StartPendingRequest() { | 80 void ResolveProxyMsgHelper::StartPendingRequest() { |
81 PendingRequest& req = pending_requests_.front(); | 81 PendingRequest& req = pending_requests_.front(); |
82 | 82 |
83 // Verify the request wasn't started yet. | 83 // Verify the request wasn't started yet. |
84 DCHECK(NULL == req.pac_req); | 84 DCHECK(NULL == req.pac_req); |
85 | 85 |
86 if (context_getter_) { | 86 if (context_getter_.get()) { |
87 proxy_service_ = context_getter_->GetURLRequestContext()->proxy_service(); | 87 proxy_service_ = context_getter_->GetURLRequestContext()->proxy_service(); |
88 context_getter_ = NULL; | 88 context_getter_ = NULL; |
89 } | 89 } |
90 | 90 |
91 // Start the request. | 91 // Start the request. |
92 int result = proxy_service_->ResolveProxy( | 92 int result = proxy_service_->ResolveProxy( |
93 req.url, &proxy_info_, | 93 req.url, &proxy_info_, |
94 base::Bind(&ResolveProxyMsgHelper::OnResolveProxyCompleted, | 94 base::Bind(&ResolveProxyMsgHelper::OnResolveProxyCompleted, |
95 base::Unretained(this)), | 95 base::Unretained(this)), |
96 &req.pac_req, net::BoundNetLog()); | 96 &req.pac_req, net::BoundNetLog()); |
97 | 97 |
98 // Completed synchronously. | 98 // Completed synchronously. |
99 if (result != net::ERR_IO_PENDING) | 99 if (result != net::ERR_IO_PENDING) |
100 OnResolveProxyCompleted(result); | 100 OnResolveProxyCompleted(result); |
101 } | 101 } |
102 | 102 |
103 } // namespace content | 103 } // namespace content |
OLD | NEW |