| 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 11 matching lines...) Expand all Loading... |
| 22 goog.scope(function() { | 22 goog.scope(function() { |
| 23 var Event = goog.events.Event; | 23 var Event = goog.events.Event; |
| 24 var EventTarget = goog.events.EventTarget; | 24 var EventTarget = goog.events.EventTarget; |
| 25 | 25 |
| 26 | 26 |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * The data source. | 29 * The data source. |
| 30 * | 30 * |
| 31 * @param {number} numOfCanddiate The number of canddiate to fetch. | 31 * @param {number} numOfCanddiate The number of canddiate to fetch. |
| 32 * @param {function(string, !Array.<!Object>)} callback . | 32 * @param {function(string, !Array.<!Object>)} candidatesCallback . |
| 33 * @param {function(!Array.<string>)} gestureCallback . |
| 33 * @constructor | 34 * @constructor |
| 34 * @extends {EventTarget} | 35 * @extends {EventTarget} |
| 35 */ | 36 */ |
| 36 i18n.input.chrome.DataSource = function(numOfCanddiate, callback) { | 37 i18n.input.chrome.DataSource = function(numOfCanddiate, candidatesCallback, |
| 38 gestureCallback) { |
| 37 goog.base(this); | 39 goog.base(this); |
| 38 | 40 |
| 39 /** | 41 /** |
| 40 * The number of candidates to fetch. | 42 * The number of candidates to fetch. |
| 41 * | 43 * |
| 42 * @type {number} | 44 * @type {number} |
| 43 */ | 45 */ |
| 44 this.numOfCandidate = numOfCanddiate; | 46 this.numOfCandidate = numOfCanddiate; |
| 45 | 47 |
| 46 /** @protected {function(string, !Array.<!Object>)} */ | 48 /** @protected {function(string, !Array.<!Object>)} */ |
| 47 this.callback = callback; | 49 this.candidatesCallback = candidatesCallback; |
| 50 |
| 51 /** @protected {function(!Array.<string>)} */ |
| 52 this.gestureCallback = gestureCallback; |
| 48 }; | 53 }; |
| 49 var DataSource = i18n.input.chrome.DataSource; | 54 var DataSource = i18n.input.chrome.DataSource; |
| 50 goog.inherits(DataSource, EventTarget); | 55 goog.inherits(DataSource, EventTarget); |
| 51 | 56 |
| 52 | 57 |
| 53 /** | 58 /** |
| 54 * The event type. | 59 * The event type. |
| 55 * | 60 * |
| 56 * @enum {string} | 61 * @enum {string} |
| 57 */ | 62 */ |
| 58 DataSource.EventType = { | 63 DataSource.EventType = { |
| 59 CANDIDATES_BACK: goog.events.getUniqueId('cb'), | 64 CANDIDATES_BACK: goog.events.getUniqueId('cb'), |
| 65 GESTURES_BACK: goog.events.getUniqueId('gb'), |
| 60 READY: goog.events.getUniqueId('r') | 66 READY: goog.events.getUniqueId('r') |
| 61 }; | 67 }; |
| 62 | 68 |
| 63 | 69 |
| 64 /** @type {boolean} */ | 70 /** @type {boolean} */ |
| 65 DataSource.prototype.ready = false; | 71 DataSource.prototype.ready = false; |
| 66 | 72 |
| 67 | 73 |
| 68 /** | 74 /** |
| 69 * The correction level. | 75 * The correction level. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 197 |
| 192 | 198 |
| 193 /** | 199 /** |
| 194 * Clears the data source. | 200 * Clears the data source. |
| 195 */ | 201 */ |
| 196 DataSource.prototype.clear = goog.functions.NULL; | 202 DataSource.prototype.clear = goog.functions.NULL; |
| 197 | 203 |
| 198 | 204 |
| 199 | 205 |
| 200 /** | 206 /** |
| 201 * The candidates is fetched back. | 207 * The candidates are fetched back. |
| 202 * | 208 * |
| 203 * @param {string} source The source. | 209 * @param {string} source The source. |
| 204 * @param {!Array.<!Object>} candidates The candidates. | 210 * @param {!Array.<!Object>} candidates The candidates. |
| 205 * @constructor | 211 * @constructor |
| 206 * @extends {Event} | 212 * @extends {Event} |
| 207 */ | 213 */ |
| 208 DataSource.CandidatesBackEvent = function(source, candidates) { | 214 DataSource.CandidatesBackEvent = function(source, candidates) { |
| 209 DataSource.CandidatesBackEvent.base( | 215 DataSource.CandidatesBackEvent.base( |
| 210 this, 'constructor', DataSource.EventType.CANDIDATES_BACK); | 216 this, 'constructor', DataSource.EventType.CANDIDATES_BACK); |
| 211 | 217 |
| 212 /** | 218 /** |
| 213 * The source. | 219 * The source. |
| 214 * | 220 * |
| 215 * @type {string} | 221 * @type {string} |
| 216 */ | 222 */ |
| 217 this.source = source; | 223 this.source = source; |
| 218 | 224 |
| 219 /** | 225 /** |
| 220 * The candidate list. | 226 * The candidate list. |
| 221 * | 227 * |
| 222 * @type {!Array.<!Object>} | 228 * @type {!Array.<!Object>} |
| 223 */ | 229 */ |
| 224 this.candidates = candidates; | 230 this.candidates = candidates; |
| 225 }; | 231 }; |
| 226 goog.inherits(DataSource.CandidatesBackEvent, Event); | 232 goog.inherits(DataSource.CandidatesBackEvent, Event); |
| 227 | 233 |
| 234 |
| 235 |
| 236 /** |
| 237 * The gesture results are fetched back. |
| 238 * |
| 239 * @param {!Array.<!string>} results The gesture results. |
| 240 * @constructor |
| 241 * @extends {Event} |
| 242 */ |
| 243 DataSource.GesturesBackEvent = function(results) { |
| 244 DataSource.GesturesBackEvent.base( |
| 245 this, 'constructor', DataSource.EventType.GESTURES_BACK); |
| 246 |
| 247 /** |
| 248 * The gesture results list. |
| 249 * |
| 250 * @type {!Array.<!string>} |
| 251 */ |
| 252 this.results = results; |
| 253 }; |
| 254 goog.inherits(DataSource.GesturesBackEvent, Event); |
| 255 |
| 228 }); // goog.scope | 256 }); // goog.scope |
| OLD | NEW |