1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved.
2 // limitations under the License.
3 // See the License for the specific language governing permissions and
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5 // distributed under the License is distributed on an "AS-IS" BASIS,
6 // Unless required by applicable law or agreed to in writing, software
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // You may obtain a copy of the License at
11 // you may not use this file except in compliance with the License.
12 // Licensed under the Apache License, Version 2.0 (the "License");
14 goog
.provide('i18n.input.chrome.inputview.ReadyState');
18 goog
.scope(function() {
23 * The system ready state which mainains a state bit map.
24 * Inputview controller uses this to determine whether the system is ready to
29 i18n
.input
.chrome
.inputview
.ReadyState = function() {
31 var ReadyState
= i18n
.input
.chrome
.inputview
.ReadyState
;
39 ReadyState
.StateType
= {
41 KEYBOARD_CONFIG_READY
: 0x10,
43 LAYOUT_CONFIG_READY
: 0x1000,
44 M17N_LAYOUT_READY
: 0x10000,
45 INPUT_METHOD_CONFIG_READY
: 0x100000
50 * The internal ready state bit map.
54 ReadyState
.prototype.state_
= 0;
58 * Gets whether the system is ready.
60 * @return {boolean} Whether the system is ready.
62 ReadyState
.prototype.isAllReady = function() {
63 return !!(this.state_
& (
64 ReadyState
.StateType
.IME_LIST_READY
|
65 ReadyState
.StateType
.KEYBOARD_CONFIG_READY
|
66 ReadyState
.StateType
.LAYOUT_READY
|
67 ReadyState
.StateType
.LAYOUT_CONFIG_READY
|
68 ReadyState
.StateType
.M17N_LAYOUT_READY
));
73 * Gets whether a specific state type is ready.
75 * @param {ReadyState.StateType} stateType .
76 * @return {boolean} Whether is ready.
78 ReadyState
.prototype.isReady = function(stateType
) {
79 return !!(this.state_
& stateType
);
84 * Sets state ready for the given state type.
86 * @param {ReadyState.StateType} stateType .
88 ReadyState
.prototype.markStateReady = function(stateType
) {
89 this.state_
|= stateType
;