| 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_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
| 8 #include "android_webview/browser/aw_contents_client_bridge_base.h" | 8 #include "android_webview/browser/aw_contents_client_bridge_base.h" |
| 9 #include "android_webview/browser/aw_contents_io_thread_client.h" | 9 #include "android_webview/browser/aw_contents_io_thread_client.h" |
| 10 #include "android_webview/browser/aw_cookie_access_policy.h" | 10 #include "android_webview/browser/aw_cookie_access_policy.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 int AwNetworkDelegate::OnBeforeURLRequest( | 51 int AwNetworkDelegate::OnBeforeURLRequest( |
| 52 net::URLRequest* request, | 52 net::URLRequest* request, |
| 53 const net::CompletionCallback& callback, | 53 const net::CompletionCallback& callback, |
| 54 GURL* new_url) { | 54 GURL* new_url) { |
| 55 if (!url_blacklist_manager_) { | 55 if (!url_blacklist_manager_) { |
| 56 url_blacklist_manager_ = | 56 url_blacklist_manager_ = |
| 57 AwBrowserContext::GetDefault()->GetURLBlacklistManager(); | 57 AwBrowserContext::GetDefault()->GetURLBlacklistManager(); |
| 58 } | 58 } |
| 59 if (url_blacklist_manager_->IsURLBlocked(request->url())) | 59 // Ignore blob scheme for two reasons: |
| 60 // 1) PlzNavigate uses it to deliver the response to the renderer. |
| 61 // 2) A whitelisted page can use blob URLs internally. |
| 62 if (!request->url().SchemeIs(url::kBlobScheme) && |
| 63 url_blacklist_manager_->IsURLBlocked(request->url())) { |
| 60 return net::ERR_BLOCKED_BY_ADMINISTRATOR; | 64 return net::ERR_BLOCKED_BY_ADMINISTRATOR; |
| 65 } |
| 61 | 66 |
| 62 return net::OK; | 67 return net::OK; |
| 63 } | 68 } |
| 64 | 69 |
| 65 int AwNetworkDelegate::OnBeforeStartTransaction( | 70 int AwNetworkDelegate::OnBeforeStartTransaction( |
| 66 net::URLRequest* request, | 71 net::URLRequest* request, |
| 67 const net::CompletionCallback& callback, | 72 const net::CompletionCallback& callback, |
| 68 net::HttpRequestHeaders* headers) { | 73 net::HttpRequestHeaders* headers) { |
| 69 DCHECK(headers); | 74 DCHECK(headers); |
| 70 headers->SetHeaderIfMissing( | 75 headers->SetHeaderIfMissing( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 cookie_line, | 146 cookie_line, |
| 142 options); | 147 options); |
| 143 } | 148 } |
| 144 | 149 |
| 145 bool AwNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, | 150 bool AwNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, |
| 146 const base::FilePath& path) const { | 151 const base::FilePath& path) const { |
| 147 return true; | 152 return true; |
| 148 } | 153 } |
| 149 | 154 |
| 150 } // namespace android_webview | 155 } // namespace android_webview |
| OLD | NEW |