OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 'use strict'; | 4 'use strict'; |
5 | 5 |
6 /** | 6 /** |
7 * This class is a base class of each input method implementation. | 7 * This class is a base class of each input method implementation. |
8 * @constructor | 8 * @constructor |
9 */ | 9 */ |
10 var IMEBase = function() {}; | 10 var IMEBase = function() {}; |
11 IMEBase.prototype = { | 11 IMEBase.prototype = { |
12 onActivate: function() {}, | 12 onActivate: function() {}, |
13 onDeactivated: function() {}, | 13 onDeactivated: function() {}, |
14 onFocus: function(context) {}, | 14 onFocus: function(context) {}, |
15 onBlur: function(contextID) {}, | 15 onBlur: function(contextID) {}, |
16 onInputContextUpdate: function(context) {}, | 16 onInputContextUpdate: function(context) {}, |
17 onKeyEvent: function(context, engine, keyData) { return false; }, | 17 onKeyEvent: function(context, engine, keyData) { return false; }, |
18 onCandidateClicked: function(candidateID, button) {}, | 18 onCandidateClicked: function(candidateID, button) {}, |
19 onMenuItemActivated: function(name) {}, | 19 onMenuItemActivated: function(name) {}, |
20 onSurroundingTextChanged: function(text, focus, anchor) {}, | 20 onSurroundingTextChanged: function(text, focus, anchor, offset) {}, |
21 onReset: function(engineID) {} | 21 onReset: function(engineID) {} |
22 }; | 22 }; |
23 | 23 |
24 /** | 24 /** |
25 * This class provides simple identity input methods. | 25 * This class provides simple identity input methods. |
26 * @constructor | 26 * @constructor |
27 **/ | 27 **/ |
28 var IdentityIME = function() {}; | 28 var IdentityIME = function() {}; |
29 IdentityIME.prototype = new IMEBase(); | 29 IdentityIME.prototype = new IMEBase(); |
30 | 30 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 chrome.test.sendMessage('onMenuItemActivated'); | 201 chrome.test.sendMessage('onMenuItemActivated'); |
202 }, | 202 }, |
203 | 203 |
204 /** | 204 /** |
205 * Called from chrome.input.ime.onSurroundingTextChanged. | 205 * Called from chrome.input.ime.onSurroundingTextChanged. |
206 * @private | 206 * @private |
207 * @this EngineBridge | 207 * @this EngineBridge |
208 **/ | 208 **/ |
209 onSurroundingTextChanged_: function(engineID, object) { | 209 onSurroundingTextChanged_: function(engineID, object) { |
210 this.engineInstance_[engineID].onSurroundingTextChanged( | 210 this.engineInstance_[engineID].onSurroundingTextChanged( |
211 object.text, object.focus, object.anchor); | 211 object.text, object.focus, object.anchor, object.offset); |
212 chrome.test.sendMessage('onSurroundingTextChanged'); | 212 chrome.test.sendMessage('onSurroundingTextChanged'); |
213 }, | 213 }, |
214 | 214 |
215 /** | 215 /** |
216 * Called from chrome.input.ime.onReset. | 216 * Called from chrome.input.ime.onReset. |
217 * @private | 217 * @private |
218 * @this EngineBridge | 218 * @this EngineBridge |
219 **/ | 219 **/ |
220 onReset_: function(engineID) { | 220 onReset_: function(engineID) { |
221 this.engineInstance_[engineID].onReset(engineID); | 221 this.engineInstance_[engineID].onReset(engineID); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 chrome.input.ime.onReset.addListener(this.onReset_.bind(this)); | 270 chrome.input.ime.onReset.addListener(this.onReset_.bind(this)); |
271 } | 271 } |
272 }; | 272 }; |
273 | 273 |
274 var engineBridge = new EngineBridge(); | 274 var engineBridge = new EngineBridge(); |
275 engineBridge.Initialize(); | 275 engineBridge.Initialize(); |
276 engineBridge.addEngine('IdentityIME', new IdentityIME()); | 276 engineBridge.addEngine('IdentityIME', new IdentityIME()); |
277 engineBridge.addEngine('ToUpperIME', new ToUpperIME()); | 277 engineBridge.addEngine('ToUpperIME', new ToUpperIME()); |
278 engineBridge.addEngine('APIArgumentIME', new APIArgumentIME()); | 278 engineBridge.addEngine('APIArgumentIME', new APIArgumentIME()); |
279 chrome.test.sendMessage('ReadyToUseImeEvent'); | 279 chrome.test.sendMessage('ReadyToUseImeEvent'); |
OLD | NEW |