OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/browser/net/aw_network_delegate.h" | 5 #include "android_webview/browser/net/aw_network_delegate.h" |
6 | 6 |
| 7 #include "android_webview/browser/aw_contents_io_thread_client.h" |
7 #include "android_webview/browser/aw_cookie_access_policy.h" | 8 #include "android_webview/browser/aw_cookie_access_policy.h" |
8 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/public/browser/resource_request_info.h" |
9 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
10 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 14 #include "net/http/http_response_headers.h" |
11 #include "net/proxy/proxy_info.h" | 15 #include "net/proxy/proxy_info.h" |
12 #include "net/proxy/proxy_server.h" | 16 #include "net/proxy/proxy_server.h" |
13 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
14 | 18 |
| 19 using content::BrowserThread; |
| 20 |
15 namespace android_webview { | 21 namespace android_webview { |
16 | 22 |
17 AwNetworkDelegate::AwNetworkDelegate() { | 23 AwNetworkDelegate::AwNetworkDelegate() { |
18 } | 24 } |
19 | 25 |
20 AwNetworkDelegate::~AwNetworkDelegate() { | 26 AwNetworkDelegate::~AwNetworkDelegate() { |
21 } | 27 } |
22 | 28 |
23 int AwNetworkDelegate::OnBeforeURLRequest( | 29 int AwNetworkDelegate::OnBeforeURLRequest( |
24 net::URLRequest* request, | 30 net::URLRequest* request, |
(...skipping 17 matching lines...) Expand all Loading... |
42 void AwNetworkDelegate::OnSendHeaders(net::URLRequest* request, | 48 void AwNetworkDelegate::OnSendHeaders(net::URLRequest* request, |
43 const net::HttpRequestHeaders& headers) { | 49 const net::HttpRequestHeaders& headers) { |
44 } | 50 } |
45 | 51 |
46 int AwNetworkDelegate::OnHeadersReceived( | 52 int AwNetworkDelegate::OnHeadersReceived( |
47 net::URLRequest* request, | 53 net::URLRequest* request, |
48 const net::CompletionCallback& callback, | 54 const net::CompletionCallback& callback, |
49 const net::HttpResponseHeaders* original_response_headers, | 55 const net::HttpResponseHeaders* original_response_headers, |
50 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, | 56 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
51 GURL* allowed_unsafe_redirect_url) { | 57 GURL* allowed_unsafe_redirect_url) { |
| 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 59 int render_process_id, render_frame_id; |
| 60 if (content::ResourceRequestInfo::GetRenderFrameForRequest( |
| 61 request, &render_process_id, &render_frame_id)) { |
| 62 scoped_ptr<AwContentsIoThreadClient> io_thread_client = |
| 63 AwContentsIoThreadClient::FromID(render_process_id, render_frame_id); |
| 64 if (io_thread_client.get()) { |
| 65 io_thread_client->OnHeadersReceived(request, original_response_headers); |
| 66 } |
| 67 } |
52 return net::OK; | 68 return net::OK; |
53 } | 69 } |
54 | 70 |
55 void AwNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, | 71 void AwNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, |
56 const GURL& new_location) { | 72 const GURL& new_location) { |
57 } | 73 } |
58 | 74 |
59 void AwNetworkDelegate::OnResponseStarted(net::URLRequest* request) { | 75 void AwNetworkDelegate::OnResponseStarted(net::URLRequest* request) { |
60 } | 76 } |
61 | 77 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 const base::FilePath& path) const { | 115 const base::FilePath& path) const { |
100 return true; | 116 return true; |
101 } | 117 } |
102 | 118 |
103 bool AwNetworkDelegate::OnCanThrottleRequest( | 119 bool AwNetworkDelegate::OnCanThrottleRequest( |
104 const net::URLRequest& request) const { | 120 const net::URLRequest& request) const { |
105 return false; | 121 return false; |
106 } | 122 } |
107 | 123 |
108 } // namespace android_webview | 124 } // namespace android_webview |
OLD | NEW |