OLD | NEW |
(Empty) | |
| 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 |
| 7 // |
| 8 // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 // |
| 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"); |
| 13 // |
| 14 goog.provide('i18n.input.chrome.inputview.content.ContextlayoutUtil'); |
| 15 |
| 16 goog.require('i18n.input.chrome.inputview.content.compact.util'); |
| 17 goog.require('i18n.input.chrome.inputview.content.compact.util.CompactKeysetSpec
'); |
| 18 goog.require('i18n.input.chrome.message.ContextType'); |
| 19 |
| 20 goog.scope(function() { |
| 21 var ContextType = i18n.input.chrome.message.ContextType; |
| 22 var util = i18n.input.chrome.inputview.content.ContextlayoutUtil; |
| 23 var compact = i18n.input.chrome.inputview.content.compact.util; |
| 24 var keysetSpecNode = compact.CompactKeysetSpec; |
| 25 |
| 26 |
| 27 /** |
| 28 * Generates custom layouts to be displayed on specified input type contexts. |
| 29 * |
| 30 * |
| 31 * @param {Object.<ContextType, !Object>} inputTypeToKeysetSpecMap Map from |
| 32 * input types to context-specific keysets. |
| 33 * @param {!function(!Object): void} onLoaded The function to call once a keyset |
| 34 * data is ready. |
| 35 */ |
| 36 util.generateContextLayouts = function(inputTypeToKeysetSpecMap, onLoaded) { |
| 37 // Creates context-specific keysets. |
| 38 if (inputTypeToKeysetSpecMap) { |
| 39 for (var inputType in inputTypeToKeysetSpecMap) { |
| 40 var spec = inputTypeToKeysetSpecMap[inputType]; |
| 41 var data = compact.createCompactData( |
| 42 spec, 'compactkbd-k-', 'compactkbd-k-key-'); |
| 43 data['id'] = spec[keysetSpecNode.ID]; |
| 44 data['showMenuKey'] = false; |
| 45 data['noShift'] = true; |
| 46 data['onContext'] = inputType; |
| 47 onLoaded(data); |
| 48 } |
| 49 } |
| 50 }; |
| 51 |
| 52 }); // goog.scope |
OLD | NEW |