OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @fileoverview | 6 * @fileoverview |
7 * 'settings-internet-detail' is the settings subpage containing details | 7 * 'settings-internet-detail' is the settings subpage containing details |
8 * for a network. | 8 * for a network. |
9 */ | 9 */ |
10 (function() { | 10 (function() { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 * @const | 124 * @const |
125 * @private | 125 * @private |
126 */ | 126 */ |
127 NetworkType_: { | 127 NetworkType_: { |
128 type: Object, | 128 type: Object, |
129 value: { | 129 value: { |
130 CELLULAR: CrOnc.Type.CELLULAR, | 130 CELLULAR: CrOnc.Type.CELLULAR, |
131 ETHERNET: CrOnc.Type.ETHERNET, | 131 ETHERNET: CrOnc.Type.ETHERNET, |
132 TETHER: CrOnc.Type.TETHER, | 132 TETHER: CrOnc.Type.TETHER, |
133 VPN: CrOnc.Type.VPN, | 133 VPN: CrOnc.Type.VPN, |
134 WIFI: CrOnc.Type.WI_FI, | 134 WI_FI: CrOnc.Type.WI_FI, |
135 WIMAX: CrOnc.Type.WI_MAX, | 135 WI_MAX: CrOnc.Type.WI_MAX, |
136 }, | 136 }, |
137 readOnly: true | 137 readOnly: true |
138 }, | 138 }, |
139 }, | 139 }, |
140 | 140 |
141 /** | 141 /** |
142 * Listener function for chrome.networkingPrivate.onNetworksChanged event. | 142 * Listener function for chrome.networkingPrivate.onNetworksChanged event. |
143 * @type {?function(!Array<string>)} | 143 * @type {?function(!Array<string>)} |
144 * @private | 144 * @private |
145 */ | 145 */ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 Type: type, | 183 Type: type, |
184 ConnectionState: CrOnc.ConnectionState.NOT_CONNECTED, | 184 ConnectionState: CrOnc.ConnectionState.NOT_CONNECTED, |
185 Name: {Active: name}, | 185 Name: {Active: name}, |
186 }; | 186 }; |
187 this.didSetFocus_ = false; | 187 this.didSetFocus_ = false; |
188 this.getNetworkDetails_(); | 188 this.getNetworkDetails_(); |
189 }, | 189 }, |
190 | 190 |
191 /** @private */ | 191 /** @private */ |
192 close_: function() { | 192 close_: function() { |
193 // Delay navigating until the next render frame to allow other subpages to | 193 // Delay navigating to allow other subpages to load first. |
194 // load first. | 194 requestAnimationFrame(function() { |
195 setTimeout(function() { | 195 settings.navigateToPreviousRoute(); |
196 settings.navigateTo(settings.Route.INTERNET); | |
197 }); | 196 }); |
198 }, | 197 }, |
199 | 198 |
200 /** @private */ | 199 /** @private */ |
201 networkPropertiesChanged_: function() { | 200 networkPropertiesChanged_: function() { |
202 if (!this.networkProperties) | 201 if (!this.networkProperties) |
203 return; | 202 return; |
204 | 203 |
205 // Update autoConnect if it has changed. Default value is false. | 204 // Update autoConnect if it has changed. Default value is false. |
206 var autoConnect = CrOnc.getAutoConnect(this.networkProperties); | 205 var autoConnect = CrOnc.getAutoConnect(this.networkProperties); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 this.networkingPrivate.getState( | 270 this.networkingPrivate.getState( |
272 this.guid, this.getStateCallback_.bind(this)); | 271 this.guid, this.getStateCallback_.bind(this)); |
273 } else { | 272 } else { |
274 this.networkingPrivate.getManagedProperties( | 273 this.networkingPrivate.getManagedProperties( |
275 this.guid, this.getPropertiesCallback_.bind(this)); | 274 this.guid, this.getPropertiesCallback_.bind(this)); |
276 } | 275 } |
277 }, | 276 }, |
278 | 277 |
279 /** | 278 /** |
280 * networkingPrivate.getProperties callback. | 279 * networkingPrivate.getProperties callback. |
281 * @param {CrOnc.NetworkProperties} properties The network properties. | 280 * @param {!CrOnc.NetworkProperties} properties The network properties. |
282 * @private | 281 * @private |
283 */ | 282 */ |
284 getPropertiesCallback_: function(properties) { | 283 getPropertiesCallback_: function(properties) { |
285 if (chrome.runtime.lastError) { | 284 if (chrome.runtime.lastError) { |
286 var message = chrome.runtime.lastError.message; | 285 var message = chrome.runtime.lastError.message; |
287 if (message == 'Error.InvalidNetworkGuid') { | 286 if (message == 'Error.InvalidNetworkGuid') { |
288 console.error('Details page: GUID no longer exists: ' + this.guid); | 287 console.error('Details page: GUID no longer exists: ' + this.guid); |
289 } else { | 288 } else { |
290 console.error( | 289 console.error( |
291 'Unexpected networkingPrivate.getManagedProperties error: ' + | 290 'Unexpected networkingPrivate.getManagedProperties error: ' + |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 this.close_(); | 547 this.close_(); |
549 }, | 548 }, |
550 | 549 |
551 /** @private */ | 550 /** @private */ |
552 onActivateTap_: function() { | 551 onActivateTap_: function() { |
553 this.networkingPrivate.startActivate(this.guid); | 552 this.networkingPrivate.startActivate(this.guid); |
554 }, | 553 }, |
555 | 554 |
556 /** @private */ | 555 /** @private */ |
557 onConfigureTap_: function() { | 556 onConfigureTap_: function() { |
558 chrome.send('configureNetwork', [this.guid]); | 557 if (loadTimeData.getBoolean('networkSettingsConfig')) |
| 558 this.fire('show-config', this.networkProperties); |
| 559 else |
| 560 chrome.send('configureNetwork', [this.guid]); |
559 }, | 561 }, |
560 | 562 |
561 /** @private */ | 563 /** @private */ |
562 onViewAccountTap_: function() { | 564 onViewAccountTap_: function() { |
563 // startActivate() will show the account page for activated networks. | 565 // startActivate() will show the account page for activated networks. |
564 this.networkingPrivate.startActivate(this.guid); | 566 this.networkingPrivate.startActivate(this.guid); |
565 }, | 567 }, |
566 | 568 |
567 /** @const {string} */ | 569 /** @const {string} */ |
568 CR_EXPAND_BUTTON_TAG: 'CR-EXPAND-BUTTON', | 570 CR_EXPAND_BUTTON_TAG: 'CR-EXPAND-BUTTON', |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 */ | 960 */ |
959 allPropertiesMatch_: function(curValue, newValue) { | 961 allPropertiesMatch_: function(curValue, newValue) { |
960 for (var key in newValue) { | 962 for (var key in newValue) { |
961 if (newValue[key] != curValue[key]) | 963 if (newValue[key] != curValue[key]) |
962 return false; | 964 return false; |
963 } | 965 } |
964 return true; | 966 return true; |
965 } | 967 } |
966 }); | 968 }); |
967 })(); | 969 })(); |
OLD | NEW |