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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" | 12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" |
13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" | 13 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" |
14 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" | 14 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
15 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h " | 15 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h " |
16 #include "crypto/random.h" | 16 #include "crypto/random.h" |
17 #include "net/proxy/proxy_server.h" | 17 #include "net/proxy/proxy_server.h" |
18 #include "net/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
20 | 20 |
21 namespace data_reduction_proxy { | 21 namespace data_reduction_proxy { |
22 | 22 |
23 // The version of the authentication protocol. | |
24 const char kProtocolVersion[] = "0"; | |
25 | |
26 // The clients supported by the data reduction proxy. | 23 // The clients supported by the data reduction proxy. |
27 const char kClientAndroidWebview[] = "webview"; | 24 const char kClientAndroidWebview[] = "webview"; |
28 const char kClientChromeAndroid[] = "android"; | 25 const char kClientChromeAndroid[] = "android"; |
29 const char kClientChromeIOS[] = "ios"; | 26 const char kClientChromeIOS[] = "ios"; |
30 | 27 |
31 // static | 28 // static |
32 bool DataReductionProxyAuthRequestHandler::IsKeySetOnCommandLine() { | 29 bool DataReductionProxyAuthRequestHandler::IsKeySetOnCommandLine() { |
33 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 30 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
34 return command_line.HasSwitch( | 31 return command_line.HasSwitch( |
35 data_reduction_proxy::switches::kDataReductionProxyKey); | 32 data_reduction_proxy::switches::kDataReductionProxyKey); |
36 } | 33 } |
37 | 34 |
38 DataReductionProxyAuthRequestHandler::DataReductionProxyAuthRequestHandler( | 35 DataReductionProxyAuthRequestHandler::DataReductionProxyAuthRequestHandler( |
39 DataReductionProxyParams* params) | 36 DataReductionProxyParams* params, const std::string& version) |
bengr
2014/07/31 18:22:40
This won't work with android webview.
Also, I don
megjablon
2014/07/31 20:48:36
Done.
| |
40 : data_reduction_proxy_params_(params) { | 37 : data_reduction_proxy_params_(params) { |
41 version_ = kProtocolVersion; | 38 version_ = version; |
42 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
43 client_ = kClientChromeAndroid; | 40 client_ = kClientChromeAndroid; |
44 #elif defined(OS_IOS) | 41 #elif defined(OS_IOS) |
45 client_ = kClientChromeIOS; | 42 client_ = kClientChromeIOS; |
46 #endif | 43 #endif |
47 Init(); | 44 Init(); |
48 } | 45 } |
49 | 46 |
50 void DataReductionProxyAuthRequestHandler::Init() { | 47 void DataReductionProxyAuthRequestHandler::Init() { |
51 InitAuthentication(GetDefaultKey()); | 48 InitAuthentication(GetDefaultKey()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 std::string key = | 138 std::string key = |
142 command_line.GetSwitchValueASCII(switches::kDataReductionProxyKey); | 139 command_line.GetSwitchValueASCII(switches::kDataReductionProxyKey); |
143 #if defined(SPDY_PROXY_AUTH_VALUE) | 140 #if defined(SPDY_PROXY_AUTH_VALUE) |
144 if (key.empty()) | 141 if (key.empty()) |
145 key = SPDY_PROXY_AUTH_VALUE; | 142 key = SPDY_PROXY_AUTH_VALUE; |
146 #endif | 143 #endif |
147 return key; | 144 return key; |
148 } | 145 } |
149 | 146 |
150 } // namespace data_reduction_proxy | 147 } // namespace data_reduction_proxy |
OLD | NEW |