| OLD | NEW |
| 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. |
| 2 // limitations under the License. | 2 // limitations under the License. |
| 3 // See the License for the specific language governing permissions and | 3 // See the License for the specific language governing permissions and |
| 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 5 // distributed under the License is distributed on an "AS-IS" BASIS, | 5 // distributed under the License is distributed on an "AS-IS" BASIS, |
| 6 // Unless required by applicable law or agreed to in writing, software | 6 // Unless required by applicable law or agreed to in writing, software |
| 7 // | 7 // |
| 8 // http://www.apache.org/licenses/LICENSE-2.0 | 8 // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 // | 9 // |
| 10 // You may obtain a copy of the License at | 10 // You may obtain a copy of the License at |
| 11 // you may not use this file except in compliance with the License. | 11 // you may not use this file except in compliance with the License. |
| 12 // Licensed under the Apache License, Version 2.0 (the "License"); | 12 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 13 // | 13 // |
| 14 goog.provide('i18n.input.chrome.inputview.Controller'); | 14 goog.provide('i18n.input.chrome.inputview.Controller'); |
| 15 | 15 |
| 16 goog.require('goog.Disposable'); | 16 goog.require('goog.Disposable'); |
| 17 goog.require('goog.Timer'); | 17 goog.require('goog.Timer'); |
| 18 goog.require('goog.array'); | 18 goog.require('goog.array'); |
| 19 goog.require('goog.async.Delay'); | 19 goog.require('goog.async.Delay'); |
| 20 goog.require('goog.dom.classlist'); | 20 goog.require('goog.dom.classlist'); |
| 21 goog.require('goog.events.Event'); | 21 goog.require('goog.events.Event'); |
| 22 goog.require('goog.events.EventHandler'); | 22 goog.require('goog.events.EventHandler'); |
| 23 goog.require('goog.events.EventType'); | 23 goog.require('goog.events.EventType'); |
| 24 goog.require('goog.i18n.bidi'); | 24 goog.require('goog.i18n.bidi'); |
| 25 goog.require('goog.object'); | 25 goog.require('goog.object'); |
| 26 goog.require('i18n.input.chrome.DataSource'); | 26 goog.require('i18n.input.chrome.DataSource'); |
| 27 goog.require('i18n.input.chrome.SoundController'); |
| 27 goog.require('i18n.input.chrome.Statistics'); | 28 goog.require('i18n.input.chrome.Statistics'); |
| 28 goog.require('i18n.input.chrome.inputview.Adapter'); | 29 goog.require('i18n.input.chrome.inputview.Adapter'); |
| 29 goog.require('i18n.input.chrome.inputview.CandidatesInfo'); | 30 goog.require('i18n.input.chrome.inputview.CandidatesInfo'); |
| 30 goog.require('i18n.input.chrome.inputview.ConditionName'); | 31 goog.require('i18n.input.chrome.inputview.ConditionName'); |
| 31 goog.require('i18n.input.chrome.inputview.Css'); | 32 goog.require('i18n.input.chrome.inputview.Css'); |
| 32 goog.require('i18n.input.chrome.inputview.KeyboardContainer'); | 33 goog.require('i18n.input.chrome.inputview.KeyboardContainer'); |
| 33 goog.require('i18n.input.chrome.inputview.M17nModel'); | 34 goog.require('i18n.input.chrome.inputview.M17nModel'); |
| 34 goog.require('i18n.input.chrome.inputview.Model'); | 35 goog.require('i18n.input.chrome.inputview.Model'); |
| 35 goog.require('i18n.input.chrome.inputview.PerfTracker'); | 36 goog.require('i18n.input.chrome.inputview.PerfTracker'); |
| 36 goog.require('i18n.input.chrome.inputview.ReadyState'); | 37 goog.require('i18n.input.chrome.inputview.ReadyState'); |
| 37 goog.require('i18n.input.chrome.inputview.Settings'); | 38 goog.require('i18n.input.chrome.inputview.Settings'); |
| 38 goog.require('i18n.input.chrome.inputview.SizeSpec'); | 39 goog.require('i18n.input.chrome.inputview.SizeSpec'); |
| 39 goog.require('i18n.input.chrome.inputview.SoundController'); | |
| 40 goog.require('i18n.input.chrome.inputview.SpecNodeName'); | 40 goog.require('i18n.input.chrome.inputview.SpecNodeName'); |
| 41 goog.require('i18n.input.chrome.inputview.StateType'); | 41 goog.require('i18n.input.chrome.inputview.StateType'); |
| 42 goog.require('i18n.input.chrome.inputview.SwipeDirection'); | 42 goog.require('i18n.input.chrome.inputview.SwipeDirection'); |
| 43 goog.require('i18n.input.chrome.inputview.elements.ElementType'); | 43 goog.require('i18n.input.chrome.inputview.elements.ElementType'); |
| 44 goog.require('i18n.input.chrome.inputview.elements.content.Candidate'); | 44 goog.require('i18n.input.chrome.inputview.elements.content.Candidate'); |
| 45 goog.require('i18n.input.chrome.inputview.elements.content.CandidateView'); | 45 goog.require('i18n.input.chrome.inputview.elements.content.CandidateView'); |
| 46 goog.require('i18n.input.chrome.inputview.elements.content.ExpandedCandidateView
'); | 46 goog.require('i18n.input.chrome.inputview.elements.content.ExpandedCandidateView
'); |
| 47 goog.require('i18n.input.chrome.inputview.elements.content.MenuView'); | 47 goog.require('i18n.input.chrome.inputview.elements.content.MenuView'); |
| 48 goog.require('i18n.input.chrome.inputview.events.EventType'); | 48 goog.require('i18n.input.chrome.inputview.events.EventType'); |
| 49 goog.require('i18n.input.chrome.inputview.events.KeyCodes'); | 49 goog.require('i18n.input.chrome.inputview.events.KeyCodes'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 ExpandedCandidateView; | 69 ExpandedCandidateView; |
| 70 var InputToolCode = i18n.input.lang.InputToolCode; | 70 var InputToolCode = i18n.input.lang.InputToolCode; |
| 71 var KeyCodes = i18n.input.chrome.inputview.events.KeyCodes; | 71 var KeyCodes = i18n.input.chrome.inputview.events.KeyCodes; |
| 72 var MenuView = i18n.input.chrome.inputview.elements.content.MenuView; | 72 var MenuView = i18n.input.chrome.inputview.elements.content.MenuView; |
| 73 var Name = i18n.input.chrome.message.Name; | 73 var Name = i18n.input.chrome.message.Name; |
| 74 var PerfTracker = i18n.input.chrome.inputview.PerfTracker; | 74 var PerfTracker = i18n.input.chrome.inputview.PerfTracker; |
| 75 var SizeSpec = i18n.input.chrome.inputview.SizeSpec; | 75 var SizeSpec = i18n.input.chrome.inputview.SizeSpec; |
| 76 var SpecNodeName = i18n.input.chrome.inputview.SpecNodeName; | 76 var SpecNodeName = i18n.input.chrome.inputview.SpecNodeName; |
| 77 var StateType = i18n.input.chrome.inputview.StateType; | 77 var StateType = i18n.input.chrome.inputview.StateType; |
| 78 var content = i18n.input.chrome.inputview.elements.content; | 78 var content = i18n.input.chrome.inputview.elements.content; |
| 79 var SoundController = i18n.input.chrome.inputview.SoundController; | 79 var SoundController = i18n.input.chrome.SoundController; |
| 80 var Sounds = i18n.input.chrome.inputview.Sounds; | 80 var Sounds = i18n.input.chrome.inputview.Sounds; |
| 81 var Type = i18n.input.chrome.message.Type; | 81 var Type = i18n.input.chrome.message.Type; |
| 82 var util = i18n.input.chrome.inputview.util; | 82 var util = i18n.input.chrome.inputview.util; |
| 83 | 83 |
| 84 | 84 |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * The controller of the input view keyboard. | 87 * The controller of the input view keyboard. |
| 88 * | 88 * |
| 89 * @param {string} keyset The keyboard keyset. | 89 * @param {string} keyset The keyboard keyset. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * The layout map. | 111 * The layout map. |
| 112 * | 112 * |
| 113 * @type {!Object.<string, !Object>} | 113 * @type {!Object.<string, !Object>} |
| 114 * @private | 114 * @private |
| 115 */ | 115 */ |
| 116 this.layoutDataMap_ = {}; | 116 this.layoutDataMap_ = {}; |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * The element map. |
| 120 * |
| 121 * @private {!Object.<ElementType, !KeyCodes>} |
| 122 */ |
| 123 this.elementTypeToKeyCode_ = goog.object.create( |
| 124 ElementType.BOLD, KeyCodes.KEY_B, |
| 125 ElementType.ITALICS, KeyCodes.KEY_I, |
| 126 ElementType.UNDERLINE, KeyCodes.KEY_U, |
| 127 ElementType.COPY, KeyCodes.KEY_C, |
| 128 ElementType.PASTE, KeyCodes.KEY_V, |
| 129 ElementType.CUT, KeyCodes.KEY_X, |
| 130 ElementType.SELECT_ALL, KeyCodes.KEY_A, |
| 131 ElementType.REDO, KeyCodes.KEY_Y, |
| 132 ElementType.UNDO, KeyCodes.KEY_Z |
| 133 ); |
| 134 |
| 135 /** |
| 119 * The keyset data map. | 136 * The keyset data map. |
| 120 * | 137 * |
| 121 * @type {!Object.<string, !Object>} | 138 * @type {!Object.<string, !Object>} |
| 122 * @private | 139 * @private |
| 123 */ | 140 */ |
| 124 this.keysetDataMap_ = {}; | 141 this.keysetDataMap_ = {}; |
| 125 | 142 |
| 126 /** | 143 /** |
| 127 * The event handler. | 144 * The event handler. |
| 128 * | 145 * |
| (...skipping 26 matching lines...) Expand all Loading... |
| 155 * @private | 172 * @private |
| 156 */ | 173 */ |
| 157 this.statistics_ = i18n.input.chrome.Statistics.getInstance(); | 174 this.statistics_ = i18n.input.chrome.Statistics.getInstance(); |
| 158 | 175 |
| 159 /** @private {!i18n.input.chrome.inputview.ReadyState} */ | 176 /** @private {!i18n.input.chrome.inputview.ReadyState} */ |
| 160 this.readyState_ = new i18n.input.chrome.inputview.ReadyState(); | 177 this.readyState_ = new i18n.input.chrome.inputview.ReadyState(); |
| 161 | 178 |
| 162 /** @private {!i18n.input.chrome.inputview.Adapter} */ | 179 /** @private {!i18n.input.chrome.inputview.Adapter} */ |
| 163 this.adapter_ = new i18n.input.chrome.inputview.Adapter(this.readyState_); | 180 this.adapter_ = new i18n.input.chrome.inputview.Adapter(this.readyState_); |
| 164 | 181 |
| 182 /** @private {!i18n.input.chrome.SoundController} */ |
| 183 this.soundController_ = new SoundController(false); |
| 184 |
| 165 /** @private {!i18n.input.chrome.inputview.KeyboardContainer} */ | 185 /** @private {!i18n.input.chrome.inputview.KeyboardContainer} */ |
| 166 this.container_ = new i18n.input.chrome.inputview.KeyboardContainer( | 186 this.container_ = new i18n.input.chrome.inputview.KeyboardContainer( |
| 167 this.adapter_); | 187 this.adapter_, this.soundController_); |
| 168 this.container_.render(); | 188 this.container_.render(); |
| 169 | 189 |
| 170 /** @private {!i18n.input.chrome.inputview.SoundController} */ | |
| 171 this.soundController_ = new SoundController(false); | |
| 172 | |
| 173 /** | 190 /** |
| 174 * The context type and keyset mapping group by input method id. | 191 * The context type and keyset mapping group by input method id. |
| 175 * key: input method id. | 192 * key: input method id. |
| 176 * value: Object | 193 * value: Object |
| 177 * key: context type string. | 194 * key: context type string. |
| 178 * value: keyset string. | 195 * value: keyset string. |
| 179 * | 196 * |
| 180 * @private {!Object.<string, !Object.<string, string>>} | 197 * @private {!Object.<string, !Object.<string, string>>} |
| 181 */ | 198 */ |
| 182 this.contextTypeToKeysetMap_ = {}; | 199 this.contextTypeToKeysetMap_ = {}; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 * @enum {number} | 369 * @enum {number} |
| 353 */ | 370 */ |
| 354 Controller.CandidatesOperation = { | 371 Controller.CandidatesOperation = { |
| 355 NONE: 0, | 372 NONE: 0, |
| 356 EXPAND: 1, | 373 EXPAND: 1, |
| 357 SHRINK: 2 | 374 SHRINK: 2 |
| 358 }; | 375 }; |
| 359 | 376 |
| 360 | 377 |
| 361 /** | 378 /** |
| 379 * A temporary list to track keysets have customized in material design. |
| 380 * |
| 381 * @private {!Array.<string>} |
| 382 */ |
| 383 Controller.MATERIAL_KEYSETS_ = [ |
| 384 'emoji', |
| 385 'hwt' |
| 386 ]; |
| 387 |
| 388 |
| 389 /** |
| 362 * The active language code. | 390 * The active language code. |
| 363 * | 391 * |
| 364 * @type {string} | 392 * @type {string} |
| 365 * @private | 393 * @private |
| 366 */ | 394 */ |
| 367 Controller.prototype.lang_; | 395 Controller.prototype.lang_; |
| 368 | 396 |
| 369 | 397 |
| 370 /** | 398 /** |
| 371 * The password keyset. | 399 * The password keyset. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 EventType.DOUBLE_CLICK, | 461 EventType.DOUBLE_CLICK, |
| 434 EventType.DOUBLE_CLICK_END, | 462 EventType.DOUBLE_CLICK_END, |
| 435 EventType.POINTER_UP, | 463 EventType.POINTER_UP, |
| 436 EventType.POINTER_DOWN, | 464 EventType.POINTER_DOWN, |
| 437 EventType.POINTER_OVER, | 465 EventType.POINTER_OVER, |
| 438 EventType.POINTER_OUT, | 466 EventType.POINTER_OUT, |
| 439 EventType.SWIPE | 467 EventType.SWIPE |
| 440 ], this.onPointerEvent_). | 468 ], this.onPointerEvent_). |
| 441 listen(window, goog.events.EventType.RESIZE, this.resize). | 469 listen(window, goog.events.EventType.RESIZE, this.resize). |
| 442 listen(this.adapter_, | 470 listen(this.adapter_, |
| 443 i18n.input.chrome.inputview.events.EventType. | 471 EventType.SURROUNDING_TEXT_CHANGED, this.onSurroundingTextChanged_). |
| 444 SURROUNDING_TEXT_CHANGED, | |
| 445 this.onSurroundingTextChanged_). | |
| 446 listen(this.adapter_, | 472 listen(this.adapter_, |
| 447 i18n.input.chrome.DataSource.EventType.CANDIDATES_BACK, | 473 i18n.input.chrome.DataSource.EventType.CANDIDATES_BACK, |
| 448 this.onCandidatesBack_). | 474 this.onCandidatesBack_). |
| 449 listen(this.adapter_, | 475 listen(this.adapter_, EventType.URL_CHANGED, this.onURLChanged_). |
| 450 i18n.input.chrome.inputview.events.EventType.CONTEXT_FOCUS, | 476 listen(this.adapter_, EventType.CONTEXT_FOCUS, this.onContextFocus_). |
| 451 this.onContextFocus_). | 477 listen(this.adapter_, EventType.CONTEXT_BLUR, this.onContextBlur_). |
| 452 listen(this.adapter_, | 478 listen(this.adapter_, EventType.VISIBILITY_CHANGE, |
| 453 i18n.input.chrome.inputview.events.EventType.CONTEXT_BLUR, | |
| 454 this.onContextBlur_). | |
| 455 listen(this.adapter_, | |
| 456 i18n.input.chrome.inputview.events.EventType.VISIBILITY_CHANGE, | |
| 457 this.onVisibilityChange_). | 479 this.onVisibilityChange_). |
| 458 listen(this.adapter_, | 480 listen(this.adapter_, EventType.SETTINGS_READY, this.onSettingsReady_). |
| 459 i18n.input.chrome.inputview.events.EventType.SETTINGS_READY, | |
| 460 this.onSettingsReady_). | |
| 461 listen(this.adapter_, Type.UPDATE_SETTINGS, this.onUpdateSettings_). | 481 listen(this.adapter_, Type.UPDATE_SETTINGS, this.onUpdateSettings_). |
| 462 listen(this.adapter_, Type.FRONT_TOGGLE_LANGUAGE_STATE, | 482 listen(this.adapter_, Type.FRONT_TOGGLE_LANGUAGE_STATE, |
| 463 this.onUpdateToggleLanguateState_). | 483 this.onUpdateToggleLanguateState_). |
| 464 listen(this.adapter_, Type.VOICE_STATE_CHANGE, this.onVoiceStateChange_); | 484 listen(this.adapter_, Type.VOICE_STATE_CHANGE, this.onVoiceStateChange_). |
| 485 listen(this.adapter_, EventType.REFRESH, this.onRefresh_); |
| 465 }; | 486 }; |
| 466 | 487 |
| 467 | 488 |
| 468 /** | 489 /** |
| 469 * Handler for voice module state change. | 490 * Handler for voice module state change. |
| 470 * | 491 * |
| 471 * @param {!i18n.input.chrome.message.Event} e . | 492 * @param {!i18n.input.chrome.message.Event} e . |
| 472 * @private | 493 * @private |
| 473 */ | 494 */ |
| 474 Controller.prototype.onVoiceStateChange_ = function(e) { | 495 Controller.prototype.onVoiceStateChange_ = function(e) { |
| 475 var elem = this.container_.getElement(); | 496 var elem = this.container_.getElement(); |
| 476 if (!e.msg[Name.VOICE_STATE]) { | 497 if (!e.msg[Name.VOICE_STATE]) { |
| 477 this.container_.candidateView.switchToIcon( | 498 this.container_.candidateView.switchToIcon( |
| 478 CandidateView.IconType.VOICE, true); | 499 CandidateView.IconType.VOICE, true); |
| 479 this.container_.voiceView.stop(); | 500 this.container_.voiceView.stop(); |
| 480 } | 501 } |
| 481 }; | 502 }; |
| 482 | 503 |
| 483 | 504 |
| 484 /** | 505 /** |
| 506 * Handles the refresh event from adapter. |
| 507 * |
| 508 * @private |
| 509 */ |
| 510 Controller.prototype.onRefresh_ = function() { |
| 511 window.location.reload(); |
| 512 }; |
| 513 |
| 514 |
| 515 /** |
| 485 * Sets the default keyset for context types. | 516 * Sets the default keyset for context types. |
| 486 * | 517 * |
| 487 * @param {string} newKeyset . | 518 * @param {string} newKeyset . |
| 488 * @private | 519 * @private |
| 489 */ | 520 */ |
| 490 Controller.prototype.setDefaultKeyset_ = function(newKeyset) { | 521 Controller.prototype.setDefaultKeyset_ = function(newKeyset) { |
| 491 var keysetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_]; | 522 var keysetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_]; |
| 492 for (var context in keysetMap) { | 523 for (var context in keysetMap) { |
| 493 if (context != ContextType.DEFAULT && | 524 if (context != ContextType.DEFAULT && |
| 494 keysetMap[context] == keysetMap[ContextType.DEFAULT]) { | 525 keysetMap[context] == keysetMap[ContextType.DEFAULT]) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 settings.soundOnKeypress = e.msg['soundOnKeypress']; | 560 settings.soundOnKeypress = e.msg['soundOnKeypress']; |
| 530 this.soundController_.setEnabled(settings.soundOnKeypress); | 561 this.soundController_.setEnabled(settings.soundOnKeypress); |
| 531 } | 562 } |
| 532 this.perfTracker_.tick(PerfTracker.TickName.BACKGROUND_SETTINGS_FETCHED); | 563 this.perfTracker_.tick(PerfTracker.TickName.BACKGROUND_SETTINGS_FETCHED); |
| 533 this.model_.stateManager.contextType = this.adapter_.contextType; | 564 this.model_.stateManager.contextType = this.adapter_.contextType; |
| 534 this.maybeCreateViews_(); | 565 this.maybeCreateViews_(); |
| 535 }; | 566 }; |
| 536 | 567 |
| 537 | 568 |
| 538 /** | 569 /** |
| 570 * Callback for url changed. |
| 571 * |
| 572 * @private |
| 573 */ |
| 574 Controller.prototype.onURLChanged_ = function() { |
| 575 this.container_.candidateView.setToolbarVisible(this.shouldShowToolBar_()); |
| 576 }; |
| 577 |
| 578 |
| 579 /** |
| 539 * Callback for setting ready. | 580 * Callback for setting ready. |
| 540 * | 581 * |
| 541 * @private | 582 * @private |
| 542 */ | 583 */ |
| 543 Controller.prototype.onSettingsReady_ = function() { | 584 Controller.prototype.onSettingsReady_ = function() { |
| 544 if (this.isSettingReady) { | 585 if (this.isSettingReady) { |
| 545 return; | 586 return; |
| 546 } | 587 } |
| 547 | 588 |
| 548 this.isSettingReady = true; | 589 this.isSettingReady = true; |
| 549 var keysetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_]; | 590 var keysetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_]; |
| 550 var newKeyset = ''; | 591 var newKeyset = ''; |
| 551 if (this.adapter_.isA11yMode) { | 592 if (this.adapter_.isA11yMode) { |
| 552 newKeyset = util.getConfigName(keysetMap[ContextType.DEFAULT]); | 593 newKeyset = util.getConfigName(keysetMap[ContextType.DEFAULT]); |
| 553 } else { | 594 } else { |
| 554 newKeyset = /** @type {string} */ (this.model_.settings. | 595 newKeyset = /** @type {string} */ (this.model_.settings. |
| 555 getPreference(util.getConfigName(keysetMap[ContextType.DEFAULT]))); | 596 getPreference(util.getConfigName(keysetMap[ContextType.DEFAULT]))); |
| 556 } | 597 } |
| 557 if (!this.adapter_.isExperimental && keysetMap[ContextType.DEFAULT] == | 598 if (!this.adapter_.isExperimental && keysetMap[ContextType.DEFAULT] == |
| 558 'zhuyin.compact.qwerty') { | 599 'zhuyin.compact.qwerty') { |
| 559 newKeyset = 'zhuyin'; | 600 newKeyset = 'zhuyin'; |
| 560 } | 601 } |
| 561 if (newKeyset) { | 602 if (newKeyset) { |
| 562 this.setDefaultKeyset_(newKeyset); | 603 this.setDefaultKeyset_(newKeyset); |
| 563 } | 604 } |
| 605 this.container_.selectView.setVisible( |
| 606 this.adapter_.isGestureEdittingEnabled()); |
| 564 // Loads resources in case the default keyset is changed. | 607 // Loads resources in case the default keyset is changed. |
| 565 this.loadAllResources_(); | 608 this.loadAllResources_(); |
| 566 this.maybeCreateViews_(); | 609 this.maybeCreateViews_(); |
| 567 }; | 610 }; |
| 568 | 611 |
| 569 | 612 |
| 570 /** | 613 /** |
| 571 * Gets the data for spatial module. | 614 * Gets the data for spatial module. |
| 572 * | 615 * |
| 573 * @param {!content.SoftKey} key . | 616 * @param {!content.SoftKey} key . |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 * swipe event, the view would be the soft key which starts the swipe. | 731 * swipe event, the view would be the soft key which starts the swipe. |
| 689 * @param {!i18n.input.chrome.inputview.events.SwipeEvent} e The swipe event. | 732 * @param {!i18n.input.chrome.inputview.events.SwipeEvent} e The swipe event. |
| 690 * @private | 733 * @private |
| 691 */ | 734 */ |
| 692 Controller.prototype.handleSwipeAction_ = function(view, e) { | 735 Controller.prototype.handleSwipeAction_ = function(view, e) { |
| 693 var direction = e.direction; | 736 var direction = e.direction; |
| 694 if (this.container_.altDataView.isVisible()) { | 737 if (this.container_.altDataView.isVisible()) { |
| 695 this.container_.altDataView.highlightItem(e.x, e.y); | 738 this.container_.altDataView.highlightItem(e.x, e.y); |
| 696 return; | 739 return; |
| 697 } | 740 } |
| 741 if (view.type == ElementType.BACKSPACE_KEY) { |
| 742 if (this.container_.swipeView.isVisible() || |
| 743 this.container_.swipeView.isArmed()) { |
| 744 this.stopBackspaceAutoRepeat_(); |
| 745 return; |
| 746 } |
| 747 } |
| 698 | 748 |
| 699 if (view.type == ElementType.CHARACTER_KEY) { | 749 if (view.type == ElementType.CHARACTER_KEY) { |
| 700 view = /** @type {!content.CharacterKey} */ (view); | 750 view = /** @type {!content.CharacterKey} */ (view); |
| 701 if (direction & i18n.input.chrome.inputview.SwipeDirection.UP || | 751 if (direction & i18n.input.chrome.inputview.SwipeDirection.UP || |
| 702 direction & i18n.input.chrome.inputview.SwipeDirection.DOWN) { | 752 direction & i18n.input.chrome.inputview.SwipeDirection.DOWN) { |
| 703 var ch = view.getCharacterByGesture(!!(direction & | 753 var ch = view.getCharacterByGesture(!!(direction & |
| 704 i18n.input.chrome.inputview.SwipeDirection.UP)); | 754 i18n.input.chrome.inputview.SwipeDirection.UP)); |
| 705 if (ch) { | 755 if (ch) { |
| 706 view.flickerredCharacter = ch; | 756 view.flickerredCharacter = ch; |
| 707 } | 757 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . | 823 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . |
| 774 * @private | 824 * @private |
| 775 */ | 825 */ |
| 776 Controller.prototype.handlePointerAction_ = function(view, e) { | 826 Controller.prototype.handlePointerAction_ = function(view, e) { |
| 777 // Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar. | 827 // Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar. |
| 778 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) { | 828 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) { |
| 779 this.recordStatsForClosing_( | 829 this.recordStatsForClosing_( |
| 780 'InputMethod.VirtualKeyboard.TapCount', 1, 4095, 4096); | 830 'InputMethod.VirtualKeyboard.TapCount', 1, 4095, 4096); |
| 781 } | 831 } |
| 782 | 832 |
| 783 if (e.type == i18n.input.chrome.inputview.events.EventType.SWIPE) { | 833 if (e.type == EventType.SWIPE) { |
| 784 e = /** @type {!i18n.input.chrome.inputview.events.SwipeEvent} */ (e); | 834 e = /** @type {!i18n.input.chrome.inputview.events.SwipeEvent} */ (e); |
| 785 this.handleSwipeAction_(view, e); | 835 this.handleSwipeAction_(view, e); |
| 786 } | 836 } |
| 787 switch (view.type) { | 837 switch (view.type) { |
| 788 case ElementType.BACK_BUTTON: | 838 case ElementType.BACK_BUTTON: |
| 839 case ElementType.BACK_TO_KEYBOARD: |
| 789 if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) { | 840 if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) { |
| 790 view.setHighlighted(false); | 841 view.setHighlighted(false); |
| 791 } else if (e.type == EventType.POINTER_DOWN || | 842 } else if (e.type == EventType.POINTER_DOWN || |
| 792 e.type == EventType.POINTER_OVER) { | 843 e.type == EventType.POINTER_OVER) { |
| 793 view.setHighlighted(true); | 844 view.setHighlighted(true); |
| 794 } | 845 } |
| 795 if (e.type == EventType.POINTER_UP) { | 846 if (e.type == EventType.POINTER_UP) { |
| 796 this.switchToKeyset(this.container_.currentKeysetView.fromKeyset); | 847 this.switchToKeyset(this.container_.currentKeysetView.fromKeyset); |
| 797 this.clearCandidates_(); | 848 this.clearCandidates_(); |
| 798 this.soundController_.onKeyUp(view.type); | 849 this.soundController_.onKeyUp(view.type); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 return; | 941 return; |
| 891 | 942 |
| 892 case ElementType.VOICE_PRIVACY_GOT_IT: | 943 case ElementType.VOICE_PRIVACY_GOT_IT: |
| 893 // Broadcasts the voice privacy confirmed message to let voice | 944 // Broadcasts the voice privacy confirmed message to let voice |
| 894 // view handle it. | 945 // view handle it. |
| 895 this.adapter_.dispatchEvent(new goog.events.Event( | 946 this.adapter_.dispatchEvent(new goog.events.Event( |
| 896 Type.VOICE_PRIVACY_GOT_IT)); | 947 Type.VOICE_PRIVACY_GOT_IT)); |
| 897 return; | 948 return; |
| 898 | 949 |
| 899 case ElementType.VOICE_BTN: | 950 case ElementType.VOICE_BTN: |
| 900 if (e.type == EventType.CLICK) { | 951 if (e.type == EventType.POINTER_UP) { |
| 901 this.container_.candidateView.switchToIcon( | 952 this.container_.candidateView.switchToIcon( |
| 902 CandidateView.IconType.VOICE, false); | 953 CandidateView.IconType.VOICE, false); |
| 903 this.container_.voiceView.start(); | 954 this.container_.voiceView.start(); |
| 904 } | 955 } |
| 905 return; | 956 return; |
| 906 | 957 |
| 907 | 958 |
| 908 case ElementType.VOICE_VIEW: | 959 case ElementType.VOICE_VIEW: |
| 909 if (e.type == EventType.POINTER_UP) { | 960 if (e.type == EventType.POINTER_UP) { |
| 910 this.adapter_.sendVoiceViewStateChange(false); | 961 this.adapter_.sendVoiceViewStateChange(false); |
| 911 this.container_.candidateView.switchToIcon( | 962 this.container_.candidateView.switchToIcon( |
| 912 CandidateView.IconType.VOICE, true); | 963 CandidateView.IconType.VOICE, true); |
| 913 this.container_.voiceView.stop(); | 964 this.container_.voiceView.stop(); |
| 914 } | 965 } |
| 915 return; | 966 return; |
| 916 | 967 case ElementType.SWIPE_VIEW: |
| 968 this.stopBackspaceAutoRepeat_(); |
| 969 if (e.type == EventType.POINTER_UP || |
| 970 e.type == EventType.POINTER_OUT) { |
| 971 this.clearUnstickyState_(); |
| 972 } |
| 973 return; |
| 974 case ElementType.CUT: |
| 975 case ElementType.COPY: |
| 976 case ElementType.PASTE: |
| 977 case ElementType.BOLD: |
| 978 case ElementType.ITALICS: |
| 979 case ElementType.UNDERLINE: |
| 980 case ElementType.REDO: |
| 981 case ElementType.UNDO: |
| 982 case ElementType.SELECT_ALL: |
| 983 view.setHighlighted(e.type == EventType.POINTER_DOWN || |
| 984 e.type == EventType.POINTER_OVER); |
| 985 if (e.type == EventType.POINTER_UP) { |
| 986 this.adapter_.sendKeyDownAndUpEvent( |
| 987 '', this.elementTypeToKeyCode_[view.type], undefined, undefined, { |
| 988 ctrl: true, |
| 989 alt: false, |
| 990 shift: false |
| 991 }); |
| 992 } |
| 993 return; |
| 917 case ElementType.SOFT_KEY_VIEW: | 994 case ElementType.SOFT_KEY_VIEW: |
| 918 // Delegates the events on the soft key view to its soft key. | 995 // Delegates the events on the soft key view to its soft key. |
| 919 view = /** @type {!i18n.input.chrome.inputview.elements.layout. | 996 view = /** @type {!i18n.input.chrome.inputview.elements.layout. |
| 920 SoftKeyView} */ (view); | 997 SoftKeyView} */ (view); |
| 921 if (!view.softKey) { | 998 if (!view.softKey) { |
| 922 return; | 999 return; |
| 923 } | 1000 } |
| 924 view = view.softKey; | 1001 view = view.softKey; |
| 925 } | 1002 } |
| 926 | 1003 |
| 927 if (view.type != ElementType.MODIFIER_KEY && | 1004 if (view.type != ElementType.MODIFIER_KEY && |
| 928 !this.container_.altDataView.isVisible() && | 1005 !this.container_.altDataView.isVisible() && |
| 929 !this.container_.menuView.isVisible()) { | 1006 !this.container_.menuView.isVisible() && |
| 1007 !this.container_.swipeView.isVisible()) { |
| 930 // The highlight of the modifier key is depending on the state instead | 1008 // The highlight of the modifier key is depending on the state instead |
| 931 // of the key down or up. | 1009 // of the key down or up. |
| 932 if (e.type == EventType.POINTER_OVER || e.type == EventType.POINTER_DOWN || | 1010 if (e.type == EventType.POINTER_OVER || e.type == EventType.POINTER_DOWN || |
| 933 e.type == EventType.DOUBLE_CLICK) { | 1011 e.type == EventType.DOUBLE_CLICK) { |
| 934 view.setHighlighted(true); | 1012 view.setHighlighted(true); |
| 935 } else if (e.type == EventType.POINTER_OUT || | 1013 } else if (e.type == EventType.POINTER_OUT || |
| 936 e.type == EventType.POINTER_UP || | 1014 e.type == EventType.POINTER_UP || |
| 937 e.type == EventType.DOUBLE_CLICK_END) { | 1015 e.type == EventType.DOUBLE_CLICK_END) { |
| 938 view.setHighlighted(false); | 1016 view.setHighlighted(false); |
| 939 } | 1017 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 } | 1083 } |
| 1006 } | 1084 } |
| 1007 break; | 1085 break; |
| 1008 | 1086 |
| 1009 case ElementType.BACKSPACE_KEY: | 1087 case ElementType.BACKSPACE_KEY: |
| 1010 key = /** @type {!content.FunctionalKey} */ (softKey); | 1088 key = /** @type {!content.FunctionalKey} */ (softKey); |
| 1011 if (e.type == EventType.POINTER_DOWN) { | 1089 if (e.type == EventType.POINTER_DOWN) { |
| 1012 this.backspaceTick_(); | 1090 this.backspaceTick_(); |
| 1013 } else if (e.type == EventType.POINTER_UP || e.type == EventType. | 1091 } else if (e.type == EventType.POINTER_UP || e.type == EventType. |
| 1014 POINTER_OUT) { | 1092 POINTER_OUT) { |
| 1015 this.stopBackspaceAutoRepeat_(); | 1093 if (!this.container_.swipeView.isVisible()) { |
| 1016 this.adapter_.sendKeyUpEvent('\u0008', KeyCodes.BACKSPACE); | 1094 this.stopBackspaceAutoRepeat_(); |
| 1095 } |
| 1017 } | 1096 } |
| 1018 break; | 1097 break; |
| 1019 | 1098 |
| 1020 case ElementType.TAB_KEY: | 1099 case ElementType.TAB_KEY: |
| 1021 key = /** @type {!content.FunctionalKey} */ (softKey); | 1100 key = /** @type {!content.FunctionalKey} */ (softKey); |
| 1022 if (e.type == EventType.POINTER_DOWN) { | 1101 if (e.type == EventType.POINTER_DOWN) { |
| 1023 this.adapter_.sendKeyDownEvent('\u0009', KeyCodes.TAB); | 1102 this.adapter_.sendKeyDownEvent('\u0009', KeyCodes.TAB); |
| 1024 } else if (e.type == EventType.POINTER_UP) { | 1103 } else if (e.type == EventType.POINTER_UP) { |
| 1025 this.adapter_.sendKeyUpEvent('\u0009', KeyCodes.TAB); | 1104 this.adapter_.sendKeyUpEvent('\u0009', KeyCodes.TAB); |
| 1026 } | 1105 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 if (e.type == EventType.POINTER_UP) { | 1147 if (e.type == EventType.POINTER_UP) { |
| 1069 key = /** @type {!content.EnSwitcherKey} */ (softKey); | 1148 key = /** @type {!content.EnSwitcherKey} */ (softKey); |
| 1070 this.adapter_.toggleLanguageState(this.model_.stateManager.isEnMode); | 1149 this.adapter_.toggleLanguageState(this.model_.stateManager.isEnMode); |
| 1071 this.model_.stateManager.isEnMode = !this.model_.stateManager.isEnMode; | 1150 this.model_.stateManager.isEnMode = !this.model_.stateManager.isEnMode; |
| 1072 key.update(); | 1151 key.update(); |
| 1073 } | 1152 } |
| 1074 break; | 1153 break; |
| 1075 case ElementType.SPACE_KEY: | 1154 case ElementType.SPACE_KEY: |
| 1076 key = /** @type {!content.SpaceKey} */ (softKey); | 1155 key = /** @type {!content.SpaceKey} */ (softKey); |
| 1077 var doubleSpacePeriod = this.model_.settings.doubleSpacePeriod && | 1156 var doubleSpacePeriod = this.model_.settings.doubleSpacePeriod && |
| 1078 this.currentKeyset_ != Controller.HANDWRITING_VIEW_CODE_; | 1157 this.currentKeyset_ != Controller.HANDWRITING_VIEW_CODE_ && |
| 1158 this.currentKeyset_ != Controller.EMOJI_VIEW_CODE_; |
| 1079 if (e.type == EventType.POINTER_UP || (!doubleSpacePeriod && e.type == | 1159 if (e.type == EventType.POINTER_UP || (!doubleSpacePeriod && e.type == |
| 1080 EventType.DOUBLE_CLICK_END)) { | 1160 EventType.DOUBLE_CLICK_END)) { |
| 1081 this.adapter_.sendKeyDownAndUpEvent(key.getCharacter(), | 1161 this.adapter_.sendKeyDownAndUpEvent(key.getCharacter(), |
| 1082 KeyCodes.SPACE); | 1162 KeyCodes.SPACE); |
| 1083 this.clearUnstickyState_(); | 1163 this.clearUnstickyState_(); |
| 1084 } else if (e.type == EventType.DOUBLE_CLICK && doubleSpacePeriod) { | 1164 } else if (e.type == EventType.DOUBLE_CLICK && doubleSpacePeriod) { |
| 1085 this.adapter_.doubleClickOnSpaceKey(); | 1165 this.adapter_.doubleClickOnSpaceKey(); |
| 1086 } | 1166 } |
| 1087 break; | 1167 break; |
| 1088 | 1168 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 Controller.prototype.resetAll_ = function() { | 1359 Controller.prototype.resetAll_ = function() { |
| 1280 this.clearCandidates_(); | 1360 this.clearCandidates_(); |
| 1281 this.container_.cleanStroke(); | 1361 this.container_.cleanStroke(); |
| 1282 this.model_.stateManager.reset(); | 1362 this.model_.stateManager.reset(); |
| 1283 this.container_.update(); | 1363 this.container_.update(); |
| 1284 this.updateContextModifierState_(); | 1364 this.updateContextModifierState_(); |
| 1285 this.deadKey_ = ''; | 1365 this.deadKey_ = ''; |
| 1286 this.resize(); | 1366 this.resize(); |
| 1287 this.container_.expandedCandidateView.close(); | 1367 this.container_.expandedCandidateView.close(); |
| 1288 this.container_.menuView.hide(); | 1368 this.container_.menuView.hide(); |
| 1369 this.container_.swipeView.reset(); |
| 1289 this.container_.altDataView.hide(); | 1370 this.container_.altDataView.hide(); |
| 1290 }; | 1371 }; |
| 1291 | 1372 |
| 1292 | 1373 |
| 1293 /** | 1374 /** |
| 1375 * Returns whether the toolbar should be shown. |
| 1376 * |
| 1377 * @return {boolean} |
| 1378 * @private |
| 1379 */ |
| 1380 Controller.prototype.shouldShowToolBar_ = function() { |
| 1381 return this.adapter_.isExperimental && this.adapter_.isGoogleDocument() && |
| 1382 this.adapter_.contextType == ContextType.DEFAULT; |
| 1383 }; |
| 1384 |
| 1385 |
| 1386 /** |
| 1294 * Callback when the context is changed. | 1387 * Callback when the context is changed. |
| 1295 * | 1388 * |
| 1296 * @private | 1389 * @private |
| 1297 */ | 1390 */ |
| 1298 Controller.prototype.onContextFocus_ = function() { | 1391 Controller.prototype.onContextFocus_ = function() { |
| 1299 this.resetAll_(); | 1392 this.resetAll_(); |
| 1300 this.model_.stateManager.contextType = this.adapter_.contextType; | 1393 this.model_.stateManager.contextType = this.adapter_.contextType; |
| 1301 this.switchToKeyset(this.getActiveKeyset_()); | 1394 this.switchToKeyset(this.getActiveKeyset_()); |
| 1302 }; | 1395 }; |
| 1303 | 1396 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 */ | 1587 */ |
| 1495 Controller.prototype.clearCandidates_ = function() { | 1588 Controller.prototype.clearCandidates_ = function() { |
| 1496 this.candidatesInfo_ = i18n.input.chrome.inputview.CandidatesInfo.getEmpty(); | 1589 this.candidatesInfo_ = i18n.input.chrome.inputview.CandidatesInfo.getEmpty(); |
| 1497 this.container_.candidateView.clearCandidates(); | 1590 this.container_.candidateView.clearCandidates(); |
| 1498 this.container_.expandedCandidateView.close(); | 1591 this.container_.expandedCandidateView.close(); |
| 1499 this.container_.expandedCandidateView.state = ExpandedCandidateView.State. | 1592 this.container_.expandedCandidateView.state = ExpandedCandidateView.State. |
| 1500 NONE; | 1593 NONE; |
| 1501 if (this.container_.currentKeysetView) { | 1594 if (this.container_.currentKeysetView) { |
| 1502 this.container_.currentKeysetView.setVisible(true); | 1595 this.container_.currentKeysetView.setVisible(true); |
| 1503 } | 1596 } |
| 1504 if (this.currentKeyset_ == Controller.HANDWRITING_VIEW_CODE_) { | 1597 if (!this.adapter_.isQPInputView) { |
| 1505 this.container_.candidateView.switchToIcon( | 1598 if (this.currentKeyset_ == Controller.HANDWRITING_VIEW_CODE_ || |
| 1506 CandidateView.IconType.BACK, true); | 1599 this.currentKeyset_ == Controller.EMOJI_VIEW_CODE_) { |
| 1507 } else { | 1600 this.container_.candidateView.switchToIcon( |
| 1508 this.container_.candidateView.switchToIcon(CandidateView.IconType.VOICE, | 1601 CandidateView.IconType.BACK, true); |
| 1509 this.currentKeyset_ != Controller.EMOJI_VIEW_CODE_ && | 1602 } else { |
| 1510 this.adapter_.isExperimental); | 1603 this.container_.candidateView.switchToIcon(CandidateView.IconType.VOICE, |
| 1604 this.adapter_.isVoiceInputEnabled); |
| 1605 } |
| 1511 } | 1606 } |
| 1512 }; | 1607 }; |
| 1513 | 1608 |
| 1514 | 1609 |
| 1515 /** | 1610 /** |
| 1516 * Callback when the layout is loaded. | 1611 * Callback when the layout is loaded. |
| 1517 * | 1612 * |
| 1518 * @param {!i18n.input.chrome.inputview.events.LayoutLoadedEvent} e The event. | 1613 * @param {!i18n.input.chrome.inputview.events.LayoutLoadedEvent} e The event. |
| 1519 * @private | 1614 * @private |
| 1520 */ | 1615 */ |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 this.statistics_.recordLayout(keyset, this.adapter_.isA11yMode); | 1724 this.statistics_.recordLayout(keyset, this.adapter_.isA11yMode); |
| 1630 this.perfTracker_.tick(PerfTracker.TickName.KEYBOARD_SHOWN); | 1725 this.perfTracker_.tick(PerfTracker.TickName.KEYBOARD_SHOWN); |
| 1631 this.perfTracker_.stop(); | 1726 this.perfTracker_.stop(); |
| 1632 } else { | 1727 } else { |
| 1633 // Sets the current keyset for delay switching. | 1728 // Sets the current keyset for delay switching. |
| 1634 this.currentKeyset_ = keyset; | 1729 this.currentKeyset_ = keyset; |
| 1635 if (keyset != Controller.EMOJI_VIEW_CODE_) { // Emoji is temp keyset. | 1730 if (keyset != Controller.EMOJI_VIEW_CODE_) { // Emoji is temp keyset. |
| 1636 this.contextTypeToKeysetMap_[this.currentInputMethod_][contextType] = | 1731 this.contextTypeToKeysetMap_[this.currentInputMethod_][contextType] = |
| 1637 keyset; | 1732 keyset; |
| 1638 } | 1733 } |
| 1639 this.loadResource_(keyset); | 1734 if (this.adapter_.isQPInputView && |
| 1735 goog.array.contains(Controller.MATERIAL_KEYSETS_, keyset)) { |
| 1736 this.loadResource_('m-' + keyset); |
| 1737 } else { |
| 1738 this.loadResource_(keyset); |
| 1739 } |
| 1640 } | 1740 } |
| 1641 }; | 1741 }; |
| 1642 | 1742 |
| 1643 | 1743 |
| 1644 /** | 1744 /** |
| 1645 * Callback when the configuration is loaded. | 1745 * Callback when the configuration is loaded. |
| 1646 * | 1746 * |
| 1647 * @param {!i18n.input.chrome.inputview.events.ConfigLoadedEvent} e The event. | 1747 * @param {!i18n.input.chrome.inputview.events.ConfigLoadedEvent} e The event. |
| 1648 * @private | 1748 * @private |
| 1649 */ | 1749 */ |
| 1650 Controller.prototype.onConfigLoaded_ = function(e) { | 1750 Controller.prototype.onConfigLoaded_ = function(e) { |
| 1651 if (this.isDisposed()) { | 1751 if (this.isDisposed()) { |
| 1652 return; | 1752 return; |
| 1653 } | 1753 } |
| 1654 var data = e.data; | 1754 var data = e.data; |
| 1655 var keyboardCode = data[i18n.input.chrome.inputview.SpecNodeName.ID]; | 1755 var keyboardCode = data[i18n.input.chrome.inputview.SpecNodeName.ID]; |
| 1656 this.keysetDataMap_[keyboardCode] = data; | 1756 this.keysetDataMap_[keyboardCode] = data; |
| 1657 this.perfTracker_.tick(PerfTracker.TickName.KEYSET_LOADED); | 1757 this.perfTracker_.tick(PerfTracker.TickName.KEYSET_LOADED); |
| 1658 var context = data[i18n.input.chrome.inputview.SpecNodeName.ON_CONTEXT]; | 1758 var context = data[i18n.input.chrome.inputview.SpecNodeName.ON_CONTEXT]; |
| 1659 if (context && !this.adapter_.isA11yMode) { | 1759 if (context && !this.adapter_.isA11yMode) { |
| 1660 var keySetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_]; | 1760 var keySetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_]; |
| 1661 if (!keySetMap) { | 1761 if (!keySetMap) { |
| 1662 keySetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_] = {}; | 1762 keySetMap = this.contextTypeToKeysetMap_[this.currentInputMethod_] = {}; |
| 1663 } | 1763 } |
| 1664 keySetMap[context] = keyboardCode; | 1764 keySetMap[context] = keyboardCode; |
| 1665 } | 1765 } |
| 1666 | 1766 |
| 1667 var layoutId = data[i18n.input.chrome.inputview.SpecNodeName.LAYOUT]; | 1767 var layoutId = data[i18n.input.chrome.inputview.SpecNodeName.LAYOUT]; |
| 1668 if (this.adapter_.isQPInputView && layoutId == 'compactkbd-qwerty') { | 1768 if (this.adapter_.isQPInputView) { |
| 1669 layoutId = 'm-' + layoutId; | 1769 layoutId = 'm-' + layoutId; |
| 1670 data[i18n.input.chrome.inputview.SpecNodeName.LAYOUT] = layoutId; | 1770 data[i18n.input.chrome.inputview.SpecNodeName.LAYOUT] = layoutId; |
| 1671 } | 1771 } |
| 1672 var layoutData = this.layoutDataMap_[layoutId]; | 1772 var layoutData = this.layoutDataMap_[layoutId]; |
| 1673 if (layoutData) { | 1773 if (layoutData) { |
| 1674 this.maybeCreateViews_(); | 1774 this.maybeCreateViews_(); |
| 1675 } else { | 1775 } else { |
| 1676 this.model_.loadLayout(layoutId); | 1776 this.model_.loadLayout(layoutId); |
| 1677 } | 1777 } |
| 1678 }; | 1778 }; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 if (window.innerHeight != height && !opt_ignoreWindowResize) { | 1826 if (window.innerHeight != height && !opt_ignoreWindowResize) { |
| 1727 if (this.lastResizeHeight_ != height) { | 1827 if (this.lastResizeHeight_ != height) { |
| 1728 this.lastResizeHeight_ = height; | 1828 this.lastResizeHeight_ = height; |
| 1729 window.resizeTo(screen.width, height); | 1829 window.resizeTo(screen.width, height); |
| 1730 } | 1830 } |
| 1731 return; | 1831 return; |
| 1732 } | 1832 } |
| 1733 | 1833 |
| 1734 this.container_.resize(screen.width, height, widthPercent, | 1834 this.container_.resize(screen.width, height, widthPercent, |
| 1735 candidateViewHeight); | 1835 candidateViewHeight); |
| 1836 this.container_.candidateView.setToolbarVisible(this.shouldShowToolBar_()); |
| 1736 if (this.container_.currentKeysetView) { | 1837 if (this.container_.currentKeysetView) { |
| 1737 this.isKeyboardReady = true; | 1838 this.isKeyboardReady = true; |
| 1738 } | 1839 } |
| 1739 }; | 1840 }; |
| 1740 | 1841 |
| 1741 | 1842 |
| 1742 /** | 1843 /** |
| 1743 * Loads the resources, for currentKeyset, passwdKeyset, handwriting, | 1844 * Loads the resources, for currentKeyset, passwdKeyset, handwriting, |
| 1744 * emoji, etc. | 1845 * emoji, etc. |
| 1745 * | 1846 * |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 toKeyset = this.currentKeyset_.replace('compact', 'en.compact'); | 2085 toKeyset = this.currentKeyset_.replace('compact', 'en.compact'); |
| 1985 } | 2086 } |
| 1986 } | 2087 } |
| 1987 if (toKeyset) { | 2088 if (toKeyset) { |
| 1988 this.resetAll_(); | 2089 this.resetAll_(); |
| 1989 this.switchToKeyset(toKeyset); | 2090 this.switchToKeyset(toKeyset); |
| 1990 } | 2091 } |
| 1991 } | 2092 } |
| 1992 }; | 2093 }; |
| 1993 }); // goog.scope | 2094 }); // goog.scope |
| OLD | NEW |