Display different icons for different device types.

BUG=372423

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269965 0039d316-1c4b-4281-b951-d872f2087c98
parent 2960adfd
......@@ -183,6 +183,7 @@
<include name="IDR_LOCAL_DISCOVERY_HTML" file="resources\local_discovery\local_discovery.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_LOCAL_DISCOVERY_CSS" file="resources\local_discovery\local_discovery.css" type="BINDATA" />
<include name="IDR_LOCAL_DISCOVERY_JS" file="resources\local_discovery\local_discovery.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_LOCAL_DISCOVERY_DEVICE_PNG" file="resources\local_discovery\device.png" type="BINDATA" />
<include name="IDR_LOCAL_DISCOVERY_PRINTER_PNG" file="resources\local_discovery\printer.png" type="BINDATA" />
</if>
......
......@@ -20,6 +20,7 @@ header {
}
.device {
background: url(device.png) no-repeat;
margin: 23px 0;
max-width: 695px;
overflow: hidden;
......
......@@ -100,6 +100,7 @@ cr.define('local_discovery', function() {
this.domElement,
this.info.human_readable_name,
this.info.description,
this.info.type,
loadTimeData.getString('serviceRegister'),
this.showRegister.bind(this));
......@@ -183,17 +184,20 @@ cr.define('local_discovery', function() {
* @param {HTMLElement} device_dom_element Element to be filled.
* @param {string} name Name of device.
* @param {string} description Description of device.
* @param {string} type Type of device.
* @param {string} button_text Text to appear on button.
* @param {function()} button_action Action for button.
* @return {HTMLElement} The button (for enabling/disabling/rebinding)
*/
function fillDeviceDescription(device_dom_element,
name,
description,
button_text,
button_action) {
name,
description,
type,
button_text,
button_action) {
device_dom_element.classList.add('device');
device_dom_element.classList.add('printer');
if (type == 'printer')
device_dom_element.classList.add('printer');
var deviceInfo = document.createElement('div');
deviceInfo.className = 'device-info';
......@@ -325,13 +329,13 @@ cr.define('local_discovery', function() {
var description;
if (device.description == '') {
description = loadTimeData.getString('noDescription');
} else {
description = device.description;
}
description = loadTimeData.getString('noDescription');
} else {
description = device.description;
}
fillDeviceDescription(devicesDomElement, device.display_name,
description, 'Manage' /*Localize*/,
description, device.type, 'Manage' /*Localize*/,
manageCloudDevice.bind(null, device.id));
return devicesDomElement;
}
......
......@@ -23,6 +23,7 @@ content::WebUIDataSource* CreateLocalDiscoveryHTMLSource() {
source->SetDefaultResource(IDR_LOCAL_DISCOVERY_HTML);
source->AddResourcePath("local_discovery.css", IDR_LOCAL_DISCOVERY_CSS);
source->AddResourcePath("local_discovery.js", IDR_LOCAL_DISCOVERY_JS);
source->AddResourcePath("device.png", IDR_LOCAL_DISCOVERY_DEVICE_PNG);
source->AddResourcePath("printer.png", IDR_LOCAL_DISCOVERY_PRINTER_PNG);
source->SetUseJsonJSFormatV2();
......
......@@ -356,6 +356,7 @@ void LocalDiscoveryUIHandler::DeviceChanged(
info.SetString("service_name", name);
info.SetString("human_readable_name", description.name);
info.SetString("description", description.description);
info.SetString("type", description.type);
web_ui()->CallJavascriptFunction(
"local_discovery.onUnregisteredDeviceUpdate",
......@@ -481,6 +482,7 @@ scoped_ptr<base::DictionaryValue> LocalDiscoveryUIHandler::CreatePrinterInfo(
return_value->SetString("id", description.id);
return_value->SetString("display_name", description.display_name);
return_value->SetString("description", description.description);
return_value->SetString("type", "printer");
return return_value.Pass();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment