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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 auth_android_negotiate_account_type_.MoveToThread(io_thread_proxy); | 193 auth_android_negotiate_account_type_.MoveToThread(io_thread_proxy); |
194 } | 194 } |
195 | 195 |
196 AwURLRequestContextGetter::~AwURLRequestContextGetter() { | 196 AwURLRequestContextGetter::~AwURLRequestContextGetter() { |
197 } | 197 } |
198 | 198 |
199 void AwURLRequestContextGetter::InitializeURLRequestContext() { | 199 void AwURLRequestContextGetter::InitializeURLRequestContext() { |
200 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 200 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
201 DCHECK(!url_request_context_); | 201 DCHECK(!url_request_context_); |
202 | 202 |
203 cookie_store_ = new AwCookieStoreWrapper(); | |
204 | |
205 net::URLRequestContextBuilder builder; | 203 net::URLRequestContextBuilder builder; |
206 scoped_ptr<AwNetworkDelegate> aw_network_delegate(new AwNetworkDelegate()); | 204 scoped_ptr<AwNetworkDelegate> aw_network_delegate(new AwNetworkDelegate()); |
207 | 205 |
208 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); | 206 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); |
209 DCHECK(browser_context); | 207 DCHECK(browser_context); |
210 | 208 |
211 builder.set_network_delegate( | 209 builder.set_network_delegate( |
212 browser_context->GetDataReductionProxyIOData()->CreateNetworkDelegate( | 210 browser_context->GetDataReductionProxyIOData()->CreateNetworkDelegate( |
213 std::move(aw_network_delegate), | 211 std::move(aw_network_delegate), |
214 false /* No UMA is produced to track bypasses. */)); | 212 false /* No UMA is produced to track bypasses. */)); |
(...skipping 15 matching lines...) Expand all Loading... |
230 new net::DefaultChannelIDStore(channel_id_db.get()), | 228 new net::DefaultChannelIDStore(channel_id_db.get()), |
231 base::WorkerPool::GetTaskRunner(true))); | 229 base::WorkerPool::GetTaskRunner(true))); |
232 } | 230 } |
233 | 231 |
234 // Android provides a local HTTP proxy that handles all the proxying. | 232 // Android provides a local HTTP proxy that handles all the proxying. |
235 // Create the proxy without a resolver since we rely on this local HTTP proxy. | 233 // Create the proxy without a resolver since we rely on this local HTTP proxy. |
236 // TODO(sgurun) is this behavior guaranteed through SDK? | 234 // TODO(sgurun) is this behavior guaranteed through SDK? |
237 builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( | 235 builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( |
238 std::move(proxy_config_service_), net_log_.get())); | 236 std::move(proxy_config_service_), net_log_.get())); |
239 builder.set_net_log(net_log_.get()); | 237 builder.set_net_log(net_log_.get()); |
240 builder.SetCookieAndChannelIdStores(cookie_store_, | 238 builder.SetCookieAndChannelIdStores( |
241 std::move(channel_id_service)); | 239 make_scoped_ptr(new AwCookieStoreWrapper()), |
| 240 std::move(channel_id_service)); |
242 | 241 |
243 net::URLRequestContextBuilder::HttpCacheParams cache_params; | 242 net::URLRequestContextBuilder::HttpCacheParams cache_params; |
244 cache_params.type = | 243 cache_params.type = |
245 net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; | 244 net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; |
246 cache_params.max_size = 20 * 1024 * 1024; // 20M | 245 cache_params.max_size = 20 * 1024 * 1024; // 20M |
247 cache_params.path = cache_path_; | 246 cache_params.path = cache_path_; |
248 builder.EnableHttpCache(cache_params); | 247 builder.EnableHttpCache(cache_params); |
249 builder.SetFileTaskRunner( | 248 builder.SetFileTaskRunner( |
250 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 249 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
251 | 250 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 http_auth_preferences_->set_server_whitelist( | 325 http_auth_preferences_->set_server_whitelist( |
327 auth_server_whitelist_.GetValue()); | 326 auth_server_whitelist_.GetValue()); |
328 } | 327 } |
329 | 328 |
330 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { | 329 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { |
331 http_auth_preferences_->set_auth_android_negotiate_account_type( | 330 http_auth_preferences_->set_auth_android_negotiate_account_type( |
332 auth_android_negotiate_account_type_.GetValue()); | 331 auth_android_negotiate_account_type_.GetValue()); |
333 } | 332 } |
334 | 333 |
335 } // namespace android_webview | 334 } // namespace android_webview |
OLD | NEW |