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