diff options
author | vitalybuka <vitalybuka@chromium.org> | 2014-09-21 21:53:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-22 04:53:36 +0000 |
commit | 8e5841144fb76fa5f3d55f2a6f1e37f013fd661a (patch) | |
tree | 7898a7804d27e591322442e59a619480df7ef4c2 /cloud_print/gcp20/prototype/command_line_reader.cc | |
parent | b44e7c8f01adfe3cc7e62fcb8a087ff99e6efd5b (diff) | |
download | chromium_src-8e5841144fb76fa5f3d55f2a6f1e37f013fd661a.zip chromium_src-8e5841144fb76fa5f3d55f2a6f1e37f013fd661a.tar.gz chromium_src-8e5841144fb76fa5f3d55f2a6f1e37f013fd661a.tar.bz2 |
GCP 2.0 prototype switches code cleanup.
TBR=gene@chromium.org
Review URL: https://codereview.chromium.org/587103002
Cr-Commit-Position: refs/heads/master@{#295925}
Diffstat (limited to 'cloud_print/gcp20/prototype/command_line_reader.cc')
-rw-r--r-- | cloud_print/gcp20/prototype/command_line_reader.cc | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/cloud_print/gcp20/prototype/command_line_reader.cc b/cloud_print/gcp20/prototype/command_line_reader.cc index 2d9b51e..ecab579 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; |