| 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 /** |
| 6 * @fileoverview Polymer element for displaying material design OOBE. |
| 7 */ |
| 8 |
| 5 Polymer({ | 9 Polymer({ |
| 6 is: 'oobe-welcome-md', | 10 is: 'oobe-welcome-md', |
| 7 | 11 |
| 8 properties: { | 12 properties: { |
| 9 disabled: { | 13 /** |
| 10 type: Boolean, | 14 * Currently selected system language. |
| 11 value: false, | 15 */ |
| 12 }, | |
| 13 currentLanguage: { | 16 currentLanguage: { |
| 14 type: String, | 17 type: String, |
| 15 value: 'English (US)', | 18 value: 'English (US)', |
| 16 }, | 19 }, |
| 17 }, | 20 }, |
| 18 | 21 |
| 22 /** |
| 23 * GUID of the user-selected network. It is remembered after user taps on |
| 24 * network entry. After we receive event "connected" on this network, |
| 25 * OOBE will proceed. |
| 26 */ |
| 27 networkLastSelectedGuid_: '', |
| 28 |
| 29 /** |
| 30 * Set proper focus. |
| 31 */ |
| 19 focus: function() { | 32 focus: function() { |
| 20 this.$.welcomeNextButton.focus(); | 33 this.$.welcomeNextButton.focus(); |
| 21 }, | 34 }, |
| 22 | 35 |
| 36 /** |
| 37 * Handle "visible" event. |
| 38 * |
| 39 * @private |
| 40 */ |
| 23 onAnimationFinish_: function() { | 41 onAnimationFinish_: function() { |
| 24 this.focus(); | 42 this.focus(); |
| 25 }, | 43 }, |
| 26 | 44 |
| 45 /** |
| 46 * Handle "Next" button for "Welcome" screen. |
| 47 * |
| 48 * @private |
| 49 */ |
| 27 onWelcomeNextButtonClicked_: function() { | 50 onWelcomeNextButtonClicked_: function() { |
| 51 this.$.networkSelect.maxHeight = 280; |
| 52 this.$.networkSelect.showActive = false; |
| 53 this.$.networkSelect.networkStateAddon = [ |
| 54 { |
| 55 customItemName: 'proxySettingsMenuName', |
| 56 polymerIcon: 'oobe-welcome:add', |
| 57 onTapEvent: 'proxy-settings', |
| 58 }, |
| 59 { |
| 60 customItemName: 'addWiFiNetworkMenuName', |
| 61 polymerIcon: 'oobe-welcome:add', |
| 62 onTapEvent: 'add-wifi-network', |
| 63 }, |
| 64 { |
| 65 customItemName: 'addMobileNetworkMenuName', |
| 66 polymerIcon: 'oobe-welcome:add', |
| 67 onTapEvent: 'add-mobile-network', |
| 68 }, |
| 69 ]; |
| 70 var self = this; |
| 71 this.$.networkSelect.onNetworkListItemSelectedObserver = function(item) { |
| 72 self.onNetworkListItemSelected_(item); |
| 73 }; |
| 74 this.$.networkSection.hidden = false; |
| 75 this.$.welcomeSection.hidden = true; |
| 76 }, |
| 77 |
| 78 /** |
| 79 * Handle Networwork Setup screen "Proxy settings" button. |
| 80 * |
| 81 * @param {networkStateAddon entry for the button} item |
| 82 * @private |
| 83 */ |
| 84 onProxySettings_: function(item) { |
| 85 chrome.send('launchProxySettingsDialog'); |
| 86 }, |
| 87 |
| 88 /** |
| 89 * Handle Networwork Setup screen "Add WiFi network" button. |
| 90 * |
| 91 * @param {networkStateAddon entry for the button} item |
| 92 * @private |
| 93 */ |
| 94 onAddWiFiNetwork_: function(item) { |
| 95 chrome.send('launchAddWiFiNetworkDialog'); |
| 96 }, |
| 97 |
| 98 /** |
| 99 * Handle Networwork Setup screen "Add cellular network" button. |
| 100 * |
| 101 * @param {networkStateAddon entry for the button} item |
| 102 * @private |
| 103 */ |
| 104 onAddMobileNetwork_: function(item) { |
| 105 chrome.send('launchAddMobileNetworkDialog'); |
| 106 }, |
| 107 |
| 108 /** |
| 109 * This is called when network setup is done. |
| 110 * |
| 111 * @private |
| 112 */ |
| 113 onSelectedNetworkConnected_: function() { |
| 28 $('oobe-connect').hidden = false; | 114 $('oobe-connect').hidden = false; |
| 29 $('oobe-welcome-md').hidden = true; | 115 $('oobe-welcome-md').hidden = true; |
| 30 } | 116 }, |
| 117 |
| 118 /** |
| 119 * This is called on every network that has "Connected" state. |
| 120 * |
| 121 * @param {!{detail: !CrOnc.NetworkStateProperties}} event |
| 122 * @private |
| 123 */ |
| 124 onNetworkConnected_: function(event) { |
| 125 var state = event.detail; |
| 126 if (state.GUID != this.networkLastSelectedGuid_) |
| 127 return; |
| 128 |
| 129 this.onSelectedNetworkConnected_(); |
| 130 }, |
| 131 |
| 132 /** |
| 133 * This is called when user taps on network entry in networks list. |
| 134 * |
| 135 * @param {!CrOnc.NetworkStateProperties} state |
| 136 * @private |
| 137 */ |
| 138 onNetworkListItemSelected_: function(state) { |
| 139 if (state.ConnectionState == CrOnc.ConnectionState.CONNECTED) { |
| 140 this.onSelectedNetworkConnected_(); |
| 141 return; |
| 142 } |
| 143 |
| 144 if (this.networkLastSelectedGuid_ != state.GUID) |
| 145 this.networkLastSelectedGuid_ = state.GUID; |
| 146 }, |
| 31 }); | 147 }); |
| OLD | NEW |