Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: chrome/browser/resources/options/manage_profile_overlay.js

Issue 11552029: Make hitting "Enter" submit the add/change profile dialog. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Respect OK button disabled state Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/manage_profile_overlay.js
diff --git a/chrome/browser/resources/options/manage_profile_overlay.js b/chrome/browser/resources/options/manage_profile_overlay.js
index b776b12323ca5822f8f3ee7dff7e3ccc1a54852e..d34283a71096ee8540d6a0eaea67ac2529390317 100644
--- a/chrome/browser/resources/options/manage_profile_overlay.js
+++ b/chrome/browser/resources/options/manage_profile_overlay.js
@@ -73,14 +73,21 @@ cr.define('options', function() {
};
$('create-profile-ok').onclick = function(event) {
OptionsPage.closeOverlay();
- // Get the user's chosen name and icon, or default if they do not
- // wish to customize their profile.
- var name = $('create-profile-name').value;
- var icon_url = createIconGrid.selectedItem;
- var create_checkbox = false;
- if ($('create-shortcut'))
- create_checkbox = $('create-shortcut').checked;
- chrome.send('createProfile', [name, icon_url, create_checkbox]);
+ self.submitCreateProfile_();
+ };
+ $('manage-profile-name').onkeydown =
+ $('manage-profile-icon-grid').onkeydown = function(event) {
+ if (!$('manage-profile-ok').disabled && event.keyCode == 13) { // Enter
+ OptionsPage.closeOverlay();
+ self.submitManageChanges_();
+ }
+ };
+ $('create-profile-name').onkeydown =
+ $('create-profile-icon-grid').onkeydown = function(event) {
+ if (!$('create-profile-ok').disabled && event.keyCode == 13) { // Enter
+ OptionsPage.closeOverlay();
+ self.submitCreateProfile_();
+ }
csilv 2012/12/15 01:05:12 These two methods are identical, so it would be ni
Rune Fevang 2012/12/18 02:47:02 Done.
};
},
@@ -213,7 +220,8 @@ cr.define('options', function() {
},
/**
- * Called when the user clicks "OK". Saves the newly changed profile info.
+ * Called when the user clicks "OK" or hits enter. Saves the newly changed
+ * profile info.
* @private
*/
submitManageChanges_: function() {
@@ -228,6 +236,22 @@ cr.define('options', function() {
},
/**
+ * Called when the user clicks "OK" or hits enter. Creates the profile
+ * using the information in the dialog.
+ * @private
+ */
+ submitCreateProfile_: function() {
+ // Get the user's chosen name and icon, or default if they do not
+ // wish to customize their profile.
+ var name = $('create-profile-name').value;
+ var icon_url = $('create-profile-icon-grid').selectedItem;
+ var create_checkbox = false;
+ if ($('create-shortcut'))
+ create_checkbox = $('create-shortcut').checked;
+ chrome.send('createProfile', [name, icon_url, create_checkbox]);
+ },
+
+ /**
* Called when the selected icon in the icon grid changes.
* @param {String} mode A label that specifies the type of dialog
* box which is currently being viewed (i.e. 'create' or
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698