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

Unified Diff: chrome/browser/resources/chromeos/login/oobe.js

Issue 7550043: CrOS OOBE: Grab accelerators in native code instead of JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months 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
Index: chrome/browser/resources/chromeos/login/oobe.js
diff --git a/chrome/browser/resources/chromeos/login/oobe.js b/chrome/browser/resources/chromeos/login/oobe.js
index 7309143e0b96b765d1db27bf780f968f4ca79af8..6212e301479c0947b1b47cc096ac40471928e425 100644
--- a/chrome/browser/resources/chromeos/login/oobe.js
+++ b/chrome/browser/resources/chromeos/login/oobe.js
@@ -12,6 +12,7 @@ var localStrings = new LocalStrings();
cr.define('cr.ui', function() {
const SCREEN_SIGNIN = 'signin';
+ const SCREEN_GAIA_SIGNIN = 'gaia-signin';
const SCREEN_ACCOUNT_PICKER = 'account-picker';
/**
@@ -46,25 +47,19 @@ cr.define('cr.ui', function() {
},
/**
- * Oobe keydown handler.
+ * Handle accelerators.
+ * @param {string} accelerator name.
*/
- oobeKeyDown: function(e) {
- var keystroke = String.fromCharCode(e.keyCode);
- switch (keystroke) {
- case 'Z':
- if (e.altKey && e.ctrlKey) {
- chrome.send('toggleAccessibility', []);
- break;
- }
- case 'E':
- var currentStepId = this.screens_[this.currentStep_];
- if (currentStepId == SCREEN_SIGNIN) {
- if (e.altKey && e.ctrlKey) {
- chrome.send('toggleEnrollmentScreen', []);
- break;
- }
- }
- } // switch
+ handleAccelerator: function(name) {
+ if (name == 'accessibility') {
whywhat 2011/08/08 08:09:08 optional: define accelerator names as constants ab
Mattias Nissler (ping if slow) 2011/08/08 11:11:47 Done.
+ chrome.send('toggleAccessibility', []);
+ } else if (name == 'enrollment') {
+ var currentStepId = this.screens_[this.currentStep_];
+ if (currentStepId == SCREEN_SIGNIN ||
+ currentStepId == SCREEN_GAIA_SIGNIN) {
+ chrome.send('toggleEnrollmentScreen', []);
+ }
+ }
},
/**
@@ -296,14 +291,21 @@ cr.define('cr.ui', function() {
Oobe.showScreen({id: SCREEN_ACCOUNT_PICKER});
});
- document.addEventListener('keydown', function(e) {
- Oobe.getInstance().oobeKeyDown(e);
- }, true);
-
chrome.send('screenStateInitialize', []);
};
/**
+ * Handle accelerators. These are passed from native code instead of a JS
+ * event handler in order to make sure that embedded iframes cannot swallow
+ * them.
+ *
James Hawkins 2011/08/05 20:19:50 Remove blank line.
Mattias Nissler (ping if slow) 2011/08/08 11:11:47 Done.
+ * @param {string} accelerator name.
whywhat 2011/08/08 08:09:08 nit: Should be @param {string} name Accelerator na
Mattias Nissler (ping if slow) 2011/08/08 11:11:47 Done.
+ */
+ Oobe.handleAccelerator = function(name) {
+ Oobe.getInstance().handleAccelerator(name);
+ };
+
+ /**
* Shows the given screen.
* @param {Object} screen Screen params dict, e.g. {id: screenId, data: data}
*/

Powered by Google App Engine
This is Rietveld 408576698