| 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" |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
| 13 #include "content/public/common/socket_permission_request.h" | 13 #include "content/public/common/socket_permission_request.h" |
| 14 #include "net/base/load_flags.h" |
| 14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 15 #include "net/proxy/proxy_info.h" | 16 #include "net/proxy/proxy_info.h" |
| 16 #include "net/url_request/url_request_context.h" | 17 #include "net/url_request/url_request_context.h" |
| 17 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 18 #include "ppapi/c/pp_errors.h" | 19 #include "ppapi/c/pp_errors.h" |
| 19 #include "ppapi/host/dispatch_host_message.h" | 20 #include "ppapi/host/dispatch_host_message.h" |
| 20 #include "ppapi/host/ppapi_host.h" | 21 #include "ppapi/host/ppapi_host.h" |
| 21 #include "ppapi/proxy/ppapi_messages.h" | 22 #include "ppapi/proxy/ppapi_messages.h" |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } else { | 139 } else { |
| 139 // Everything looks valid, so try to resolve the proxy. | 140 // Everything looks valid, so try to resolve the proxy. |
| 140 net::ProxyInfo* proxy_info = new net::ProxyInfo; | 141 net::ProxyInfo* proxy_info = new net::ProxyInfo; |
| 141 net::ProxyService::PacRequest* pending_request = NULL; | 142 net::ProxyService::PacRequest* pending_request = NULL; |
| 142 base::Callback<void(int)> callback = | 143 base::Callback<void(int)> callback = |
| 143 base::Bind(&PepperNetworkProxyHost::OnResolveProxyCompleted, | 144 base::Bind(&PepperNetworkProxyHost::OnResolveProxyCompleted, |
| 144 weak_factory_.GetWeakPtr(), | 145 weak_factory_.GetWeakPtr(), |
| 145 request.reply_context, | 146 request.reply_context, |
| 146 base::Owned(proxy_info)); | 147 base::Owned(proxy_info)); |
| 147 int result = proxy_service_->ResolveProxy(request.url, | 148 int result = proxy_service_->ResolveProxy(request.url, |
| 149 net::LOAD_NORMAL, |
| 148 proxy_info, | 150 proxy_info, |
| 149 callback, | 151 callback, |
| 150 &pending_request, | 152 &pending_request, |
| 153 NULL, |
| 151 net::BoundNetLog()); | 154 net::BoundNetLog()); |
| 152 pending_requests_.push(pending_request); | 155 pending_requests_.push(pending_request); |
| 153 // If it was handled synchronously, we must run the callback now; | 156 // If it was handled synchronously, we must run the callback now; |
| 154 // proxy_service_ won't run it for us in this case. | 157 // proxy_service_ won't run it for us in this case. |
| 155 if (result != net::ERR_IO_PENDING) | 158 if (result != net::ERR_IO_PENDING) |
| 156 callback.Run(result); | 159 callback.Run(result); |
| 157 } | 160 } |
| 158 unsent_requests_.pop(); | 161 unsent_requests_.pop(); |
| 159 } | 162 } |
| 160 } | 163 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 179 | 182 |
| 180 void PepperNetworkProxyHost::SendFailureReply( | 183 void PepperNetworkProxyHost::SendFailureReply( |
| 181 int32_t error, | 184 int32_t error, |
| 182 ppapi::host::ReplyMessageContext context) { | 185 ppapi::host::ReplyMessageContext context) { |
| 183 context.params.set_result(error); | 186 context.params.set_result(error); |
| 184 host()->SendReply( | 187 host()->SendReply( |
| 185 context, PpapiPluginMsg_NetworkProxy_GetProxyForURLReply(std::string())); | 188 context, PpapiPluginMsg_NetworkProxy_GetProxyForURLReply(std::string())); |
| 186 } | 189 } |
| 187 | 190 |
| 188 } // namespace content | 191 } // namespace content |
| OLD | NEW |