| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(request.url, |
| 148 0, |
| 148 proxy_info, | 149 proxy_info, |
| 149 callback, | 150 callback, |
| 150 &pending_request, | 151 &pending_request, |
| 152 NULL, |
| 151 net::BoundNetLog()); | 153 net::BoundNetLog()); |
| 152 pending_requests_.push(pending_request); | 154 pending_requests_.push(pending_request); |
| 153 // If it was handled synchronously, we must run the callback now; | 155 // If it was handled synchronously, we must run the callback now; |
| 154 // proxy_service_ won't run it for us in this case. | 156 // proxy_service_ won't run it for us in this case. |
| 155 if (result != net::ERR_IO_PENDING) | 157 if (result != net::ERR_IO_PENDING) |
| 156 callback.Run(result); | 158 callback.Run(result); |
| 157 } | 159 } |
| 158 unsent_requests_.pop(); | 160 unsent_requests_.pop(); |
| 159 } | 161 } |
| 160 } | 162 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 179 | 181 |
| 180 void PepperNetworkProxyHost::SendFailureReply( | 182 void PepperNetworkProxyHost::SendFailureReply( |
| 181 int32_t error, | 183 int32_t error, |
| 182 ppapi::host::ReplyMessageContext context) { | 184 ppapi::host::ReplyMessageContext context) { |
| 183 context.params.set_result(error); | 185 context.params.set_result(error); |
| 184 host()->SendReply( | 186 host()->SendReply( |
| 185 context, PpapiPluginMsg_NetworkProxy_GetProxyForURLReply(std::string())); | 187 context, PpapiPluginMsg_NetworkProxy_GetProxyForURLReply(std::string())); |
| 186 } | 188 } |
| 187 | 189 |
| 188 } // namespace content | 190 } // namespace content |
| OLD | NEW |