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

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

Issue 2422423002: Use md-select instead of paper-dropdown-menu-light in internet page (Closed)
Patch Set: Created 4 years, 2 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 Polymer element for displaying and modifying a list of cellular 6 * @fileoverview Polymer element for displaying and modifying a list of cellular
7 * access points. 7 * access points.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'network-apnlist', 10 is: 'network-apnlist',
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 // Save the 'other' properties. 135 // Save the 'other' properties.
136 this.otherApn_ = otherApn; 136 this.otherApn_ = otherApn;
137 137
138 // Append 'other' to the end of the list of APNs. 138 // Append 'other' to the end of the list of APNs.
139 result.push(otherApn); 139 result.push(otherApn);
140 140
141 this.apnSelectList_ = result; 141 this.apnSelectList_ = result;
142 this.selectedApn_ = 142 this.selectedApn_ =
143 (activeApn && activeApn.AccessPointName) || otherApn.AccessPointName; 143 (activeApn && activeApn.AccessPointName) || otherApn.AccessPointName;
144 // We need to flush the DOM here, otherwise the paper-dropdown-menu-light 144 this.$.selectApn.value = this.selectedApn_;
dpapad 2016/10/17 22:57:05 Native <select> has the same problem described by
stevenjb 2016/10/17 23:10:19 Hrm, yeah, you're right, I need to us async() here
145 // will not update to correctly display the selected AccessPointName.
146 Polymer.dom.flush();
147 }, 145 },
148 146
149 /** 147 /**
150 * @param {!CrOnc.APNProperties|undefined=} apnProperties 148 * @param {!CrOnc.APNProperties|undefined=} apnProperties
151 * @return {!CrOnc.APNProperties} A new APN object with properties from 149 * @return {!CrOnc.APNProperties} A new APN object with properties from
152 * |apnProperties| if provided. 150 * |apnProperties| if provided.
153 * @private 151 * @private
154 */ 152 */
155 createApnObject_: function(apnProperties) { 153 createApnObject_: function(apnProperties) {
156 var newApn = {AccessPointName: ''}; 154 var newApn = {AccessPointName: ''};
(...skipping 13 matching lines...) Expand all
170 /** @type {!chrome.networkingPrivate.ManagedAPNList|undefined} */ var 168 /** @type {!chrome.networkingPrivate.ManagedAPNList|undefined} */ var
171 apnlist = this.networkProperties.Cellular.APNList; 169 apnlist = this.networkProperties.Cellular.APNList;
172 if (!apnlist) 170 if (!apnlist)
173 return []; 171 return [];
174 return /** @type {!Array<!CrOnc.APNProperties>} */ ( 172 return /** @type {!Array<!CrOnc.APNProperties>} */ (
175 CrOnc.getActiveValue(apnlist)); 173 CrOnc.getActiveValue(apnlist));
176 }, 174 },
177 175
178 /** 176 /**
179 * Event triggered when the selectApn selection changes. 177 * Event triggered when the selectApn selection changes.
180 * @param {!{detail: !{selected: string}}} event 178 * @param {!{target: !{value: string}}} event
dpapad 2016/10/17 22:57:05 I think the proper way to type annotate this is as
stevenjb 2016/10/17 23:10:19 Sure. Done.
181 * @private 179 * @private
182 */ 180 */
183 onSelectApnChange_: function(event) { 181 onSelectApnChange_: function(event) {
184 /** @type {string} */ var accessPointName = event.detail.selected; 182 var accessPointName = event.target.value;
185 // When selecting 'Other', don't set a change event unless a valid 183 // When selecting 'Other', don't set a change event unless a valid
186 // non-default value has been set for Other. 184 // non-default value has been set for Other.
187 if (this.isOtherSelected_(accessPointName) && 185 if (this.isOtherSelected_(accessPointName) &&
188 (!this.otherApn_ || !this.otherApn_.AccessPointName || 186 (!this.otherApn_ || !this.otherApn_.AccessPointName ||
189 this.otherApn_.AccessPointName == this.DefaultAccessPointName)) { 187 this.otherApn_.AccessPointName == this.DefaultAccessPointName)) {
188 this.selectedApn_ = accessPointName;
190 return; 189 return;
191 } 190 }
192 this.sendApnChange_(accessPointName); 191 this.sendApnChange_(accessPointName);
193 }, 192 },
194 193
195 /** 194 /**
196 * Event triggered when any 'Other' APN network property changes. 195 * Event triggered when any 'Other' APN network property changes.
197 * @param {!{detail: {field: string, value: string}}} event 196 * @param {!{detail: {field: string, value: string}}} event
198 * @private 197 * @private
199 */ 198 */
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 * @private 259 * @private
261 */ 260 */
262 findApnInList: function(apnList, accessPointName) { 261 findApnInList: function(apnList, accessPointName) {
263 for (let a of apnList) { 262 for (let a of apnList) {
264 if (a.AccessPointName == accessPointName) 263 if (a.AccessPointName == accessPointName)
265 return a; 264 return a;
266 } 265 }
267 return undefined; 266 return undefined;
268 } 267 }
269 }); 268 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698