summaryrefslogtreecommitdiffstats
path: root/remoting/webapp/base
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/webapp/base')
-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
4 files changed, 31 insertions, 13 deletions
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;
};