Skip to content

Commit

Permalink
Fixed serial number, service name and firmware version of GCP 2.0 pro…
Browse files Browse the repository at this point in the history
…totype.

Review URL: https://codereview.chromium.org/77343003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236434 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
vitalybuka@chromium.org committed Nov 21, 2013
1 parent af6be6e commit 3192bc9
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 58 deletions.
47 changes: 0 additions & 47 deletions cloud_print/cloud_print.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,8 @@
{
'variables': {
'chromium_code': 1,

'variables': {
'version_py_path': '../tools/build/version.py',
'version_path': 'VERSION',
},
'version_py_path': '<(version_py_path) -f',
'version_path': '<(version_path)',
},
'includes': [
'../chrome/version.gypi',
],
'targets': [
{
'target_name': 'cloud_print_version_resources',
'type': 'none',
'conditions': [
['branding == "Chrome"', {
'variables': {
'branding_path': '<(DEPTH)/chrome/app/theme/google_chrome/BRANDING',
},
}, { # else branding!="Chrome"
'variables': {
'branding_path': '<(DEPTH)/chrome/app/theme/chromium/BRANDING',
},
}],
],
'variables': {
'output_dir': 'cloud_print',
'template_input_path': '../chrome/app/chrome_version.rc.version',
'extra_variable_files_arguments': [ '-f', 'BRANDING' ],
'extra_variable_files': [ 'BRANDING' ], # NOTE: matches that above
},
'direct_dependent_settings': {
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/<(output_dir)',
],
},
'sources': [
'service/win/cloud_print_service_exe.ver',
'service/win/cloud_print_service_config_exe.ver',
'service/win/cloud_print_service_setup_exe.ver',
'virtual_driver/win/gcp_portmon64_dll.ver',
'virtual_driver/win/gcp_portmon_dll.ver',
'virtual_driver/win/install/virtual_driver_setup_exe.ver',
],
'includes': [
'../chrome/version_resource_rules.gypi',
],
},
{
'target_name': 'cloud_print',
'type': 'none',
Expand Down
109 changes: 109 additions & 0 deletions cloud_print/cloud_print_resources.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,

'variables': {
'version_py_path': '../tools/build/version.py',
'version_path': 'VERSION',
},
'version_py_path': '<(version_py_path) -f',
'version_path': '<(version_path)',
},
'includes': [
'../chrome/version.gypi',
],
'targets': [
{
'target_name': 'cloud_print_version_resources',
'type': 'none',
'conditions': [
['branding == "Chrome"', {
'variables': {
'branding_path': '<(DEPTH)/chrome/app/theme/google_chrome/BRANDING',
},
}, { # else branding!="Chrome"
'variables': {
'branding_path': '<(DEPTH)/chrome/app/theme/chromium/BRANDING',
},
}],
],
'variables': {
'output_dir': 'cloud_print',
'template_input_path': '../chrome/app/chrome_version.rc.version',
'extra_variable_files_arguments': [ '-f', 'BRANDING' ],
'extra_variable_files': [ 'BRANDING' ], # NOTE: matches that above
},
'direct_dependent_settings': {
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/<(output_dir)',
],
},
'sources': [
'service/win/cloud_print_service_exe.ver',
'service/win/cloud_print_service_config_exe.ver',
'service/win/cloud_print_service_setup_exe.ver',
'virtual_driver/win/gcp_portmon64_dll.ver',
'virtual_driver/win/gcp_portmon_dll.ver',
'virtual_driver/win/install/virtual_driver_setup_exe.ver',
],
'includes': [
'../chrome/version_resource_rules.gypi',
],
},
{
'target_name': 'cloud_print_version_header',
'type': 'none',
'conditions': [
['branding == "Chrome"', {
'variables': {
'branding_path': '<(DEPTH)/chrome/app/theme/google_chrome/BRANDING',
},
}, { # else branding!="Chrome"
'variables': {
'branding_path': '<(DEPTH)/chrome/app/theme/chromium/BRANDING',
},
}],
],
'hard_dependency': 1,
'actions': [
{
'action_name': 'version_header',
'variables': {
'output_dir': 'cloud_print',
'lastchange_path':
'<(DEPTH)/build/util/LASTCHANGE',
},
'direct_dependent_settings': {
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/<(output_dir)',
],
},
'inputs': [
'<(version_path)',
'<(branding_path)',
'<(lastchange_path)',
'<(DEPTH)/chrome/version.h.in',
'BRANDING',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/<(output_dir)/version.h',
],
'action': [
'python',
'<(version_py_path)',
'-f', '<(version_path)',
'-f', '<(branding_path)',
'-f', '<(lastchange_path)',
'-f', 'BRANDING',
'<(DEPTH)/chrome/version.h.in',
'<@(_outputs)',
],
'message': 'Generating version header file: <@(_outputs)',
},
],
},
],
}
1 change: 1 addition & 0 deletions cloud_print/gcp20/prototype/gcp20_device.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'<(DEPTH)/cloud_print/cloud_print_resources.gyp:cloud_print_version_header',
'<(DEPTH)/google_apis/google_apis.gyp:google_apis',
'<(DEPTH)/jingle/jingle.gyp:notifier',
'<(DEPTH)/net/net.gyp:http_server',
Expand Down
25 changes: 17 additions & 8 deletions cloud_print/gcp20/prototype/printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "cloud_print/gcp20/prototype/local_settings.h"
#include "cloud_print/gcp20/prototype/service_parameters.h"
#include "cloud_print/gcp20/prototype/special_io.h"
#include "cloud_print/version.h"
#include "net/base/net_util.h"
#include "net/base/url_util.h"

