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

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: Rebase 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));
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 showDisconnect_: function() { 306 showDisconnect_: function() {
292 return this.networkProperties.Type != CrOnc.Type.ETHERNET && 307 return this.networkProperties.Type != CrOnc.Type.ETHERNET &&
293 this.networkProperties.ConnectionState != 308 this.networkProperties.ConnectionState !=
294 CrOnc.ConnectionState.NOT_CONNECTED; 309 CrOnc.ConnectionState.NOT_CONNECTED;
295 }, 310 },
296 311
297 /** 312 /**
298 * @return {boolean} 313 * @return {boolean}
299 * @private 314 * @private
300 */ 315 */
316 showForget_: function() {
317 var type = this.networkProperties.Type;
318 if (type != CrOnc.Type.WI_FI && type != CrOnc.Type.VPN)
319 return false;
320 return this.isRemembered_();
321 },
322
323 /**
324 * @return {boolean}
325 * @private
326 */
301 showActivate_: function() { 327 showActivate_: function() {
302 if (this.networkProperties.Type != CrOnc.Type.CELLULAR) 328 if (this.networkProperties.Type != CrOnc.Type.CELLULAR)
303 return false; 329 return false;
304 var activation = this.networkProperties.Cellular.ActivationState; 330 var activation = this.networkProperties.Cellular.ActivationState;
305 return activation == CrOnc.ActivationState.NOT_ACTIVATED || 331 return activation == CrOnc.ActivationState.NOT_ACTIVATED ||
306 activation == CrOnc.ActivationState.PARTIALLY_ACTIVATED; 332 activation == CrOnc.ActivationState.PARTIALLY_ACTIVATED;
307 }, 333 },
308 334
309 /** 335 /**
310 * @return {boolean} 336 * @return {boolean}
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 onConnectTap_: function() { 388 onConnectTap_: function() {
363 this.networkingPrivate.startConnect(this.guid); 389 this.networkingPrivate.startConnect(this.guid);
364 }, 390 },
365 391
366 /** @private */ 392 /** @private */
367 onDisconnectTap_: function() { 393 onDisconnectTap_: function() {
368 this.networkingPrivate.startDisconnect(this.guid); 394 this.networkingPrivate.startDisconnect(this.guid);
369 }, 395 },
370 396
371 /** @private */ 397 /** @private */
398 onForgetTap_: function() {
399 this.networkingPrivate.forgetNetwork(this.guid);
400 },
401
402 /** @private */
372 onActivateTap_: function() { 403 onActivateTap_: function() {
373 this.networkingPrivate.startActivate(this.guid); 404 this.networkingPrivate.startActivate(this.guid);
374 }, 405 },
375 406
376 /** @private */ 407 /** @private */
377 onViewAccountTap_: function() { 408 onViewAccountTap_: function() {
378 // startActivate() will show the account page for activated networks. 409 // startActivate() will show the account page for activated networks.
379 this.networkingPrivate.startActivate(this.guid); 410 this.networkingPrivate.startActivate(this.guid);
380 }, 411 },
381 412
(...skipping 317 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