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

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: Address comments. 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
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4003080991def12d545c680a18b6d6aba503d8c2..79d390056cd8d6dc74d051ff1d30950c2767ebeb 100644
--- a/chrome/browser/resources/chromeos/login/oobe.js
+++ b/chrome/browser/resources/chromeos/login/oobe.js
@@ -12,8 +12,13 @@ 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';
+ /* Accelerator identifiers. Must be kept in sync with webui_login_view.cc. */
+ const ACCELERATOR_ACCESSIBILITY = 'accessibility';
+ const ACCELERATOR_ENROLLMENT = 'enrollment';
+
/**
* Constructs an Out of box controller. It manages initialization of screens,
* transitions, error messages display.
@@ -46,25 +51,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 == ACCELERATOR_ACCESSIBILITY) {
+ chrome.send('toggleAccessibility', []);
+ } else if (ACCELERATOR_ENROLLMENT) {
+ var currentStepId = this.screens_[this.currentStep_];
+ if (currentStepId == SCREEN_SIGNIN ||
+ currentStepId == SCREEN_GAIA_SIGNIN) {
+ chrome.send('toggleEnrollmentScreen', []);
+ }
+ }
},
/**
@@ -291,14 +290,20 @@ 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.
+ * @param {string} name accelerator name.
+ */
+ Oobe.handleAccelerator = function(name) {
+ Oobe.getInstance().handleAccelerator(name);
+ };
+
+ /**
* Shows the given screen.
* @param {Object} screen Screen params dict, e.g. {id: screenId, data: data}
*/
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698