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

Unified Diff: chrome/browser/resources/keyboard/main.js

Issue 7508025: Switch virtual keyboard mode base on type of the current focused input field. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebase and fix review issues. 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 | « 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/keyboard/main.js
diff --git a/chrome/browser/resources/keyboard/main.js b/chrome/browser/resources/keyboard/main.js
index 075165425b5b8ceff8779bc9934645a9e45ec001..3c77bc73a7306742410c8ef79ae4a40f7230f92f 100644
--- a/chrome/browser/resources/keyboard/main.js
+++ b/chrome/browser/resources/keyboard/main.js
@@ -165,14 +165,26 @@ window.onload = function() {
window.onhashchange();
- // Restore the keyboard to the default state when it is hidden.
- // Ref: dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html
- document.addEventListener("webkitvisibilitychange", function() {
- if (document.webkitHidden) {
- currentMode = SHIFT_MODE;
- setMode(currentMode);
+ chrome.experimental.input.onTextInputTypeChanged.addListener(function(type) {
+ switch(type) {
+ case "text":
+ currentMode = SHIFT_MODE;
+ break;
+ case "password":
+ case "search":
+ case "url":
+ currentMode = KEY_MODE;
+ break;
+ case "number":
+ case "tel":
+ currentMode = NUMBER_MODE;
+ break;
+ default:
+ currentMode = KEY_MODE;
+ break;
}
- }, false);
+ setMode(currentMode);
+ });
}
// TODO(bryeung): would be nice to leave less gutter (without causing
// rendering issues with floated divs wrapping at some sizes).
« 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