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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 BrowserThread::GetBlockingPool()->GetSequenceToken())); | 221 BrowserThread::GetBlockingPool()->GetSequenceToken())); |
222 | 222 |
223 channel_id_service.reset(new net::ChannelIDService( | 223 channel_id_service.reset(new net::ChannelIDService( |
224 new net::DefaultChannelIDStore(channel_id_db.get()), | 224 new net::DefaultChannelIDStore(channel_id_db.get()), |
225 base::WorkerPool::GetTaskRunner(true))); | 225 base::WorkerPool::GetTaskRunner(true))); |
226 } | 226 } |
227 | 227 |
228 // Android provides a local HTTP proxy that handles all the proxying. | 228 // Android provides a local HTTP proxy that handles all the proxying. |
229 // Create the proxy without a resolver since we rely on this local HTTP proxy. | 229 // Create the proxy without a resolver since we rely on this local HTTP proxy. |
230 // TODO(sgurun) is this behavior guaranteed through SDK? | 230 // TODO(sgurun) is this behavior guaranteed through SDK? |
231 builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( | 231 |
232 std::move(proxy_config_service_), net_log_.get())); | 232 const base::CommandLine& command_line = |
| 233 *base::CommandLine::ForCurrentProcess(); |
| 234 if (command_line.HasSwitch(switches::kProxyServer)) { |
| 235 std::string proxy = |
| 236 command_line.GetSwitchValueASCII(switches::kProxyServer); |
| 237 builder.set_proxy_service(net::ProxyService::CreateFixed(proxy)); |
| 238 } else { |
| 239 builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( |
| 240 std::move(proxy_config_service_), net_log_.get())); |
| 241 } |
233 builder.set_net_log(net_log_.get()); | 242 builder.set_net_log(net_log_.get()); |
234 builder.SetCookieAndChannelIdStores(base::MakeUnique<AwCookieStoreWrapper>(), | 243 builder.SetCookieAndChannelIdStores(base::MakeUnique<AwCookieStoreWrapper>(), |
235 std::move(channel_id_service)); | 244 std::move(channel_id_service)); |
236 | 245 |
237 net::URLRequestContextBuilder::HttpCacheParams cache_params; | 246 net::URLRequestContextBuilder::HttpCacheParams cache_params; |
238 cache_params.type = | 247 cache_params.type = |
239 net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; | 248 net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; |
240 cache_params.max_size = 20 * 1024 * 1024; // 20M | 249 cache_params.max_size = 20 * 1024 * 1024; // 20M |
241 cache_params.path = cache_path_; | 250 cache_params.path = cache_path_; |
242 builder.EnableHttpCache(cache_params); | 251 builder.EnableHttpCache(cache_params); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 http_auth_preferences_->set_server_whitelist( | 321 http_auth_preferences_->set_server_whitelist( |
313 auth_server_whitelist_.GetValue()); | 322 auth_server_whitelist_.GetValue()); |
314 } | 323 } |
315 | 324 |
316 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { | 325 void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { |
317 http_auth_preferences_->set_auth_android_negotiate_account_type( | 326 http_auth_preferences_->set_auth_android_negotiate_account_type( |
318 auth_android_negotiate_account_type_.GetValue()); | 327 auth_android_negotiate_account_type_.GetValue()); |
319 } | 328 } |
320 | 329 |
321 } // namespace android_webview | 330 } // namespace android_webview |
OLD | NEW |