summaryrefslogtreecommitdiffstats
path: root/cloud_print/gcp20/prototype/printer.cc
diff options
context:
space:
mode:
authormaksymb@chromium.org <maksymb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 13:47:28 +0000
committermaksymb@chromium.org <maksymb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 13:47:28 +0000
commitb05a032357bc917a4545777526c84c855d9c5d85 (patch)
treedcbfb44621c68d468a52550c31a5f7e3e0afe2fe /cloud_print/gcp20/prototype/printer.cc
parentae46ea6dde058da7b0d9ed5989404b67ccb47776 (diff)
downloadchromium_src-b05a032357bc917a4545777526c84c855d9c5d85.zip
chromium_src-b05a032357bc917a4545777526c84c855d9c5d85.tar.gz
chromium_src-b05a032357bc917a4545777526c84c855d9c5d85.tar.bz2
GCP2.0 Device: New parameters for command line: domain-name and service-name.
Moved default variables to Printer. BUG= Review URL: https://chromiumcodereview.appspot.com/20150004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213893 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print/gcp20/prototype/printer.cc')
-rw-r--r--cloud_print/gcp20/prototype/printer.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/cloud_print/gcp20/prototype/printer.cc b/cloud_print/gcp20/prototype/printer.cc
index 56bcad4..1dc1359 100644
--- a/cloud_print/gcp20/prototype/printer.cc
+++ b/cloud_print/gcp20/prototype/printer.cc
@@ -27,9 +27,12 @@ const base::FilePath::CharType kPrinterStatePath[] =
namespace {
+const uint16 kHttpPortDefault = 10101;
+const uint32 kTtlDefault = 60*60;
+
const char kServiceType[] = "_privet._tcp.local";
-const char kServiceNamePrefix[] = "first_gcp20_device";
-const char kServiceDomainName[] = "my-privet-device.local";
+const char kServiceNamePrefixDefault[] = "first_gcp20_device";
+const char kServiceDomainNameDefault[] = "my-privet-device.local";
const char kPrinterName[] = "Google GCP2.0 Prototype";
const char kPrinterDescription[] = "Printer emulator";
@@ -126,7 +129,7 @@ bool Printer::Start() {
}
VLOG(1) << "Local address: " << net::IPAddressToString(ip);
- uint16 port = command_line_reader::ReadHttpPort();
+ uint16 port = command_line_reader::ReadHttpPort(kHttpPortDefault);
// Starting HTTP server.
if (!http_server_.Start(port))
@@ -136,10 +139,14 @@ bool Printer::Start() {
reg_info_ = RegistrationInfo();
// Starting DNS-SD server.
+ std::string service_name_prefix =
+ command_line_reader::ReadServiceNamePrefix(kServiceNamePrefixDefault);
+ std::string service_domain_name =
+ command_line_reader::ReadDomainName(kServiceDomainNameDefault);
if (!dns_server_.Start(
- ServiceParameters(kServiceType, kServiceNamePrefix, kServiceDomainName,
+ ServiceParameters(kServiceType, service_name_prefix, service_domain_name,
ip, port),
- command_line_reader::ReadTtl(),
+ command_line_reader::ReadTtl(kTtlDefault),
CreateTxt())) {
http_server_.Shutdown();
return false;