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

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

Issue 2664383002: MD Settings: Internet: Convert 'Known Networks' page to dropdown menus (Closed)
Patch Set: . Created 3 years, 10 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-known-networks' is the settings subpage listing the 7 * 'settings-internet-known-networks' is the settings subpage listing the
8 * known networks for a type (currently always WiFi). 8 * known networks for a type (currently always WiFi).
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 20 matching lines...) Expand all
31 * @private {!Array<!CrOnc.NetworkStateProperties>} 31 * @private {!Array<!CrOnc.NetworkStateProperties>}
32 */ 32 */
33 networkStateList_: { 33 networkStateList_: {
34 type: Array, 34 type: Array,
35 value: function() { 35 value: function() {
36 return []; 36 return [];
37 } 37 }
38 }, 38 },
39 }, 39 },
40 40
41 /** @private {string} */
42 selectedGuid_: '',
43
44 /** @private {boolean} */
45 selectedIsPreferred_: false,
46
41 /** 47 /**
42 * Listener function for chrome.networkingPrivate.onNetworksChanged event. 48 * Listener function for chrome.networkingPrivate.onNetworksChanged event.
43 * @type {function(!Array<string>)} 49 * @type {function(!Array<string>)}
44 * @private 50 * @private
45 */ 51 */
46 networksChangedListener_: function() {}, 52 networksChangedListener_: function() {},
47 53
48 /** @override */ 54 /** @override */
49 attached: function() { 55 attached: function() {
50 this.networksChangedListener_ = this.onNetworksChangedEvent_.bind(this); 56 this.networksChangedListener_ = this.onNetworksChangedEvent_.bind(this);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * @return {boolean} 129 * @return {boolean}
124 * @private 130 * @private
125 */ 131 */
126 haveNotPreferred_: function() { 132 haveNotPreferred_: function() {
127 return this.networkStateList_.find(function(state) { 133 return this.networkStateList_.find(function(state) {
128 return this.networkIsNotPreferred_(state); 134 return this.networkIsNotPreferred_(state);
129 }.bind(this)) !== undefined; 135 }.bind(this)) !== undefined;
130 }, 136 },
131 137
132 /** 138 /**
133 * @param {!{model: !{item: !CrOnc.NetworkStateProperties}}} e 139 * @param {!Event} event
134 * @private 140 * @private
135 */ 141 */
136 onRemoveTap_: function(e) { 142 onMenuButtonTap_: function(event) {
michaelpg 2017/02/01 23:43:41 opt nit: |e| for consistency
stevenjb 2017/02/02 01:54:44 I remove the unused 'e' parameters below instead.
137 var state = e.model.item; 143 var button = /** @type {!HTMLElement} */ (event.target);
138 this.networkingPrivate.setProperties(state.GUID, {Priority: 0}); 144 this.selectedGuid_ = button.getAttribute('guid');
michaelpg 2017/02/01 23:43:41 actually, I'm already getting rusty, but IIRC |eve
michaelpg 2017/02/01 23:43:41 button.dataset['guid']
stevenjb 2017/02/02 01:54:44 Oh, hey, yeah, you're right. Forgot about that, th
145 this.selectedIsPreferred_ = button.id == 'preferredDots';
146 /** @type {!CrActionMenuElement} */ (this.$.dotsMenu).showAt(button);
147 event.stopPropagation();
139 }, 148 },
140 149
141 /** 150 /** @private */
142 * @param {!{model: !{item: !CrOnc.NetworkStateProperties}}} e 151 onRemovePreferredTap_: function() {
143 * @private 152 this.networkingPrivate.setProperties(this.selectedGuid_, {Priority: 0});
144 */ 153 /** @type {!CrActionMenuElement} */ (this.$.dotsMenu).close();
145 onAddTap_: function(e) { 154 },
146 var state = e.model.item; 155
147 this.networkingPrivate.setProperties(state.GUID, {Priority: 1}); 156 /** @private */
157 onAddPreferredTap_: function(e) {
158 this.networkingPrivate.setProperties(this.selectedGuid_, {Priority: 1});
159 /** @type {!CrActionMenuElement} */ (this.$.dotsMenu).close();
160 },
161
162 /** @private */
163 onForgetTap_: function(e) {
164 this.networkingPrivate.forgetNetwork(this.selectedGuid_);
165 /** @type {!CrActionMenuElement} */ (this.$.dotsMenu).close();
148 }, 166 },
149 }); 167 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698