Chromium Code Reviews| Index: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc |
| diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc |
| index 676cbf58a8200ea1b9b34a4c51b8592e2c29e4de..69a0c37cee28a8bfb8ac61284d84d83618294df8 100644 |
| --- a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc |
| +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc |
| @@ -31,10 +31,16 @@ namespace data_reduction_proxy { |
| const char kAndroidWebViewProtocolVersion[] = ""; |
| #endif |
| -// The clients supported by the data reduction proxy. |
| -const char kClientAndroidWebview[] = "webview"; |
| -const char kClientChromeAndroid[] = "android"; |
| -const char kClientChromeIOS[] = "ios"; |
| +#define CLIENT_ENUM(name, str_value) \ |
| + case name: return str_value; |
| +const char* GetString(Client client) { |
| + switch (client) { |
| + CLIENT_ENUMS_LIST |
| + } |
| + NOTREACHED(); |
| + return ""; |
| +} |
| +#undef CLIENT_ENUM |
| // static |
| bool DataReductionProxyAuthRequestHandler::IsKeySetOnCommandLine() { |
| @@ -44,10 +50,10 @@ bool DataReductionProxyAuthRequestHandler::IsKeySetOnCommandLine() { |
| } |
| DataReductionProxyAuthRequestHandler::DataReductionProxyAuthRequestHandler( |
| - const std::string& client, |
| + const Client client, |
| DataReductionProxyParams* params, |
| scoped_refptr<base::SingleThreadTaskRunner> network_task_runner) |
| - : client_(client), |
| + : client_(GetString(client)), |
| data_reduction_proxy_params_(params), |
| network_task_runner_(network_task_runner) { |
| GetChromiumBuildAndPatch(ChromiumVersion(), &build_number_, &patch_number_); |
| @@ -55,11 +61,11 @@ DataReductionProxyAuthRequestHandler::DataReductionProxyAuthRequestHandler( |
| } |
| DataReductionProxyAuthRequestHandler::DataReductionProxyAuthRequestHandler( |
| - const std::string& client, |
| + const Client client, |
|
bengr
2014/10/02 17:36:07
"const" isn't needed here.
Not at Google. Contact bengr
2014/10/02 18:07:44
Done.
|
| const std::string& version, |
| DataReductionProxyParams* params, |
| scoped_refptr<base::SingleThreadTaskRunner> network_task_runner) |
| - : client_(client), |
| + : client_(GetString(client)), |
| data_reduction_proxy_params_(params), |
| network_task_runner_(network_task_runner) { |
| GetChromiumBuildAndPatch(version, &build_number_, &patch_number_); |