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 "content/browser/resolve_proxy_msg_helper.h" | 5 #include "content/browser/resolve_proxy_msg_helper.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "content/common/child_process_messages.h" | 9 #include "content/common/child_process_messages.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 bool ResolveProxyMsgHelper::GetProxyService(net::ProxyService** out) const { | 85 bool ResolveProxyMsgHelper::GetProxyService(net::ProxyService** out) const { |
86 // Unit-tests specify their own proxy service to use. | 86 // Unit-tests specify their own proxy service to use. |
87 if (proxy_service_override_) { | 87 if (proxy_service_override_) { |
88 *out = proxy_service_override_; | 88 *out = proxy_service_override_; |
89 return true; | 89 return true; |
90 } | 90 } |
91 | 91 |
92 // If there is no default request context (say during shut down). | 92 // If there is no default request context (say during shut down). |
93 net::URLRequestContextGetter* context_getter = | 93 net::URLRequestContextGetter* context_getter = |
94 Profile::GetDefaultRequestContext(); | 94 Profile::Deprecated::GetDefaultRequestContext(); |
95 if (!context_getter) | 95 if (!context_getter) |
96 return false; | 96 return false; |
97 | 97 |
98 // Otherwise use the browser's global proxy service. | 98 // Otherwise use the browser's global proxy service. |
99 *out = context_getter->GetURLRequestContext()->proxy_service(); | 99 *out = context_getter->GetURLRequestContext()->proxy_service(); |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 ResolveProxyMsgHelper::~ResolveProxyMsgHelper() { | 103 ResolveProxyMsgHelper::~ResolveProxyMsgHelper() { |
104 // Clear all pending requests if the ProxyService is still alive (if we have a | 104 // Clear all pending requests if the ProxyService is still alive (if we have a |
105 // default request context or override). | 105 // default request context or override). |
106 if (!pending_requests_.empty() && | 106 if (!pending_requests_.empty() && |
107 (Profile::GetDefaultRequestContext() || proxy_service_override_)) { | 107 (Profile::Deprecated::GetDefaultRequestContext() || |
| 108 proxy_service_override_)) { |
108 PendingRequest req = pending_requests_.front(); | 109 PendingRequest req = pending_requests_.front(); |
109 proxy_service_->CancelPacRequest(req.pac_req); | 110 proxy_service_->CancelPacRequest(req.pac_req); |
110 } | 111 } |
111 | 112 |
112 for (PendingRequestList::iterator it = pending_requests_.begin(); | 113 for (PendingRequestList::iterator it = pending_requests_.begin(); |
113 it != pending_requests_.end(); | 114 it != pending_requests_.end(); |
114 ++it) { | 115 ++it) { |
115 delete it->reply_msg; | 116 delete it->reply_msg; |
116 } | 117 } |
117 | 118 |
118 proxy_service_ = NULL; | 119 proxy_service_ = NULL; |
119 pending_requests_.clear(); | 120 pending_requests_.clear(); |
120 } | 121 } |
OLD | NEW |