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 /** |
24 * Controls displaying of "Enable debugging features" link. | 25 * Controls displaying of "Enable debugging features" link. |
25 */ | 26 */ |
26 debuggingLinkVisible: Boolean, | 27 debuggingLinkVisible: Boolean, |
27 }, | 28 }, |
28 | 29 |
| 30 /** |
| 31 * This is stored ID of currently focused element to restore id on returns |
| 32 * to this dialog from Language / Timezone Selection dialogs. |
| 33 */ |
| 34 focusedElement_: 'languageSelectionButton', |
| 35 |
29 onLanguageClicked_: function() { | 36 onLanguageClicked_: function() { |
| 37 this.focusedElement_ = "languageSelectionButton"; |
30 this.fire('language-button-clicked'); | 38 this.fire('language-button-clicked'); |
31 }, | 39 }, |
32 | 40 |
33 onAccessibilityClicked_: function() { | 41 onAccessibilityClicked_: function() { |
| 42 this.focusedElement_ = "accessibilitySettingsButton"; |
34 this.fire('accessibility-button-clicked'); | 43 this.fire('accessibility-button-clicked'); |
35 }, | 44 }, |
36 | 45 |
37 onTimezoneClicked_: function() { | 46 onTimezoneClicked_: function() { |
| 47 this.focusedElement_ = "timezoneSettingsButton"; |
38 this.fire('timezone-button-clicked'); | 48 this.fire('timezone-button-clicked'); |
39 }, | 49 }, |
40 | 50 |
41 onNextClicked_: function() { | 51 onNextClicked_: function() { |
| 52 this.focusedElement_ = "welcomeNextButton"; |
42 this.fire('next-button-clicked'); | 53 this.fire('next-button-clicked'); |
43 }, | 54 }, |
44 | 55 |
45 onDebuggingLinkClicked_: function() { | 56 onDebuggingLinkClicked_: function() { |
46 chrome.send('login.NetworkScreen.userActed', | 57 chrome.send('login.NetworkScreen.userActed', |
47 ['connect-debugging-features']); | 58 ['connect-debugging-features']); |
48 }, | 59 }, |
49 | 60 |
| 61 attached: function() { |
| 62 this.focus(); |
| 63 }, |
| 64 |
| 65 focus: function() { |
| 66 var focusedElement = this.$[this.focusedElement_]; |
| 67 if (focusedElement) |
| 68 focusedElement.focus(); |
| 69 }, |
| 70 |
| 71 /** |
| 72 * This is called from oobe_welcome when this dialog is shown. |
| 73 */ |
| 74 show: function() { |
| 75 this.focus(); |
| 76 }, |
| 77 |
50 /** | 78 /** |
51 * This function formats message for labels. | 79 * This function formats message for labels. |
52 * @param String label i18n string ID. | 80 * @param String label i18n string ID. |
53 * @param String parameter i18n string parameter. | 81 * @param String parameter i18n string parameter. |
54 * @private | 82 * @private |
55 */ | 83 */ |
56 formatMessage_: function(label, parameter) { | 84 formatMessage_: function(label, parameter) { |
57 return loadTimeData.getStringF(label, parameter); | 85 return loadTimeData.getStringF(label, parameter); |
58 }, | 86 }, |
59 }); | 87 }); |
OLD | NEW |