Chromium Code Reviews| 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 |