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

Side by Side 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, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview A simple virtual keyboard implementation. 6 * @fileoverview A simple virtual keyboard implementation.
7 */ 7 */
8 8
9 /** 9 /**
10 * The keyboard layout name currently in use. 10 * The keyboard layout name currently in use.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 var mainDiv = document.createElement('div'); 158 var mainDiv = document.createElement('div');
159 mainDiv.className = 'main'; 159 mainDiv.className = 'main';
160 mainDiv.id = 'main'; 160 mainDiv.id = 'main';
161 body.appendChild(mainDiv); 161 body.appendChild(mainDiv);
162 162
163 initIme(mainDiv); 163 initIme(mainDiv);
164 initKeyboard(currentKeyboardLayout, mainDiv); 164 initKeyboard(currentKeyboardLayout, mainDiv);
165 165
166 window.onhashchange(); 166 window.onhashchange();
167 167
168 // Restore the keyboard to the default state when it is hidden. 168 chrome.experimental.input.onTextInputTypeChanged.addListener(function(type) {
169 // Ref: dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html 169 switch(type) {
170 document.addEventListener("webkitvisibilitychange", function() { 170 case "text":
171 if (document.webkitHidden) { 171 currentMode = SHIFT_MODE;
172 currentMode = SHIFT_MODE; 172 break;
173 setMode(currentMode); 173 case "password":
174 case "search":
175 case "url":
176 currentMode = KEY_MODE;
177 break;
178 case "number":
179 case "tel":
180 currentMode = NUMBER_MODE;
181 break;
182 default:
183 currentMode = KEY_MODE;
184 break;
174 } 185 }
175 }, false); 186 setMode(currentMode);
187 });
176 } 188 }
177 // TODO(bryeung): would be nice to leave less gutter (without causing 189 // TODO(bryeung): would be nice to leave less gutter (without causing
178 // rendering issues with floated divs wrapping at some sizes). 190 // rendering issues with floated divs wrapping at some sizes).
179 191
180 /** 192 /**
181 * Switch the keyboard layout based on the current URL hash. 193 * Switch the keyboard layout based on the current URL hash.
182 * @return {void} 194 * @return {void}
183 */ 195 */
184 window.onhashchange = function() { 196 window.onhashchange = function() {
185 var old_layout = currentKeyboardLayout; 197 var old_layout = currentKeyboardLayout;
(...skipping 19 matching lines...) Expand all
205 if (canvas !== undefined) { 217 if (canvas !== undefined) {
206 if (!visible) { 218 if (!visible) {
207 canvas.clear(); 219 canvas.clear();
208 } 220 }
209 } 221 }
210 if (visible) { 222 if (visible) {
211 window.onresize(); 223 window.onresize();
212 } 224 }
213 }); 225 });
214 } 226 }
OLDNEW
« 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