Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1418)

Side by Side Diff: chrome/browser/resources/settings/internet_page/internet_detail_page.js

Issue 2188163003: MD Settings: Internet: Add 'forget' button, more fixes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_609156_internet_cleanup_6a
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 networksChangedListener_: function() {}, 107 networksChangedListener_: function() {},
108 108
109 /** @override */ 109 /** @override */
110 attached: function() { 110 attached: function() {
111 this.networksChangedListener_ = this.onNetworksChangedEvent_.bind(this); 111 this.networksChangedListener_ = this.onNetworksChangedEvent_.bind(this);
112 this.networkingPrivate.onNetworksChanged.addListener( 112 this.networkingPrivate.onNetworksChanged.addListener(
113 this.networksChangedListener_); 113 this.networksChangedListener_);
114 }, 114 },
115 115
116 /** @override */ 116 /** @override */
117 ready: function() {
118 if (!this.guid)
119 this.close_();
120 },
121
122 /** @override */
117 detached: function() { 123 detached: function() {
118 this.networkingPrivate.onNetworksChanged.removeListener( 124 this.networkingPrivate.onNetworksChanged.removeListener(
119 this.networksChangedListener_); 125 this.networksChangedListener_);
120 }, 126 },
121 127
122 /** @private */ 128 /** @private */
129 close_: function() {
130 // Delay sending subpage-back until the next render frame to allow other
131 // subpages to load first.
132 setTimeout(function() {
133 this.fire('subpage-back');
134 }.bind(this));
dschuyler 2016/07/28 22:03:55 setTimeout and async come up as problems often eno
stevenjb 2016/07/28 22:15:50 I tried many things, but nothing else worked relia
dschuyler 2016/07/29 23:13:31 Based on the conversation in the stand-up this mor
stevenjb 2016/08/02 23:40:34 Acknowledged.
135 },
136
137 /** @private */
123 guidChanged_: function() { 138 guidChanged_: function() {
124 if (!this.guid) 139 if (!this.guid)
125 return; 140 this.close_();
126 this.getNetworkDetails_(); 141 this.getNetworkDetails_();
127 }, 142 },
128 143
129 /** @private */ 144 /** @private */
130 networkPropertiesChanged_: function() { 145 networkPropertiesChanged_: function() {
131 if (!this.networkProperties) 146 if (!this.networkProperties)
132 return; 147 return;
133 148
134 // Update autoConnect if it has changed. Default value is false. 149 // Update autoConnect if it has changed. Default value is false.
135 var autoConnect = CrOnc.getAutoConnect(this.networkProperties); 150 var autoConnect = CrOnc.getAutoConnect(this.networkProperties);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 /** 206 /**
192 * networkingPrivate.getProperties callback. 207 * networkingPrivate.getProperties callback.
193 * @param {CrOnc.NetworkProperties} properties The network properties. 208 * @param {CrOnc.NetworkProperties} properties The network properties.
194 * @private 209 * @private
195 */ 210 */
196 getPropertiesCallback_: function(properties) { 211 getPropertiesCallback_: function(properties) {
197 this.networkProperties = properties; 212 this.networkProperties = properties;
198 if (!properties) { 213 if (!properties) {
199 // If |properties| becomes null (i.e. the network is no longer visible), 214 // If |properties| becomes null (i.e. the network is no longer visible),
200 // close the page. 215 // close the page.
201 this.fire('close'); 216 this.close_();
202 } 217 }
203 }, 218 },
204 219
205 /** 220 /**
206 * @param {!chrome.networkingPrivate.NetworkConfigProperties} onc The ONC 221 * @param {!chrome.networkingPrivate.NetworkConfigProperties} onc The ONC
207 * network properties. 222 * network properties.
208 * @private 223 * @private
209 */ 224 */
210 setNetworkProperties_: function(onc) { 225 setNetworkProperties_: function(onc) {
211 if (!this.guid) 226 if (!this.guid)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 showDisconnect_: function(networkProperties) { 305 showDisconnect_: function(networkProperties) {
291 return networkProperties.Type != CrOnc.Type.ETHERNET && 306 return networkProperties.Type != CrOnc.Type.ETHERNET &&
292 networkProperties.ConnectionState != 307 networkProperties.ConnectionState !=
293 CrOnc.ConnectionState.NOT_CONNECTED; 308 CrOnc.ConnectionState.NOT_CONNECTED;
294 }, 309 },
295 310
296 /** 311 /**
297 * @return {boolean} 312 * @return {boolean}
298 * @private 313 * @private
299 */ 314 */
315 showForget_: function(networkProperties) {
dschuyler 2016/07/28 22:03:55 @param for networkProperties.
stevenjb 2016/07/28 22:15:50 Not needed for declared properties. Closure is sma
stevenjb 2016/08/02 23:40:34 Now using this.networkProperties, parameter remove
316 var type = networkProperties.Type;
317 if (type != CrOnc.Type.WI_FI && type != CrOnc.Type.VPN)
318 return false;
319 return this.isRemembered_(networkProperties);
320 },
321
322 /**
323 * @return {boolean}
324 * @private
325 */
300 showActivate_: function(networkProperties) { 326 showActivate_: function(networkProperties) {
dschuyler 2016/07/28 22:03:55 @param
stevenjb 2016/07/28 22:15:50 Acknowledged.
301 if (networkProperties.Type != CrOnc.Type.CELLULAR) 327 if (networkProperties.Type != CrOnc.Type.CELLULAR)
302 return false; 328 return false;
303 var activation = networkProperties.Cellular.ActivationState; 329 var activation = networkProperties.Cellular.ActivationState;
304 return activation == CrOnc.ActivationState.NOT_ACTIVATED || 330 return activation == CrOnc.ActivationState.NOT_ACTIVATED ||
305 activation == CrOnc.ActivationState.PARTIALLY_ACTIVATED; 331 activation == CrOnc.ActivationState.PARTIALLY_ACTIVATED;
306 }, 332 },
307 333
308 /** 334 /**
309 * @return {boolean} 335 * @return {boolean}
310 * @private 336 * @private
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 onConnectTap_: function() { 387 onConnectTap_: function() {
362 this.networkingPrivate.startConnect(this.guid); 388 this.networkingPrivate.startConnect(this.guid);
363 }, 389 },
364 390
365 /** @private */ 391 /** @private */
366 onDisconnectTap_: function() { 392 onDisconnectTap_: function() {
367 this.networkingPrivate.startDisconnect(this.guid); 393 this.networkingPrivate.startDisconnect(this.guid);
368 }, 394 },
369 395
370 /** @private */ 396 /** @private */
397 onForgetTap_: function() {
398 this.networkingPrivate.forgetNetwork(this.guid);
399 },
400
401 /** @private */
371 onActivateTap_: function() { 402 onActivateTap_: function() {
372 this.networkingPrivate.startActivate(this.guid); 403 this.networkingPrivate.startActivate(this.guid);
373 }, 404 },
374 405
375 /** @private */ 406 /** @private */
376 onViewAccountTap_: function() { 407 onViewAccountTap_: function() {
377 // startActivate() will show the account page for activated networks. 408 // startActivate() will show the account page for activated networks.
378 this.networkingPrivate.startActivate(this.guid); 409 this.networkingPrivate.startActivate(this.guid);
379 }, 410 },
380 411
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 */ 730 */
700 allPropertiesMatch_: function(curValue, newValue) { 731 allPropertiesMatch_: function(curValue, newValue) {
701 for (let key in newValue) { 732 for (let key in newValue) {
702 if (newValue[key] != curValue[key]) 733 if (newValue[key] != curValue[key])
703 return false; 734 return false;
704 } 735 }
705 return true; 736 return true;
706 } 737 }
707 }); 738 });
708 })(); 739 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698