| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
| 14 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" | 14 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" |
| 15 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 15 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
| 16 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" | 16 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
| 17 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" | 17 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h
" |
| 18 #include "components/data_reduction_proxy/common/version.h" |
| 18 #include "crypto/random.h" | 19 #include "crypto/random.h" |
| 19 #include "net/proxy/proxy_server.h" | 20 #include "net/proxy/proxy_server.h" |
| 20 #include "net/url_request/url_request.h" | 21 #include "net/url_request/url_request.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 22 | 23 |
| 23 namespace data_reduction_proxy { | 24 namespace data_reduction_proxy { |
| 24 | 25 |
| 25 // The empty version for the authentication protocol. Currently used by | 26 // The empty version for the authentication protocol. Currently used by |
| 26 // Android webview. | 27 // Android webview. |
| 27 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
| 28 const char kAndroidWebViewProtocolVersion[] = "0"; | 29 const char kAndroidWebViewProtocolVersion[] = "0"; |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 // The clients supported by the data reduction proxy. | 32 // The clients supported by the data reduction proxy. |
| 32 const char kClientAndroidWebview[] = "webview"; | 33 const char kClientAndroidWebview[] = "webview"; |
| 33 const char kClientChromeAndroid[] = "android"; | 34 const char kClientChromeAndroid[] = "android"; |
| 34 const char kClientChromeIOS[] = "ios"; | 35 const char kClientChromeIOS[] = "ios"; |
| 35 | 36 |
| 36 // static | 37 // static |
| 38 std::string DataReductionProxyAuthRequestHandler::ChromiumVersion() { |
| 39 #if defined(PRODUCT_VERSION) |
| 40 return PRODUCT_VERSION; |
| 41 #else |
| 42 return std::string(); |
| 43 #endif |
| 44 } |
| 45 |
| 46 // static |
| 37 bool DataReductionProxyAuthRequestHandler::IsKeySetOnCommandLine() { | 47 bool DataReductionProxyAuthRequestHandler::IsKeySetOnCommandLine() { |
| 38 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 48 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 39 return command_line.HasSwitch( | 49 return command_line.HasSwitch( |
| 40 data_reduction_proxy::switches::kDataReductionProxyKey); | 50 data_reduction_proxy::switches::kDataReductionProxyKey); |
| 41 } | 51 } |
| 42 | 52 |
| 43 DataReductionProxyAuthRequestHandler::DataReductionProxyAuthRequestHandler( | 53 DataReductionProxyAuthRequestHandler::DataReductionProxyAuthRequestHandler( |
| 44 const std::string& client, | 54 const std::string& client, |
| 45 const std::string& version, | 55 const std::string& version, |
| 46 DataReductionProxyParams* params, | 56 DataReductionProxyParams* params, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 std::string key = | 177 std::string key = |
| 168 command_line.GetSwitchValueASCII(switches::kDataReductionProxyKey); | 178 command_line.GetSwitchValueASCII(switches::kDataReductionProxyKey); |
| 169 #if defined(SPDY_PROXY_AUTH_VALUE) | 179 #if defined(SPDY_PROXY_AUTH_VALUE) |
| 170 if (key.empty()) | 180 if (key.empty()) |
| 171 key = SPDY_PROXY_AUTH_VALUE; | 181 key = SPDY_PROXY_AUTH_VALUE; |
| 172 #endif | 182 #endif |
| 173 return key; | 183 return key; |
| 174 } | 184 } |
| 175 | 185 |
| 176 } // namespace data_reduction_proxy | 186 } // namespace data_reduction_proxy |
| OLD | NEW |