| 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_url_request_context_getter.h" | 5 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 content::kChromeDevToolsScheme, | 129 content::kChromeDevToolsScheme, |
| 130 base::WrapUnique( | 130 base::WrapUnique( |
| 131 (*protocol_handlers)[content::kChromeDevToolsScheme].release())); | 131 (*protocol_handlers)[content::kChromeDevToolsScheme].release())); |
| 132 DCHECK(set_protocol); | 132 DCHECK(set_protocol); |
| 133 protocol_handlers->clear(); | 133 protocol_handlers->clear(); |
| 134 | 134 |
| 135 // Note that even though the content:// scheme handler is created here, | 135 // Note that even though the content:// scheme handler is created here, |
| 136 // it cannot be used by child processes until access to it is granted via | 136 // it cannot be used by child processes until access to it is granted via |
| 137 // ChildProcessSecurityPolicy::GrantScheme(). This is done in | 137 // ChildProcessSecurityPolicy::GrantScheme(). This is done in |
| 138 // AwContentBrowserClient. | 138 // AwContentBrowserClient. |
| 139 request_interceptors.push_back( | 139 request_interceptors.push_back(CreateAndroidContentRequestInterceptor()); |
| 140 CreateAndroidContentRequestInterceptor().release()); | 140 request_interceptors.push_back(CreateAndroidAssetFileRequestInterceptor()); |
| 141 request_interceptors.push_back( | |
| 142 CreateAndroidAssetFileRequestInterceptor().release()); | |
| 143 // The AwRequestInterceptor must come after the content and asset file job | 141 // The AwRequestInterceptor must come after the content and asset file job |
| 144 // factories. This for WebViewClassic compatibility where it was not | 142 // factories. This for WebViewClassic compatibility where it was not |
| 145 // possible to intercept resource loads to resolvable content:// and | 143 // possible to intercept resource loads to resolvable content:// and |
| 146 // file:// URIs. | 144 // file:// URIs. |
| 147 // This logical dependency is also the reason why the Content | 145 // This logical dependency is also the reason why the Content |
| 148 // URLRequestInterceptor has to be added as an interceptor rather than as a | 146 // URLRequestInterceptor has to be added as an interceptor rather than as a |
| 149 // ProtocolHandler. | 147 // ProtocolHandler. |
| 150 request_interceptors.push_back(new AwRequestInterceptor()); | 148 request_interceptors.push_back(base::MakeUnique<AwRequestInterceptor>()); |
| 151 | 149 |
| 152 // The chain of responsibility will execute the handlers in reverse to the | 150 // The chain of responsibility will execute the handlers in reverse to the |
| 153 // order in which the elements of the chain are created. | 151 // order in which the elements of the chain are created. |
| 154 std::unique_ptr<net::URLRequestJobFactory> job_factory( | 152 std::unique_ptr<net::URLRequestJobFactory> job_factory( |
| 155 std::move(aw_job_factory)); | 153 std::move(aw_job_factory)); |
| 156 for (content::URLRequestInterceptorScopedVector::reverse_iterator i = | 154 for (auto i = request_interceptors.rbegin(); i != request_interceptors.rend(); |
| 157 request_interceptors.rbegin(); | |
| 158 i != request_interceptors.rend(); | |
| 159 ++i) { | 155 ++i) { |
| 160 job_factory.reset(new net::URLRequestInterceptingJobFactory( | 156 job_factory.reset(new net::URLRequestInterceptingJobFactory( |
| 161 std::move(job_factory), base::WrapUnique(*i))); | 157 std::move(job_factory), std::move(*i))); |
| 162 } | 158 } |
| 163 request_interceptors.weak_clear(); | 159 request_interceptors.clear(); |
| 164 | 160 |
| 165 return job_factory; | 161 return job_factory; |
| 166 } | 162 } |
| 167 | 163 |
| 168 } // namespace | 164 } // namespace |
| 169 | 165 |
| 170 AwURLRequestContextGetter::AwURLRequestContextGetter( | 166 AwURLRequestContextGetter::AwURLRequestContextGetter( |
| 171 const base::FilePath& cache_path, | 167 const base::FilePath& cache_path, |
| 172 std::unique_ptr<net::ProxyConfigService> config_service, | 168 std::unique_ptr<net::ProxyConfigService> config_service, |
| 173 PrefService* user_pref_service) | 169 PrefService* user_pref_service) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 http_auth_preferences_->set_server_whitelist( | 318 http_auth_preferences_->set_server_whitelist( |
| 323 auth_server_whitelist_.GetValue()); | 319 auth_server_whitelist_.GetValue()); |
| 324 } | 320 } |
| 325 | 321 |
| 326 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { | 322 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { |
| 327 http_auth_preferences_->set_auth_android_negotiate_account_type( | 323 http_auth_preferences_->set_auth_android_negotiate_account_type( |
| 328 auth_android_negotiate_account_type_.GetValue()); | 324 auth_android_negotiate_account_type_.GetValue()); |
| 329 } | 325 } |
| 330 | 326 |
| 331 } // namespace android_webview | 327 } // namespace android_webview |
| OLD | NEW |