| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_content_browser_client.h" | 10 #include "android_webview/browser/aw_content_browser_client.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 using content::BrowserThread; | 45 using content::BrowserThread; |
| 46 using data_reduction_proxy::DataReductionProxySettings; | 46 using data_reduction_proxy::DataReductionProxySettings; |
| 47 | 47 |
| 48 namespace android_webview { | 48 namespace android_webview { |
| 49 | 49 |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 void ApplyCmdlineOverridesToURLRequestContextBuilder( | 53 void ApplyCmdlineOverridesToURLRequestContextBuilder( |
| 54 net::URLRequestContextBuilder* builder) { | 54 net::URLRequestContextBuilder* builder) { |
| 55 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 55 const base::CommandLine& command_line = |
| 56 *base::CommandLine::ForCurrentProcess(); |
| 56 if (command_line.HasSwitch(switches::kHostResolverRules)) { | 57 if (command_line.HasSwitch(switches::kHostResolverRules)) { |
| 57 // If hostname remappings were specified on the command-line, layer these | 58 // If hostname remappings were specified on the command-line, layer these |
| 58 // rules on top of the real host resolver. This allows forwarding all | 59 // rules on top of the real host resolver. This allows forwarding all |
| 59 // requests through a designated test server. | 60 // requests through a designated test server. |
| 60 scoped_ptr<net::MappedHostResolver> host_resolver( | 61 scoped_ptr<net::MappedHostResolver> host_resolver( |
| 61 new net::MappedHostResolver( | 62 new net::MappedHostResolver( |
| 62 net::HostResolver::CreateDefaultResolver(NULL))); | 63 net::HostResolver::CreateDefaultResolver(NULL))); |
| 63 host_resolver->SetRulesFromString( | 64 host_resolver->SetRulesFromString( |
| 64 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); | 65 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); |
| 65 builder->set_host_resolver(host_resolver.release()); | 66 builder->set_host_resolver(host_resolver.release()); |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 | 69 |
| 69 void ApplyCmdlineOverridesToNetworkSessionParams( | 70 void ApplyCmdlineOverridesToNetworkSessionParams( |
| 70 net::HttpNetworkSession::Params* params) { | 71 net::HttpNetworkSession::Params* params) { |
| 71 int value; | 72 int value; |
| 72 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 73 const base::CommandLine& command_line = |
| 74 *base::CommandLine::ForCurrentProcess(); |
| 73 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { | 75 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { |
| 74 base::StringToInt(command_line.GetSwitchValueASCII( | 76 base::StringToInt(command_line.GetSwitchValueASCII( |
| 75 switches::kTestingFixedHttpPort), &value); | 77 switches::kTestingFixedHttpPort), &value); |
| 76 params->testing_fixed_http_port = value; | 78 params->testing_fixed_http_port = value; |
| 77 } | 79 } |
| 78 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { | 80 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { |
| 79 base::StringToInt(command_line.GetSwitchValueASCII( | 81 base::StringToInt(command_line.GetSwitchValueASCII( |
| 80 switches::kTestingFixedHttpsPort), &value); | 82 switches::kTestingFixedHttpsPort), &value); |
| 81 params->testing_fixed_https_port = value; | 83 params->testing_fixed_https_port = value; |
| 82 } | 84 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 net::NetLog* AwURLRequestContextGetter::GetNetLog() { | 284 net::NetLog* AwURLRequestContextGetter::GetNetLog() { |
| 283 return net_log_.get(); | 285 return net_log_.get(); |
| 284 } | 286 } |
| 285 | 287 |
| 286 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { | 288 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { |
| 287 DCHECK(data_reduction_proxy_auth_request_handler_); | 289 DCHECK(data_reduction_proxy_auth_request_handler_); |
| 288 data_reduction_proxy_auth_request_handler_->InitAuthentication(key); | 290 data_reduction_proxy_auth_request_handler_->InitAuthentication(key); |
| 289 } | 291 } |
| 290 | 292 |
| 291 } // namespace android_webview | 293 } // namespace android_webview |
| OLD | NEW |