summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 03:03:33 +0000
committerjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 03:03:33 +0000
commitea3e7cddf6684485248111eb8708309e0e9efc90 (patch)
tree5faa7891bbc345594763c560cfa17e009b4c76a2 /remoting
parentfcc001002706239b52108ea470855123c0daee63 (diff)
downloadchromium_src-ea3e7cddf6684485248111eb8708309e0e9efc90.zip
chromium_src-ea3e7cddf6684485248111eb8708309e0e9efc90.tar.gz
chromium_src-ea3e7cddf6684485248111eb8708309e0e9efc90.tar.bz2
Use classList in host_table_entry
BUG=None TEST=Manual Review URL: http://codereview.chromium.org/9610003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/remoting.gyp1
-rw-r--r--remoting/webapp/host_table_entry.js40
-rw-r--r--remoting/webapp/main.html1
-rw-r--r--remoting/webapp/remoting.js15
-rw-r--r--remoting/webapp/util.js56
5 files changed, 34 insertions, 79 deletions
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index 57658dd..73cdb40 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -140,7 +140,6 @@
'webapp/toolbar.css',
'webapp/toolbar.js',
'webapp/ui_mode.js',
- 'webapp/util.js',
'webapp/wcs.js',
'webapp/wcs_loader.js',
'webapp/xhr.js',
diff --git a/remoting/webapp/host_table_entry.js b/remoting/webapp/host_table_entry.js
index 8487027..27b722e 100644
--- a/remoting/webapp/host_table_entry.js
+++ b/remoting/webapp/host_table_entry.js
@@ -63,18 +63,18 @@ remoting.HostTableEntry.prototype.init = function(host, onRename, onDelete) {
/** @type {remoting.HostTableEntry} */
var that = this;
- this.tableRow = document.createElement('div');
- addClass(this.tableRow, 'section-row');
+ this.tableRow = /** @type {HTMLElement} */ document.createElement('div');
+ this.tableRow.classList.add('section-row');
// Create the host icon cell.
- var hostIcon = document.createElement('img');
+ var hostIcon = /** @type {HTMLElement} */ document.createElement('img');
hostIcon.src = 'icon_host.png';
- addClass(hostIcon, 'host-list-main-icon');
+ hostIcon.classList.add('host-list-main-icon');
this.tableRow.appendChild(hostIcon);
// Create the host name cell.
- this.hostNameCell_ = document.createElement('div');
- addClass(this.hostNameCell_, 'box-spacer');
+ this.hostNameCell_ = /** @type {HTMLElement} */ document.createElement('div');
+ this.hostNameCell_.classList.add('box-spacer');
this.setHostName_();
this.tableRow.appendChild(this.hostNameCell_);
@@ -85,33 +85,33 @@ remoting.HostTableEntry.prototype.init = function(host, onRename, onDelete) {
var startMe2Me = function() { window.location.replace(hostUrl); };
this.hostNameCell_.addEventListener('click', startMe2Me, false);
hostIcon.addEventListener('click', startMe2Me, false);
- addClass(this.tableRow, 'clickable');
- addClass(this.tableRow, 'host-online');
+ this.tableRow.classList.add('clickable');
+ this.tableRow.classList.add('host-online');
this.tableRow.title = chrome.i18n.getMessage(
/*i18n-content*/'TOOLTIP_CONNECT', host.hostName);
} else {
- addClass(this.tableRow, 'host-offline');
+ this.tableRow.classList.add('host-offline');
}
// Create the host rename cell.
- var editButton = document.createElement('img');
+ var editButton = /** @type {HTMLElement} */ document.createElement('img');
var beginRename = function() { that.beginRename_(); };
editButton.addEventListener('click', beginRename, true);
- addClass(editButton, 'clickable');
- addClass(editButton, 'host-list-edit');
+ editButton.classList.add('clickable');
+ editButton.classList.add('host-list-edit');
editButton.src = 'icon_pencil.png';
- addClass(editButton, 'host-list-rename-icon');
+ editButton.classList.add('host-list-rename-icon');
editButton.title = chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_RENAME');
this.tableRow.appendChild(editButton);
// Create the host delete cell.
- var deleteButton = document.createElement('div');
+ var deleteButton = /** @type {HTMLElement} */ document.createElement('div');
deleteButton.addEventListener('click', function() { onDelete(that); }, false);
- addClass(deleteButton, 'clickable');
- addClass(deleteButton, 'host-list-edit');
- var crossImage = document.createElement('img');
+ deleteButton.classList.add('clickable');
+ deleteButton.classList.add('host-list-edit');
+ var crossImage = /** @type {HTMLElement} */ document.createElement('img');
crossImage.src = 'icon_cross.png';
- addClass(crossImage, 'host-list-remove-icon');
+ crossImage.classList.add('host-list-remove-icon');
deleteButton.appendChild(crossImage);
deleteButton.title = chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_DELETE');
this.tableRow.appendChild(deleteButton);
@@ -173,14 +173,14 @@ remoting.HostTableEntry.prototype.removeEditBox_ = function() {
};
remoting.HostTableEntry.prototype.setHostName_ = function() {
- var hostNameNode = document.createElement('span');
+ var hostNameNode = /** @type {HTMLElement} */ document.createElement('span');
if (this.host.status == 'ONLINE') {
hostNameNode.innerText = this.host.hostName;
} else {
hostNameNode.innerText = chrome.i18n.getMessage(/*i18n-content*/'OFFLINE',
this.host.hostName);
}
- addClass(hostNameNode, 'host-list-label');
+ hostNameNode.classList.add('host-list-label');
this.hostNameCell_.appendChild(hostNameNode);
};
diff --git a/remoting/webapp/main.html b/remoting/webapp/main.html
index 764b3bc..b927491 100644
--- a/remoting/webapp/main.html
+++ b/remoting/webapp/main.html
@@ -38,7 +38,6 @@ found in the LICENSE file.
<script src="stats_accumulator.js"></script>
<script src="toolbar.js"></script>
<script src="ui_mode.js"></script>
- <script src="util.js"></script>
<script src="xhr.js"></script>
<script src="wcs.js"></script>
<script src="wcs_loader.js"></script>
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js
index c624b8dc..a8ca35e 100644
--- a/remoting/webapp/remoting.js
+++ b/remoting/webapp/remoting.js
@@ -54,7 +54,7 @@ remoting.init = function() {
window.addEventListener('blur', pluginLostFocus_, false);
// Parse URL parameters.
- var urlParams = getUrlParameters();
+ var urlParams = getUrlParameters_();
if ('mode' in urlParams) {
if (urlParams['mode'] == 'me2me') {
var hostId = urlParams['hostId'];
@@ -194,3 +194,16 @@ function isHostModeSupported_() {
// Currently, sharing on Chromebooks is not supported.
return !navigator.userAgent.match(/\bCrOS\b/);
}
+
+/**
+ * @return {Object.<string, string>} The URL parameters.
+ */
+function getUrlParameters_() {
+ var result = {};
+ var parts = window.location.search.substring(1).split('&');
+ for (var i = 0; i < parts.length; i++) {
+ var pair = parts[i].split('=');
+ result[pair[0]] = decodeURIComponent(pair[1]);
+ }
+ return result;
+}
diff --git a/remoting/webapp/util.js b/remoting/webapp/util.js
deleted file mode 100644
index c6eb201..0000000
--- a/remoting/webapp/util.js
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2012 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.
-
-/**
- * @fileoverview
- * Simple utility functions for Chromoting.
- */
-
-/**
- * TODO(garykac): Remove this once host_list.js and host_table_entry.js have
- * been updated to use classList directly.
- *
- * @param {Element} element The element to which to add the class.
- * @param {string} cls The new class.
- * @return {void} Nothing.
- */
-function addClass(element, cls) {
- var helem = /** @type {HTMLElement} */ element;
- helem.classList.add(cls);
-}
-
-/**
- * TODO(garykac): Remove this once host_list.js and host_table_entry.js have
- * been updated to use classList directly.
- *
- * @param {Element} element The element from which to remove the class.
- * @param {string} cls The new class.
- * @return {void} Nothing.
- */
-function removeClass(element, cls) {
- var helem = /** @type {HTMLElement} */ element;
- helem.classList.remove(cls);
-}
-
-/**
- * @return {Object.<string, string>} The URL parameters.
- */
-function getUrlParameters() {
- var result = {};
- var parts = window.location.search.substring(1).split('&');
- for (var i = 0; i < parts.length; i++) {
- var pair = parts[i].split('=');
- result[pair[0]] = decodeURIComponent(pair[1]);
- }
- return result;
-}
-
-// This function can be called from the Javascript console to show all the UI,
-// for example prior to auditing the CSS. It is not useful otherwise.
-function unhideAll() {
- var hidden = document.querySelectorAll('[hidden]');
- for (var i in hidden) {
- hidden[i].hidden = false;
- }
-}