| 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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 goog.require('i18n.input.chrome.message.Event'); | 31 goog.require('i18n.input.chrome.message.Event'); |
| 32 goog.require('i18n.input.chrome.message.Name'); | 32 goog.require('i18n.input.chrome.message.Name'); |
| 33 goog.require('i18n.input.chrome.message.Type'); | 33 goog.require('i18n.input.chrome.message.Type'); |
| 34 | 34 |
| 35 goog.scope(function() { | 35 goog.scope(function() { |
| 36 var CandidatesBackEvent = i18n.input.chrome.DataSource.CandidatesBackEvent; | 36 var CandidatesBackEvent = i18n.input.chrome.DataSource.CandidatesBackEvent; |
| 37 var ContextType = i18n.input.chrome.message.ContextType; | 37 var ContextType = i18n.input.chrome.message.ContextType; |
| 38 var FeatureTracker = i18n.input.chrome.inputview.FeatureTracker; | 38 var FeatureTracker = i18n.input.chrome.inputview.FeatureTracker; |
| 39 var FeatureName = i18n.input.chrome.inputview.FeatureName; | 39 var FeatureName = i18n.input.chrome.inputview.FeatureName; |
| 40 var Name = i18n.input.chrome.message.Name; | 40 var Name = i18n.input.chrome.message.Name; |
| 41 var SizeSpec = i18n.input.chrome.inputview.SizeSpec; | |
| 42 var Type = i18n.input.chrome.message.Type; | 41 var Type = i18n.input.chrome.message.Type; |
| 43 | 42 |
| 44 | 43 |
| 45 | 44 |
| 46 /** | 45 /** |
| 47 * The adapter for interview. | 46 * The adapter for interview. |
| 48 * | 47 * |
| 49 * @param {!i18n.input.chrome.inputview.ReadyState} readyState . | 48 * @param {!i18n.input.chrome.inputview.ReadyState} readyState . |
| 50 * @extends {goog.events.EventTarget} | 49 * @extends {goog.events.EventTarget} |
| 51 * @constructor | 50 * @constructor |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 * True to enable gesture deletion. | 361 * True to enable gesture deletion. |
| 363 * | 362 * |
| 364 * @return {boolean} | 363 * @return {boolean} |
| 365 */ | 364 */ |
| 366 Adapter.prototype.isGestureDeletionEnabled = function() { | 365 Adapter.prototype.isGestureDeletionEnabled = function() { |
| 367 // TODO: Omni bar sends wrong anchor/focus when autocompleting | 366 // TODO: Omni bar sends wrong anchor/focus when autocompleting |
| 368 // URLs. Re-enable when that is fixed. | 367 // URLs. Re-enable when that is fixed. |
| 369 if (this.contextType == ContextType.URL) { | 368 if (this.contextType == ContextType.URL) { |
| 370 return false; | 369 return false; |
| 371 } | 370 } |
| 372 return this.features.isEnabled(FeatureName.GESTURE_EDITTING); | 371 return this.features.isEnabled(FeatureName.GESTURE_DELETION); |
| 373 }; | 372 }; |
| 374 | 373 |
| 375 | 374 |
| 376 /** | 375 /** |
| 377 * True to enable gesture typing. | 376 * True to enable gesture typing. |
| 378 * | 377 * |
| 379 * @return {boolean} | 378 * @return {boolean} |
| 380 */ | 379 */ |
| 381 Adapter.prototype.isGestureTypingEnabled = function() { | 380 Adapter.prototype.isGestureTypingEnabled = function() { |
| 382 return this.features.isEnabled(FeatureName.GESTURE_TYPING); | 381 return this.features.isEnabled(FeatureName.GESTURE_TYPING); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 396 | 395 |
| 397 | 396 |
| 398 /** | 397 /** |
| 399 * Asynchronously queries the current site. | 398 * Asynchronously queries the current site. |
| 400 */ | 399 */ |
| 401 Adapter.prototype.queryCurrentSite = function() { | 400 Adapter.prototype.queryCurrentSite = function() { |
| 402 var adapter = this; | 401 var adapter = this; |
| 403 var criteria = {'active': true, 'lastFocusedWindow': true}; | 402 var criteria = {'active': true, 'lastFocusedWindow': true}; |
| 404 if (chrome && chrome.tabs) { | 403 if (chrome && chrome.tabs) { |
| 405 chrome.tabs.query(criteria, function(tabs) { | 404 chrome.tabs.query(criteria, function(tabs) { |
| 406 tabs[0] && adapter.setCurrentSite_(tabs[0].url); | 405 tabs[0] && adapter.setCurrentSite_(tabs[0].url); |
| 407 }); | 406 }); |
| 408 } | 407 } |
| 409 }; | 408 }; |
| 410 | 409 |
| 411 | 410 |
| 412 /** | 411 /** |
| 413 * Sets the current context URL. | 412 * Sets the current context URL. |
| 414 * | 413 * |
| 415 * @param {string} url . | 414 * @param {string} url . |
| 416 * @private | 415 * @private |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 this.maybeDispatchSettingsReadyEvent_(); | 496 this.maybeDispatchSettingsReadyEvent_(); |
| 498 }).bind(this)); | 497 }).bind(this)); |
| 499 inputview.getInputMethods((function(inputMethods) { | 498 inputview.getInputMethods((function(inputMethods) { |
| 500 // Only show globe key to switching between IMEs when there are more | 499 // Only show globe key to switching between IMEs when there are more |
| 501 // than one IME. | 500 // than one IME. |
| 502 this.showGlobeKey = inputMethods.length > 1; | 501 this.showGlobeKey = inputMethods.length > 1; |
| 503 this.readyState_.markStateReady(StateType.IME_LIST_READY); | 502 this.readyState_.markStateReady(StateType.IME_LIST_READY); |
| 504 this.maybeDispatchSettingsReadyEvent_(); | 503 this.maybeDispatchSettingsReadyEvent_(); |
| 505 }).bind(this)); | 504 }).bind(this)); |
| 506 inputview.getInputMethodConfig((function(config) { | 505 inputview.getInputMethodConfig((function(config) { |
| 507 this.isQPInputView = !!config['isNewQPInputViewEnabled']; | 506 this.isQPInputView = !!config['isNewQPInputViewEnabled'] || |
| 507 !!config['isNewMDInputViewEnabled']; |
| 508 var voiceEnabled = config['isVoiceInputEnabled']; | 508 var voiceEnabled = config['isVoiceInputEnabled']; |
| 509 if (goog.isDef(voiceEnabled)) { | 509 if (goog.isDef(voiceEnabled)) { |
| 510 this.isVoiceInputEnabled = !!voiceEnabled; | 510 this.isVoiceInputEnabled = !!voiceEnabled; |
| 511 } | 511 } |
| 512 i18n.input.chrome.inputview.GlobalFlags.isQPInputView = | 512 i18n.input.chrome.inputview.GlobalFlags.isQPInputView = |
| 513 this.isQPInputView; | 513 this.isQPInputView; |
| 514 this.readyState_.markStateReady(StateType.INPUT_METHOD_CONFIG_READY); | 514 this.readyState_.markStateReady(StateType.INPUT_METHOD_CONFIG_READY); |
| 515 this.maybeDispatchSettingsReadyEvent_(); | 515 this.maybeDispatchSettingsReadyEvent_(); |
| 516 }).bind(this)); | 516 }).bind(this)); |
| 517 } else { | 517 } else { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 * Unset the inputtool | 796 * Unset the inputtool |
| 797 */ | 797 */ |
| 798 Adapter.prototype.unsetController = function() { | 798 Adapter.prototype.unsetController = function() { |
| 799 chrome.runtime.sendMessage( | 799 chrome.runtime.sendMessage( |
| 800 goog.object.create( | 800 goog.object.create( |
| 801 Name.TYPE, | 801 Name.TYPE, |
| 802 Type.UNSET_CONTROLLER)); | 802 Type.UNSET_CONTROLLER)); |
| 803 }; | 803 }; |
| 804 }); // goog.scope | 804 }); // goog.scope |
| 805 | 805 |
| OLD | NEW |