| 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 23 matching lines...) Expand all Loading... |
| 34 /** | 34 /** |
| 35 * The state type. | 35 * The state type. |
| 36 * | 36 * |
| 37 * @enum {number} | 37 * @enum {number} |
| 38 */ | 38 */ |
| 39 ReadyState.State = { | 39 ReadyState.State = { |
| 40 IME_LIST_READY: 0x1, | 40 IME_LIST_READY: 0x1, |
| 41 KEYBOARD_CONFIG_READY: 0x10, | 41 KEYBOARD_CONFIG_READY: 0x10, |
| 42 LAYOUT_READY: 0x100, | 42 LAYOUT_READY: 0x100, |
| 43 LAYOUT_CONFIG_READY: 0x1000, | 43 LAYOUT_CONFIG_READY: 0x1000, |
| 44 M17N_LAYOUT_READY: 0x10000 | 44 M17N_LAYOUT_READY: 0x10000, |
| 45 DISPLAY_SIZE_READY: 0x100000 |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 | 48 |
| 48 /** | 49 /** |
| 49 * The internal ready state bit map. | 50 * The internal ready state bit map. |
| 50 * | 51 * |
| 51 * @private {number} | 52 * @private {number} |
| 52 */ | 53 */ |
| 53 ReadyState.prototype.state_ = 0; | 54 ReadyState.prototype.state_ = 0; |
| 54 | 55 |
| 55 | 56 |
| 56 /** | 57 /** |
| 57 * Gets whether the system is ready. | |
| 58 * | |
| 59 * @return {boolean} Whether the system is ready. | |
| 60 */ | |
| 61 ReadyState.prototype.isAllReady = function() { | |
| 62 return !!(this.state_ & ( | |
| 63 ReadyState.State.IME_LIST_READY | | |
| 64 ReadyState.State.KEYBOARD_CONFIG_READY | | |
| 65 ReadyState.State.LAYOUT_READY | | |
| 66 ReadyState.State.LAYOUT_CONFIG_READY | | |
| 67 ReadyState.State.M17N_LAYOUT_READY)); | |
| 68 }; | |
| 69 | |
| 70 | |
| 71 /** | |
| 72 * Gets whether a specific state type is ready. | 58 * Gets whether a specific state type is ready. |
| 73 * | 59 * |
| 74 * @param {ReadyState.State} state . | 60 * @param {ReadyState.State} state . |
| 75 * @return {boolean} Whether is ready. | 61 * @return {boolean} Whether is ready. |
| 76 */ | 62 */ |
| 77 ReadyState.prototype.isReady = function(state) { | 63 ReadyState.prototype.isReady = function(state) { |
| 78 return !!(this.state_ & state); | 64 return !!(this.state_ & state); |
| 79 }; | 65 }; |
| 80 | 66 |
| 81 | 67 |
| 82 /** | 68 /** |
| 83 * Sets state ready for the given state type. | 69 * Sets state ready for the given state type. |
| 84 * | 70 * |
| 85 * @param {ReadyState.State} state . | 71 * @param {ReadyState.State} state . |
| 86 */ | 72 */ |
| 87 ReadyState.prototype.markStateReady = function(state) { | 73 ReadyState.prototype.markStateReady = function(state) { |
| 88 this.state_ |= state; | 74 this.state_ |= state; |
| 89 }; | 75 }; |
| 90 }); // goog.scope | 76 }); // goog.scope |
| OLD | NEW |