Expand Down Expand Up @@ -127,6 +128,14 @@ net::IPAddressNumber GetLocalIp(const std::string& interface_name,
return net::IPAddressNumber();
}

std::string GetDescription() {
std::string result = kPrinterDescription;
net::IPAddressNumber ip = GetLocalIp("", false);
if (!ip.empty())
result += " at " + net::IPAddressToString(ip);
return result;
}

scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() {
return base::MessageLoop::current()->message_loop_proxy();
}
Expand Down Expand Up @@ -323,19 +332,18 @@ void Printer::CreateInfo(PrivetHttpServer::DeviceInfo* info) {
CheckRegistrationExpiration();

// TODO(maksymb): Replace "text" with constants.

*info = PrivetHttpServer::DeviceInfo();
info->version = "1.0";
info->name = kPrinterName;
info->description = kPrinterDescription;
info->description = GetDescription();
info->url = kCloudPrintUrl;
info->id = state_.device_id;
info->device_state = "idle";
info->connection_state = ConnectionStateToString(connection_state_);
info->manufacturer = "Google";
info->model = "Prototype";
info->serial_number = "2.3.5.7.13.17.19.31.61.89.107.127.521.607.1279.2203";
info->firmware = "3.7.31.127.8191.131071.524287.2147483647";
info->manufacturer = COMPANY_FULLNAME_STRING;
info->model = "Prototype r" + std::string(LASTCHANGE_STRING);
info->serial_number = "20CB5FF2-B28C-4EFA-8DCD-516CFF0455A2";
info->firmware = CHROME_VERSION_STRING;
info->uptime = static_cast<int>((base::Time::Now() - starttime_).InSeconds());

info->x_privet_token = xtoken_.GenerateXToken();
Expand Down Expand Up @@ -729,7 +737,7 @@ std::vector<std::string> Printer::CreateTxt() const {
std::vector<std::string> txt;
txt.push_back("txtvers=1");
txt.push_back("ty=" + std::string(kPrinterName));
txt.push_back("note=" + std::string(kPrinterDescription));
txt.push_back("note=" + std::string(GetDescription()));
txt.push_back("url=" + std::string(kCloudPrintUrl));
txt.push_back("type=printer");
txt.push_back("id=" + state_.device_id);
Expand Down Expand Up @@ -822,7 +830,8 @@ bool Printer::StartDnsServer() {
uint16 port = command_line_reader::ReadHttpPort(kHttpPortDefault);

std::string service_name_prefix =
command_line_reader::ReadServiceNamePrefix(kServiceNamePrefixDefault);
command_line_reader::ReadServiceNamePrefix(net::IPAddressToString(ip) +
kServiceNamePrefixDefault);
std::string service_domain_name =
command_line_reader::ReadDomainName(kServiceDomainNameDefault);

Expand Down
2 changes: 1 addition & 1 deletion cloud_print/service/win/resources/setup_dialog.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include "grit\\generated_resources.h"

#define APSTUDIO_READONLY_SYMBOLS
#include "cloud_print/version.h"
#include "winres.h"
#include "verrsrc.h"
#include "version.h"
#undef APSTUDIO_READONLY_SYMBOLS

#ifdef APSTUDIO_INVOKED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'../virtual_driver.gyp:virtual_driver_lib',
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/cloud_print/common/common.gyp:cloud_print_install_lib',
'<(DEPTH)/cloud_print/cloud_print.gyp:cloud_print_version_resources',
'<(DEPTH)/cloud_print/cloud_print_resources.gyp:cloud_print_version_resources',
'virtual_driver_setup_resources',
],
'sources': [
Expand Down
2 changes: 1 addition & 1 deletion cloud_print/virtual_driver/win/virtual_driver.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
'dependencies': [
'gcp_portmon_lib<(virtual_driver_suffix)',
'<(DEPTH)/chrome/chrome.gyp:chrome_version_header',
'<(DEPTH)/cloud_print/cloud_print.gyp:cloud_print_version_resources',
'<(DEPTH)/cloud_print/cloud_print_resources.gyp:cloud_print_version_resources',
],
'include_dirs': [
# To allow including "version.h"
Expand Down

0 comments on commit 3192bc9

Please sign in to comment.