summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
Diffstat (limited to 'remoting')
-rw-r--r--remoting/webapp/app_remoting/js/app_connected_view.js2
-rw-r--r--remoting/webapp/app_remoting/js/app_remoting_activity.js4
-rw-r--r--remoting/webapp/base/js/application.js11
-rw-r--r--remoting/webapp/base/js/base.js12
-rw-r--r--remoting/webapp/base/js/message_window.js18
-rw-r--r--remoting/webapp/base/js/modal_dialogs.js3
-rw-r--r--remoting/webapp/browser_test/timeout_waiter.js2
-rw-r--r--remoting/webapp/crd/js/crd_auth_dialog.js2
-rw-r--r--remoting/webapp/crd/js/crd_main.js24
-rw-r--r--remoting/webapp/crd/js/desktop_connected_view.js2
-rw-r--r--remoting/webapp/crd/js/desktop_remoting.js7
-rw-r--r--remoting/webapp/crd/js/desktop_remoting_activity.js2
-rw-r--r--remoting/webapp/crd/js/host_table_entry.js2
-rw-r--r--remoting/webapp/crd/js/it2me_activity.js4
-rw-r--r--remoting/webapp/crd/js/me2me_activity.js8
-rw-r--r--remoting/webapp/crd/js/third_party_host_permissions.js4
-rw-r--r--remoting/webapp/crd/js/xhr_proxy.js2
-rw-r--r--remoting/webapp/js_proto/dom_proto.js3
18 files changed, 64 insertions, 48 deletions
diff --git a/remoting/webapp/app_remoting/js/app_connected_view.js b/remoting/webapp/app_remoting/js/app_connected_view.js
index f3d05be..6918a1e 100644
--- a/remoting/webapp/app_remoting/js/app_connected_view.js
+++ b/remoting/webapp/app_remoting/js/app_connected_view.js
@@ -49,7 +49,7 @@ remoting.AppConnectedView = function(containerElement, windowShape,
// Initialize the context menus.
if (!remoting.platformIsChromeOS()) {
menuAdapter = new remoting.ContextMenuDom(
- document.getElementById('context-menu'), windowShape);
+ base.getHtmlElement('context-menu'), windowShape);
}
this.contextMenu_ = new remoting.ApplicationContextMenu(
diff --git a/remoting/webapp/app_remoting/js/app_remoting_activity.js b/remoting/webapp/app_remoting/js/app_remoting_activity.js
index b1930bad3..aff04df 100644
--- a/remoting/webapp/app_remoting/js/app_remoting_activity.js
+++ b/remoting/webapp/app_remoting/js/app_remoting_activity.js
@@ -180,11 +180,11 @@ remoting.AppRemotingActivity.prototype.onAppHostResponse_ =
*/
remoting.AppRemotingActivity.prototype.onConnected = function(connectionInfo) {
var connectedView = new remoting.AppConnectedView(
- document.getElementById('client-container'),
+ base.getHtmlElement('client-container'),
this.windowShape_, connectionInfo, this.windowMessageDispatcher_);
var idleDetector = new remoting.IdleDetector(
- document.getElementById('idle-dialog'),
+ base.getHtmlElement('idle-dialog'),
this.windowShape_,
this.app_.getApplicationName(),
this.stop.bind(this));
diff --git a/remoting/webapp/base/js/application.js b/remoting/webapp/base/js/application.js
index 8fac258..723e0a1 100644
--- a/remoting/webapp/base/js/application.js
+++ b/remoting/webapp/base/js/application.js
@@ -111,18 +111,25 @@ remoting.Application.prototype.getExtensionInfo = function() {
* These functions must be overridden in the subclass.
*/
-/** @return {string} */
+/**
+ * @return {string}
+ * @suppress {missingReturn}
+ */
remoting.Application.prototype.getApplicationId = function() {
console.assert(false, 'Subclass must override');
};
-/** @return {string} */
+/**
+ * @return {string}
+ * @suppress {missingReturn}
+ */
remoting.Application.prototype.getApplicationName = function() {
console.assert(false, 'Subclass must override getApplicationName().');
};
/**
* @return {remoting.Activity} The Current activity.
+ * @suppress {missingReturn}
*/
remoting.Application.prototype.getActivity = function() {
console.assert(false, 'Subclass must override getActivity().');
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js
index 6f11278..f51181e 100644
--- a/remoting/webapp/base/js/base.js
+++ b/remoting/webapp/base/js/base.js
@@ -861,3 +861,15 @@ base.isNaclEnabled = function() {
}
return false;
};
+
+/**
+ * Alias for document.getElementById that returns an HTMLElement
+ * @param {string} id The ID of the element to find.
+ * @return {?HTMLElement} The found element or null if not found.
+ */
+base.getHtmlElement = function(id) {
+ var el = document.getElementById(id);
+ if (el)
+ console.assert(el instanceof HTMLElement);
+ return /** @type {HTMLElement} */(el);
+};
diff --git a/remoting/webapp/base/js/message_window.js b/remoting/webapp/base/js/message_window.js
index f0eb428..54654ce 100644
--- a/remoting/webapp/base/js/message_window.js
+++ b/remoting/webapp/base/js/message_window.js
@@ -48,9 +48,9 @@ MessageWindowImpl.prototype.sendReply_ = function(
* Initializes the button with the label and the click handler.
* Hides the button if the label is null or undefined.
*
- * @param{HTMLElement} button
- * @param{?string} label
- * @param{Function} clickHandler
+ * @param {HTMLElement} button
+ * @param {?string} label
+ * @param {Function} clickHandler
* @private
*/
MessageWindowImpl.prototype.initButton_ =
@@ -92,12 +92,12 @@ MessageWindowImpl.prototype.onMessage_ = function(event) {
}
// Set the dialog text.
- var button = document.getElementById('button-primary');
- var cancelButton = document.getElementById('button-secondary');
- var messageDiv = document.getElementById('message');
- var infoboxDiv = document.getElementById('infobox');
+ var button = base.getHtmlElement('button-primary');
+ var cancelButton = base.getHtmlElement('button-secondary');
+ var messageDiv = base.getHtmlElement('message');
+ var infoboxDiv = base.getHtmlElement('infobox');
- document.getElementById('title').innerText = title;
+ base.getHtmlElement('title').innerText = title;
document.querySelector('title').innerText = title;
messageDiv.innerHTML = message;
@@ -142,7 +142,7 @@ MessageWindowImpl.prototype.onMessage_ = function(event) {
break;
}
- var messageDiv = document.getElementById('message');
+ var messageDiv = base.getHtmlElement('message');
messageDiv.innerText = message;
base.resizeWindowToContent(true);
diff --git a/remoting/webapp/base/js/modal_dialogs.js b/remoting/webapp/base/js/modal_dialogs.js
index e6b750d..4279401 100644
--- a/remoting/webapp/base/js/modal_dialogs.js
+++ b/remoting/webapp/base/js/modal_dialogs.js
@@ -149,7 +149,6 @@ remoting.MessageDialog.prototype.dispose = function() {
/**
* @param {remoting.MessageDialog.Result} result
- * @return {Function}
* @private
*/
remoting.MessageDialog.prototype.onClicked_ = function(result) {
@@ -270,7 +269,7 @@ remoting.ConnectingDialog = function(cancelCallback) {
/** @private */
this.dialog_ = new remoting.MessageDialog(
remoting.AppMode.CLIENT_CONNECTING,
- document.getElementById('cancel-connect-button'));
+ base.getHtmlElement('cancel-connect-button'));
/** @private */
this.onCancel_ = cancelCallback;
};
diff --git a/remoting/webapp/browser_test/timeout_waiter.js b/remoting/webapp/browser_test/timeout_waiter.js
index cb1a3a4..0c5a35c 100644
--- a/remoting/webapp/browser_test/timeout_waiter.js
+++ b/remoting/webapp/browser_test/timeout_waiter.js
@@ -70,7 +70,7 @@ browserTest.isVisible = function(id) {
var pred = new browserTest.Predicate();
pred.evaluate = function() {
/** @type {HTMLElement} */
- var element = document.getElementById(id);
+ var element = base.getHtmlElement(id);
browserTest.expect(Boolean(element), 'No such element: ' + id);
return element.getBoundingClientRect().width !== 0;
};
diff --git a/remoting/webapp/crd/js/crd_auth_dialog.js b/remoting/webapp/crd/js/crd_auth_dialog.js
index 8d45bde..f57c5b3 100644
--- a/remoting/webapp/crd/js/crd_auth_dialog.js
+++ b/remoting/webapp/crd/js/crd_auth_dialog.js
@@ -67,7 +67,7 @@ remoting.AuthDialog.prototype.isVisible = function() {
*/
remoting.AuthDialog.getInstance = function() {
if (!instance_) {
- var rootElement = document.getElementById('auth-dialog');
+ var rootElement = base.getHtmlElement('auth-dialog');
instance_ = new remoting.AuthDialog(rootElement);
}
return instance_;
diff --git a/remoting/webapp/crd/js/crd_main.js b/remoting/webapp/crd/js/crd_main.js
index d83a1bf..0ce20ae 100644
--- a/remoting/webapp/crd/js/crd_main.js
+++ b/remoting/webapp/crd/js/crd_main.js
@@ -16,11 +16,11 @@ var remoting = remoting || {};
remoting.initHostlist_ = function(handleConnect) {
remoting.hostController = new remoting.HostController();
remoting.hostList = new remoting.HostList(
- document.getElementById('host-list'),
- document.getElementById('host-list-empty'),
- document.getElementById('host-list-error-message'),
- document.getElementById('host-list-refresh-failed-button'),
- document.getElementById('host-list-loading-indicator'),
+ base.getHtmlElement('host-list'),
+ base.getHtmlElement('host-list-empty'),
+ base.getHtmlElement('host-list-error-message'),
+ base.getHtmlElement('host-list-refresh-failed-button'),
+ base.getHtmlElement('host-list-loading-indicator'),
remoting.showErrorMessage,
handleConnect);
@@ -68,13 +68,13 @@ function isHostModeSupported_() {
*/
remoting.initHomeScreenUi = function() {
remoting.setMode(remoting.AppMode.HOME);
- var dialog = document.getElementById('paired-clients-list');
- var message = document.getElementById('paired-client-manager-message');
- var deleteAll = document.getElementById('delete-all-paired-clients');
- var close = document.getElementById('close-paired-client-manager-dialog');
- var working = document.getElementById('paired-client-manager-dialog-working');
- var error = document.getElementById('paired-client-manager-dialog-error');
- var noPairedClients = document.getElementById('no-paired-clients');
+ var dialog = base.getHtmlElement('paired-clients-list');
+ var message = base.getHtmlElement('paired-client-manager-message');
+ var deleteAll = base.getHtmlElement('delete-all-paired-clients');
+ var close = base.getHtmlElement('close-paired-client-manager-dialog');
+ var working = base.getHtmlElement('paired-client-manager-dialog-working');
+ var error = base.getHtmlElement('paired-client-manager-dialog-error');
+ var noPairedClients = base.getHtmlElement('no-paired-clients');
remoting.pairedClientManager =
new remoting.PairedClientManager(remoting.hostController, dialog, message,
deleteAll, close, noPairedClients,
diff --git a/remoting/webapp/crd/js/desktop_connected_view.js b/remoting/webapp/crd/js/desktop_connected_view.js
index 22cbf4b..d06a5a2 100644
--- a/remoting/webapp/crd/js/desktop_connected_view.js
+++ b/remoting/webapp/crd/js/desktop_connected_view.js
@@ -178,7 +178,7 @@ remoting.DesktopConnectedView.prototype.initUI_ = function() {
this.plugin_, this.container_,
this.container_.querySelector('.mouse-cursor-overlay'));
- var scrollerElement = document.getElementById('scroller');
+ var scrollerElement = base.getHtmlElement('scroller');
this.viewport_ = new remoting.DesktopViewport(
scrollerElement || document.body,
this.plugin_.hostDesktop(),
diff --git a/remoting/webapp/crd/js/desktop_remoting.js b/remoting/webapp/crd/js/desktop_remoting.js
index 003cef3..3a0157094 100644
--- a/remoting/webapp/crd/js/desktop_remoting.js
+++ b/remoting/webapp/crd/js/desktop_remoting.js
@@ -96,7 +96,7 @@ remoting.DesktopRemoting.prototype.initApplication_ = function() {
if (base.isAppsV2()) {
remoting.windowFrame = new remoting.WindowFrame(
- document.getElementById('title-bar'), this.disconnect_.bind(this));
+ base.getHtmlElement('title-bar'), this.disconnect_.bind(this));
remoting.optionsMenu = remoting.windowFrame.createOptionsMenu();
var START_FULLSCREEN = 'start-fullscreen';
@@ -120,7 +120,7 @@ remoting.DesktopRemoting.prototype.initApplication_ = function() {
} else {
remoting.fullscreen = new remoting.FullscreenAppsV1();
remoting.toolbar = new remoting.Toolbar(
- document.getElementById('session-toolbar'),
+ base.getHtmlElement('session-toolbar'),
this.disconnect_.bind(this));
remoting.optionsMenu = remoting.toolbar.createOptionsMenu();
@@ -133,8 +133,7 @@ remoting.DesktopRemoting.prototype.initApplication_ = function() {
document.getElementById('access-mode-button').addEventListener(
'click', this.connectIt2Me_.bind(this), false);
- remoting.manageHelpAndFeedback(
- document.getElementById('title-bar'));
+ remoting.manageHelpAndFeedback(base.getHtmlElement('title-bar'));
remoting.showOrHideIT2MeUi();
remoting.showOrHideMe2MeUi();
diff --git a/remoting/webapp/crd/js/desktop_remoting_activity.js b/remoting/webapp/crd/js/desktop_remoting_activity.js
index 06ebd78..cf516a8 100644
--- a/remoting/webapp/crd/js/desktop_remoting_activity.js
+++ b/remoting/webapp/crd/js/desktop_remoting_activity.js
@@ -95,7 +95,7 @@ remoting.DesktopRemotingActivity.prototype.onConnected =
}
this.connectedView_ = remoting.DesktopConnectedView.create(
- document.getElementById('client-container'), connectionInfo);
+ base.getHtmlElement('client-container'), connectionInfo);
// Apply the default or previously-specified keyboard remapping.
var remapping = connectionInfo.host().options.getRemapKeys();
diff --git a/remoting/webapp/crd/js/host_table_entry.js b/remoting/webapp/crd/js/host_table_entry.js
index 89845a0..d5bae00 100644
--- a/remoting/webapp/crd/js/host_table_entry.js
+++ b/remoting/webapp/crd/js/host_table_entry.js
@@ -134,7 +134,7 @@ remoting.HostTableEntry.prototype.createDom_ = function() {
}
};
-/** @return {base.Disposable} @private */
+/** @private */
remoting.HostTableEntry.prototype.registerButton_ = function(
/** HTMLElement */ button, /** Function */ callback) {
var onKeyDown = function(/** Event */ e) {
diff --git a/remoting/webapp/crd/js/it2me_activity.js b/remoting/webapp/crd/js/it2me_activity.js
index 1e69c63..3d4e102 100644
--- a/remoting/webapp/crd/js/it2me_activity.js
+++ b/remoting/webapp/crd/js/it2me_activity.js
@@ -24,7 +24,7 @@ remoting.It2MeActivity = function() {
/** @private */
this.passCode_ = '';
- var form = document.getElementById('access-code-form');
+ var form = base.getHtmlElement('access-code-form');
/** @private */
this.accessCodeDialog_ = remoting.modalDialogFactory.createInputDialog(
remoting.AppMode.CLIENT_UNCONNECTED,
@@ -151,7 +151,7 @@ remoting.It2MeActivity.prototype.getDesktopActivityForTesting = function() {
remoting.It2MeActivity.prototype.showFinishDialog_ = function(mode) {
var finishDialog = new remoting.MessageDialog(
mode,
- document.getElementById('client-finished-it2me-button'));
+ base.getHtmlElement('client-finished-it2me-button'));
finishDialog.show().then(function() {
remoting.setMode(remoting.AppMode.HOME);
});
diff --git a/remoting/webapp/crd/js/me2me_activity.js b/remoting/webapp/crd/js/me2me_activity.js
index d2bcbdc..aa43d8a 100644
--- a/remoting/webapp/crd/js/me2me_activity.js
+++ b/remoting/webapp/crd/js/me2me_activity.js
@@ -23,10 +23,10 @@ remoting.Me2MeActivity = function(host, hostList) {
this.hostList_ = hostList;
/** @private */
this.pinDialog_ =
- new remoting.PinDialog(document.getElementById('pin-dialog'), host);
+ new remoting.PinDialog(base.getHtmlElement('pin-dialog'), host);
/** @private */
this.hostUpdateDialog_ = new remoting.HostNeedsUpdateDialog(
- document.getElementById('host-needs-update-dialog'), this.host_);
+ base.getHtmlElement('host-needs-update-dialog'), this.host_);
/** @private */
this.retryOnHostOffline_ = true;
@@ -282,8 +282,8 @@ remoting.Me2MeActivity.prototype.showErrorMessage_ = function(error) {
remoting.Me2MeActivity.prototype.showFinishDialog_ = function(mode) {
var dialog = remoting.modalDialogFactory.createMessageDialog(
mode,
- document.getElementById('client-finished-me2me-button'),
- document.getElementById('client-reconnect-button'));
+ base.getHtmlElement('client-finished-me2me-button'),
+ base.getHtmlElement('client-reconnect-button'));
/** @typedef {remoting.MessageDialog.Result} */
var Result = remoting.MessageDialog.Result;
diff --git a/remoting/webapp/crd/js/third_party_host_permissions.js b/remoting/webapp/crd/js/third_party_host_permissions.js
index 1fd3edf..e8bc2d4 100644
--- a/remoting/webapp/crd/js/third_party_host_permissions.js
+++ b/remoting/webapp/crd/js/third_party_host_permissions.js
@@ -66,9 +66,9 @@ remoting.ThirdPartyHostPermissions.prototype.getPermission = function(
remoting.ThirdPartyHostPermissions.prototype.showPermissionConfirmation_ =
function(onOk, onError) {
/** @type {HTMLElement} */
- var button = document.getElementById('third-party-auth-button');
+ var button = base.getHtmlElement('third-party-auth-button');
/** @type {HTMLElement} */
- var url = document.getElementById('third-party-auth-url');
+ var url = base.getHtmlElement('third-party-auth-url');
url.innerText = this.url_;
/** @type {remoting.ThirdPartyHostPermissions} */
diff --git a/remoting/webapp/crd/js/xhr_proxy.js b/remoting/webapp/crd/js/xhr_proxy.js
index 42ff883..dd24d7d 100644
--- a/remoting/webapp/crd/js/xhr_proxy.js
+++ b/remoting/webapp/crd/js/xhr_proxy.js
@@ -65,10 +65,12 @@ remoting.XMLHttpRequestProxy.prototype.abort = function() {
}
};
+/** @suppress {missingReturn} */
remoting.XMLHttpRequestProxy.prototype.getResponseHeader = function(header) {
console.error('Sandbox: unproxied getResponseHeader(' + header + ') called.');
};
+/** @suppress {missingReturn} */
remoting.XMLHttpRequestProxy.prototype.getAllResponseHeaders = function() {
console.error('Sandbox: unproxied getAllResponseHeaders called.');
};
diff --git a/remoting/webapp/js_proto/dom_proto.js b/remoting/webapp/js_proto/dom_proto.js
index c47c990..58b48c0 100644
--- a/remoting/webapp/js_proto/dom_proto.js
+++ b/remoting/webapp/js_proto/dom_proto.js
@@ -54,9 +54,6 @@ Element.prototype.offsetBottom;
/** @type {string} */
Element.prototype.textContent;
-/** @type {DOMTokenList} */
-Element.prototype.classList;
-
/** @type {boolean} */
Element.prototype.checked;