| Index: cloud_print/gcp20/prototype/command_line_reader.cc
|
| diff --git a/cloud_print/gcp20/prototype/command_line_reader.cc b/cloud_print/gcp20/prototype/command_line_reader.cc
|
| index 2d9b51ec1b6dc53142e4916441d5dabc8843e1a0..ecab5797d40589a89d5430dd787b26adbef386ae 100644
|
| --- a/cloud_print/gcp20/prototype/command_line_reader.cc
|
| +++ b/cloud_print/gcp20/prototype/command_line_reader.cc
|
| @@ -7,20 +7,16 @@
|
| #include "base/command_line.h"
|
| #include "base/logging.h"
|
| #include "base/strings/string_number_conversions.h"
|
| +#include "cloud_print/gcp20/prototype/gcp20_switches.h"
|
|
|
| namespace command_line_reader {
|
|
|
| -const char kHttpPortSwitch[] = "http-port";
|
| -const char kTtlSwitch[] = "ttl";
|
| -const char kServiceNameSwitch[] = "service-name";
|
| -const char kDomainNameSwitch[] = "domain-name";
|
| -const char kStatePathSwitch[] = "state-path";
|
| -
|
| uint16 ReadHttpPort(uint16 default_value) {
|
| uint32 http_port = 0;
|
|
|
| std::string http_port_string =
|
| - CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kHttpPortSwitch);
|
| + CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| + switches::kHttpPort);
|
|
|
| if (!base::StringToUint(http_port_string, &http_port))
|
| http_port = default_value;
|
| @@ -38,8 +34,8 @@ uint32 ReadTtl(uint32 default_value) {
|
| uint32 ttl = 0;
|
|
|
| if (!base::StringToUint(
|
| - CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kTtlSwitch),
|
| - &ttl)) {
|
| + CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kTtl),
|
| + &ttl)) {
|
| ttl = default_value;
|
| }
|
|
|
| @@ -49,14 +45,16 @@ uint32 ReadTtl(uint32 default_value) {
|
|
|
| std::string ReadServiceNamePrefix(const std::string& default_value) {
|
| std::string service_name =
|
| - CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kServiceNameSwitch);
|
| + CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| + switches::kServiceName);
|
|
|
| return service_name.empty() ? default_value : service_name;
|
| }
|
|
|
| std::string ReadDomainName(const std::string& default_value) {
|
| std::string domain_name =
|
| - CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kDomainNameSwitch);
|
| + CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| + switches::kDomainName);
|
|
|
| if (domain_name.empty())
|
| return default_value;
|
| @@ -77,8 +75,8 @@ std::string ReadDomainName(const std::string& default_value) {
|
| }
|
|
|
| std::string ReadStatePath(const std::string& default_value) {
|
| - std::string filename =
|
| - CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kStatePathSwitch);
|
| + std::string filename = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| + switches::kStatePath);
|
|
|
| if (filename.empty())
|
| return default_value;
|
|
|