Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / cloud_print / gcp20 / prototype / command_line_reader.cc
index 2d9b51e..ecab579 100644 (file)
@@ -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;