summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-09 22:34:22 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-09 22:34:22 +0000
commit1cb53ab28f5d146264dfde7838bfcfd39b1c7932 (patch)
tree4dcb15a8f681c269ddaec6906206a48167e67a9d /chrome/browser/resources
parent7783ad3f2317054bccfae7c0be3e4c8c65766a79 (diff)
downloadchromium_src-1cb53ab28f5d146264dfde7838bfcfd39b1c7932.zip
chromium_src-1cb53ab28f5d146264dfde7838bfcfd39b1c7932.tar.gz
chromium_src-1cb53ab28f5d146264dfde7838bfcfd39b1c7932.tar.bz2
DOMUI: Fix the AlertOverlay.show() API to except either an undefined or empty
string for cancel/ok buttons. If this condition is met, the button will not be shown. BUG=6503 TEST=none Review URL: http://codereview.chromium.org/5682004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68776 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/options/advanced_options.js8
-rw-r--r--chrome/browser/resources/options/alert_overlay.js29
-rw-r--r--chrome/browser/resources/options/certificate_manager.js7
-rw-r--r--chrome/browser/resources/options/passwords_exceptions_list.js3
-rw-r--r--chrome/browser/resources/options/personal_options.js11
5 files changed, 31 insertions, 27 deletions
diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js
index a6da175..f8b1da1 100644
--- a/chrome/browser/resources/options/advanced_options.js
+++ b/chrome/browser/resources/options/advanced_options.js
@@ -62,10 +62,10 @@ var OptionsPage = options.OptionsPage;
}
$('optionsReset').onclick = function(event) {
AlertOverlay.show(undefined,
- localStrings.getString('optionsResetMessage'),
- localStrings.getString('optionsResetOkLabel'),
- localStrings.getString('optionsResetCancelLabel'),
- function() { chrome.send('resetToDefaults'); });
+ localStrings.getString('optionsResetMessage'),
+ localStrings.getString('optionsResetOkLabel'),
+ localStrings.getString('optionsResetCancelLabel'),
+ function() { chrome.send('resetToDefaults'); });
}
if (cr.isWindows || cr.isMac) {
diff --git a/chrome/browser/resources/options/alert_overlay.js b/chrome/browser/resources/options/alert_overlay.js
index 11b965d..9274a3b 100644
--- a/chrome/browser/resources/options/alert_overlay.js
+++ b/chrome/browser/resources/options/alert_overlay.js
@@ -68,9 +68,10 @@ cr.define('options', function() {
* callbacks.
* @param {string} title The alert title to display to the user.
* @param {string} message The alert message to display to the user.
- * @param {string} okTitle The title of the OK button. Can be undefined.
- * @param {string} cancelTitle The title of the cancel button. Can be
- * undefined.
+ * @param {string} okTitle The title of the OK button. If undefined or empty,
+ * no button is shown.
+ * @param {string} cancelTitle The title of the cancel button. If undefined or
+ * empty, no button is shown.
* @param {function} okCallback A function to be called when the user presses
* the ok button. The alert window will be closed automatically. Can be
* undefined.
@@ -78,27 +79,31 @@ cr.define('options', function() {
* presses the cancel button. The alert window will be closed
* automatically. Can be undefined.
*/
- AlertOverlay.show = function(title, message, okTitle, cancelTitle, okCallback,
- cancelCallback) {
+ AlertOverlay.show = function(
+ title, message, okTitle, cancelTitle, okCallback, cancelCallback) {
if (title != undefined) {
$('alertOverlayTitle').textContent = title;
$('alertOverlayTitle').style.display = 'block';
} else {
$('alertOverlayTitle').style.display = 'none';
}
+
if (message != undefined) {
$('alertOverlayMessage').textContent = message;
$('alertOverlayMessage').style.display = 'block';
} else {
$('alertOverlayMessage').style.display = 'none';
}
- $('alertOverlayOk').textContent =
- (okTitle != undefined ? okTitle
- : localStrings.getString('ok'));
- if (cancelTitle != '') {
- $('alertOverlayCancel').textContent =
- (cancelTitle != undefined ? cancelTitle
- : localStrings.getString('cancel'));
+
+ if (okTitle != undefined && okTitle != '') {
+ $('alertOverlayOk').textContent = okTitle;
+ $('alertOverlayOk').style.display = 'block';
+ } else {
+ $('alertOverlayOk').style.display = 'none';
+ }
+
+ if (cancelTitle != undefined && cancelTitle != '') {
+ $('alertOverlayCancel').textContent = cancelTitle;
$('alertOverlayCancel').style.display = 'inline';
} else {
$('alertOverlayCancel').style.display = 'none';
diff --git a/chrome/browser/resources/options/certificate_manager.js b/chrome/browser/resources/options/certificate_manager.js
index 145cfcb..02090530 100644
--- a/chrome/browser/resources/options/certificate_manager.js
+++ b/chrome/browser/resources/options/certificate_manager.js
@@ -93,10 +93,9 @@ cr.define('options', function() {
AlertOverlay.show(
localStrings.getStringF(id + 'DeleteConfirm', data.name),
localStrings.getString(id + 'DeleteImpact'),
- undefined,
- undefined,
- function() { chrome.send('deleteCertificate', [data.id]); }
- );
+ localStrings.getString('ok'),
+ localStrings.getString('cancel'),
+ function() { chrome.send('deleteCertificate', [data.id]); });
}
}
diff --git a/chrome/browser/resources/options/passwords_exceptions_list.js b/chrome/browser/resources/options/passwords_exceptions_list.js
index 15fd0b6..2121976 100644
--- a/chrome/browser/resources/options/passwords_exceptions_list.js
+++ b/chrome/browser/resources/options/passwords_exceptions_list.js
@@ -279,7 +279,8 @@ cr.define('options.passwordsExceptions', function() {
};
removeAll.onclick = function(event) {
- AlertOverlay.show(undefined,
+ AlertOverlay.show(
+ undefined,
localStrings.getString('passwordsRemoveAllWarning'),
localStrings.getString('yesButtonLabel'),
localStrings.getString('noButtonLabel'),
diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js
index 9269e05..e1b8007 100644
--- a/chrome/browser/resources/options/personal_options.js
+++ b/chrome/browser/resources/options/personal_options.js
@@ -86,12 +86,11 @@ cr.define('options', function() {
},
showStopSyncingOverlay_: function(event) {
- AlertOverlay.show(
- localStrings.getString('stop_syncing_title'),
- localStrings.getString('stop_syncing_explanation'),
- localStrings.getString('stop_syncing_confirm_button_label'),
- undefined,
- function() { chrome.send('stopSyncing'); });
+ AlertOverlay.show(localStrings.getString('stop_syncing_title'),
+ localStrings.getString('stop_syncing_explanation'),
+ localStrings.getString('stop_syncing_confirm'),
+ localStrings.getString('cancel'),
+ function() { chrome.send('stopSyncing'); });
},
setElementVisible_: function(element, visible) {