Index: chrome/browser/resources/keyboard/main.js |
diff --git a/chrome/browser/resources/keyboard/main.js b/chrome/browser/resources/keyboard/main.js |
index 9ef5623193f23ad9fcfe9a16f8b34fecd4b0ed1b..7c07881251025c1e374b492a7a996fb1b1e985e7 100644 |
--- a/chrome/browser/resources/keyboard/main.js |
+++ b/chrome/browser/resources/keyboard/main.js |
@@ -165,14 +165,24 @@ 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) { |
+ chrome.experimental.input.onTextInputTypeChanged.addListener(function(type) { |
mazda
2011/08/04 02:15:36
It might be better to enclose the sentence.
if (c
|
+ var currentMode = KEY_MODE; |
bryeung
2011/08/03 22:24:21
don't shadow currentMode: it is a global JS variab
Peng
2011/08/24 15:35:54
Done.
|
+ switch(type) { |
bryeung
2011/08/03 22:24:21
I think the switch contents should be indented two
Peng
2011/08/24 15:35:54
Done.
|
+ case "text": |
currentMode = SHIFT_MODE; |
- setMode(currentMode); |
+ break; |
+ case "password": |
+ case "search": |
+ case "url": |
+ currentMode = KEY_MODE; |
+ break; |
+ case "number": |
+ case "tel": |
+ currentMode = NUMBER_MODE; |
+ break; |
mazda
2011/08/04 02:15:36
It would be better to handle the default case as e
Peng
2011/08/24 15:35:54
Done.
|
} |
- }, false); |
+ setMode(currentMode); |
+ }); |
} |
// TODO(bryeung): would be nice to leave less gutter (without causing |
// rendering issues with floated divs wrapping at some sizes). |