OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/renderer_host/pepper/pepper_network_proxy_host.h" | 5 #include "content/browser/renderer_host/pepper/pepper_network_proxy_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" | 8 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
9 #include "content/browser/renderer_host/pepper/pepper_socket_utils.h" | 9 #include "content/browser/renderer_host/pepper/pepper_socket_utils.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 SendFailureReply(PP_ERROR_NOACCESS, request.reply_context); | 137 SendFailureReply(PP_ERROR_NOACCESS, request.reply_context); |
138 } else { | 138 } else { |
139 // Everything looks valid, so try to resolve the proxy. | 139 // Everything looks valid, so try to resolve the proxy. |
140 net::ProxyInfo* proxy_info = new net::ProxyInfo; | 140 net::ProxyInfo* proxy_info = new net::ProxyInfo; |
141 net::ProxyService::PacRequest* pending_request = NULL; | 141 net::ProxyService::PacRequest* pending_request = NULL; |
142 base::Callback<void(int)> callback = | 142 base::Callback<void(int)> callback = |
143 base::Bind(&PepperNetworkProxyHost::OnResolveProxyCompleted, | 143 base::Bind(&PepperNetworkProxyHost::OnResolveProxyCompleted, |
144 weak_factory_.GetWeakPtr(), | 144 weak_factory_.GetWeakPtr(), |
145 request.reply_context, | 145 request.reply_context, |
146 base::Owned(proxy_info)); | 146 base::Owned(proxy_info)); |
147 int result = proxy_service_->ResolveProxy(request.url, | 147 int result = proxy_service_->ResolveProxy( |
148 std::string(), | 148 request.url, std::string(), proxy_info, callback, &pending_request, |
149 proxy_info, | 149 NULL, net::NetLogWithSource()); |
150 callback, | |
151 &pending_request, | |
152 NULL, | |
153 net::BoundNetLog()); | |
154 pending_requests_.push(pending_request); | 150 pending_requests_.push(pending_request); |
155 // If it was handled synchronously, we must run the callback now; | 151 // If it was handled synchronously, we must run the callback now; |
156 // proxy_service_ won't run it for us in this case. | 152 // proxy_service_ won't run it for us in this case. |
157 if (result != net::ERR_IO_PENDING) | 153 if (result != net::ERR_IO_PENDING) |
158 callback.Run(result); | 154 callback.Run(result); |
159 } | 155 } |
160 unsent_requests_.pop(); | 156 unsent_requests_.pop(); |
161 } | 157 } |
162 } | 158 } |
163 | 159 |
(...skipping 17 matching lines...) Expand all Loading... |
181 | 177 |
182 void PepperNetworkProxyHost::SendFailureReply( | 178 void PepperNetworkProxyHost::SendFailureReply( |
183 int32_t error, | 179 int32_t error, |
184 ppapi::host::ReplyMessageContext context) { | 180 ppapi::host::ReplyMessageContext context) { |
185 context.params.set_result(error); | 181 context.params.set_result(error); |
186 host()->SendReply( | 182 host()->SendReply( |
187 context, PpapiPluginMsg_NetworkProxy_GetProxyForURLReply(std::string())); | 183 context, PpapiPluginMsg_NetworkProxy_GetProxyForURLReply(std::string())); |
188 } | 184 } |
189 | 185 |
190 } // namespace content | 186 } // namespace content |
OLD | NEW |