| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Polymer class definition for 'oobe-i18n-dropdown'. | 6 * Polymer class definition for 'oobe-i18n-dropdown'. |
| 7 */ | 7 */ |
| 8 (function() { | 8 (function() { |
| 9 | 9 |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 /** | 21 /** |
| 22 * List of languages/keyboards to display | 22 * List of languages/keyboards to display |
| 23 * @type {!Array<I18nMenuItem>} | 23 * @type {!Array<I18nMenuItem>} |
| 24 */ | 24 */ |
| 25 items: { | 25 items: { |
| 26 type: Array, | 26 type: Array, |
| 27 observer: 'onItemsChanged_', | 27 observer: 'onItemsChanged_', |
| 28 }, | 28 }, |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Accessibility label. | 31 * ARIA-label for the selection menu. |
| 32 * @type {!string} | |
| 33 */ | 32 */ |
| 34 label: { | 33 ariaLabel: String, |
| 35 type: String, | |
| 36 }, | |
| 37 }, | 34 }, |
| 38 | 35 |
| 39 /** | 36 /** |
| 40 * Mapping from item id to item. | 37 * Mapping from item id to item. |
| 41 * @type {!Map<string,I18nMenuItem>} | 38 * @type {!Map<string,I18nMenuItem>} |
| 42 */ | 39 */ |
| 43 idToItem_: null, | 40 idToItem_: null, |
| 44 | 41 |
| 45 /** | 42 /** |
| 46 * @param {string} value Option value. | 43 * @param {string} value Option value. |
| 47 * @private | 44 * @private |
| 48 */ | 45 */ |
| 49 onSelected_: function(value) { | 46 onSelected_: function(value) { |
| 50 this.fire('select-item', this.idToItem_.get(value)); | 47 this.fire('select-item', this.idToItem_.get(value)); |
| 51 }, | 48 }, |
| 52 | 49 |
| 53 onItemsChanged_: function(items) { | 50 onItemsChanged_: function(items) { |
| 54 this.idToItem_ = new Map(); | 51 this.idToItem_ = new Map(); |
| 55 for (var i = 0; i < items.length; ++i) { | 52 for (var i = 0; i < items.length; ++i) { |
| 56 var item = items[i]; | 53 var item = items[i]; |
| 57 this.idToItem_.set(item.value, item); | 54 this.idToItem_.set(item.value, item); |
| 58 } | 55 } |
| 59 Oobe.setupSelect(this.$.select, | 56 Oobe.setupSelect(this.$.select, |
| 60 items, | 57 items, |
| 61 this.onSelected_.bind(this)); | 58 this.onSelected_.bind(this)); |
| 62 }, | 59 }, |
| 63 }); | 60 }); |
| 64 })(); | 61 })(); |
| OLD | NEW |