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 Polymer({ | 5 Polymer({ |
6 is: 'oobe-welcome-dialog', | 6 is: 'oobe-welcome-dialog', |
7 properties: { | 7 properties: { |
8 /** | 8 /** |
9 * Currently selected system language (display name). | 9 * Currently selected system language (display name). |
10 */ | 10 */ |
11 currentLanguage: { | 11 currentLanguage: { |
12 type: String, | 12 type: String, |
13 value: '', | 13 value: '', |
14 }, | 14 }, |
15 | |
15 /** | 16 /** |
16 * Controls visibility of "Timezone" button. | 17 * Controls visibility of "Timezone" button. |
17 */ | 18 */ |
18 timezoneButtonVisible: { | 19 timezoneButtonVisible: { |
19 type: Boolean, | 20 type: Boolean, |
20 value: false, | 21 value: false, |
21 }, | 22 }, |
22 }, | 23 }, |
23 | 24 |
25 /** | |
26 * This is stored ID of currently focused element to restore id on returns | |
27 * to this dialog from Language / Timezone Selection dialogs. | |
28 */ | |
29 focusedElement_: 'languageSelectionButton', | |
30 | |
24 onLanguageClicked_: function() { | 31 onLanguageClicked_: function() { |
32 this.focusedElement_ = "languageSelectionButton"; | |
25 this.fire('language-button-clicked'); | 33 this.fire('language-button-clicked'); |
26 }, | 34 }, |
27 | 35 |
28 onAccessibilityClicked_: function() { | 36 onAccessibilityClicked_: function() { |
37 this.focusedElement_ = "accessibilitySettingsButton"; | |
29 this.fire('accessibility-button-clicked'); | 38 this.fire('accessibility-button-clicked'); |
30 }, | 39 }, |
31 | 40 |
32 onTimezoneClicked_: function() { | 41 onTimezoneClicked_: function() { |
42 this.focusedElement_ = "timezoneSettingsButton"; | |
33 this.fire('timezone-button-clicked'); | 43 this.fire('timezone-button-clicked'); |
34 }, | 44 }, |
35 | 45 |
36 onNextClicked_: function() { | 46 onNextClicked_: function() { |
47 this.focusedElement_ = "welcomeNextButton"; | |
37 this.fire('next-button-clicked'); | 48 this.fire('next-button-clicked'); |
38 }, | 49 }, |
39 | 50 |
51 attached: function() { | |
52 this.focus(); | |
53 }, | |
54 | |
55 focus: function() { | |
56 var focused = this.$[this.focusedElement_]; | |
stevenjb
2017/02/14 01:21:32
focusedElement
Alexander Alekseev
2017/02/14 11:59:27
Done.
| |
57 if (focused) | |
58 focused.focus(); | |
59 }, | |
60 | |
61 /** | |
62 * This is called from oobe_welcome when this dialog is shown. | |
63 */ | |
64 show: function() { | |
65 this.focus(); | |
66 }, | |
67 | |
40 /** | 68 /** |
41 * This function formats message for labels. | 69 * This function formats message for labels. |
42 * @param String label i18n string ID. | 70 * @param String label i18n string ID. |
43 * @param String parameter i18n string parameter. | 71 * @param String parameter i18n string parameter. |
44 * @private | 72 * @private |
45 */ | 73 */ |
46 formatMessage_: function(label, parameter) { | 74 formatMessage_: function(label, parameter) { |
47 return loadTimeData.getStringF(label, parameter); | 75 return loadTimeData.getStringF(label, parameter); |
48 }, | 76 }, |
49 }); | 77 }); |
OLD | NEW |