| OLD | NEW |
| 1 // Copyright 2015 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2016 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.FeatureTracker'); | 14 goog.provide('i18n.input.chrome.FeatureTracker'); |
| 15 | 15 |
| 16 goog.require('goog.object'); | 16 goog.require('i18n.input.chrome.FeatureName'); |
| 17 goog.require('i18n.input.chrome.inputview.FeatureName'); | |
| 18 | 17 |
| 19 goog.scope(function() { | 18 goog.scope(function() { |
| 20 var FeatureName = i18n.input.chrome.inputview.FeatureName; | 19 var FeatureName = i18n.input.chrome.FeatureName; |
| 20 |
| 21 | 21 |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Controller for experimental features. | 24 * Controller for experimental features. |
| 25 * | 25 * |
| 26 * @constructor | 26 * @constructor |
| 27 */ | 27 */ |
| 28 i18n.input.chrome.inputview.FeatureTracker = function() { | 28 i18n.input.chrome.FeatureTracker = function() { |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Whether experimental flags is enabled. | 31 * Whether experimental flags is enabled. |
| 32 * | 32 * |
| 33 * @private {Object.<string, boolean>} | 33 * @private {Object.<string, boolean>} |
| 34 */ | 34 */ |
| 35 this.features_ = {}; | 35 this.features_ = {}; |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Features that are enabled by default. Any feature not on this list is | 38 * Features that are enabled by default. Any feature not on this list is |
| 39 * disabled unless the runtime --enable-inputview-{feature} flag is present. | 39 * disabled unless the runtime --enable-inputview-{feature} flag is present. |
| 40 * | 40 * |
| 41 * @const | 41 * @const |
| 42 * @private {!Array<FeatureName>} | 42 * @private {!Array<FeatureName>} |
| 43 */ | 43 */ |
| 44 this.ENABLED_BY_DEFAULT_ = []; | 44 this.ENABLED_BY_DEFAULT_ = []; |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Whether the features list is ready. | 47 * Whether the features list is ready. |
| 48 * | 48 * |
| 49 * @private {boolean} | 49 * @private {boolean} |
| 50 */ | 50 */ |
| 51 this.ready_ = false; | 51 this.ready_ = false; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 var FeatureTracker = i18n.input.chrome.inputview.FeatureTracker; | 54 var FeatureTracker = i18n.input.chrome.FeatureTracker; |
| 55 | 55 |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * Whether the feature is enabled. | 58 * Whether the feature is enabled. |
| 59 * | 59 * |
| 60 * @param {!FeatureName} feature . | 60 * @param {!FeatureName} feature . |
| 61 * @return {boolean} | 61 * @return {boolean} |
| 62 */ | 62 */ |
| 63 FeatureTracker.prototype.isEnabled = function(feature) { | 63 FeatureTracker.prototype.isEnabled = function(feature) { |
| 64 if (!this.ready_) { | 64 if (!this.ready_) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 94 } | 94 } |
| 95 this.ready_ = true; | 95 this.ready_ = true; |
| 96 } else { | 96 } else { |
| 97 console.error('API Error. Features not present in config.'); | 97 console.error('API Error. Features not present in config.'); |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 }); // goog.scope | 102 }); // goog.scope |
| 103 | 103 |
| OLD | NEW |