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

Side by Side Diff: chrome/browser/resources/options2/chromeos/network_list.js

Issue 10175010: Force a rescan when opening the Wifi menu on the settings page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with trunk Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('options.network', function() { 5 cr.define('options.network', function() {
6 6
7 var ArrayDataModel = cr.ui.ArrayDataModel; 7 var ArrayDataModel = cr.ui.ArrayDataModel;
8 var List = cr.ui.List; 8 var List = cr.ui.List;
9 var ListItem = cr.ui.ListItem; 9 var ListItem = cr.ui.ListItem;
10 var Menu = cr.ui.Menu; 10 var Menu = cr.ui.Menu;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return menu; 298 return menu;
299 } 299 }
300 return null; 300 return null;
301 }, 301 },
302 302
303 /** 303 /**
304 * Displays a popup menu. 304 * Displays a popup menu.
305 */ 305 */
306 showMenu: function() { 306 showMenu: function() {
307 var rebuild = false; 307 var rebuild = false;
308 // Force a rescan if opening the menu for WiFi networks to ensure the
309 // list is up to date. Networks are periodically rescanned, but depending
310 // on timing, there could be an excessive delay before the first rescan
311 // unless forced.
312 var rescan = !activeMenu_ && this.data_.key == 'wifi';
308 if (!this.menu_) { 313 if (!this.menu_) {
309 rebuild = true; 314 rebuild = true;
310 var existing = $(this.getMenuName_()); 315 var existing = $(this.getMenuName_());
311 if (existing) 316 if (existing)
312 closeMenu_(); 317 closeMenu_();
313 this.menu_ = this.createMenu(); 318 this.menu_ = this.createMenu();
314 this.menu_.addEventListener('mousedown', function(e) { 319 this.menu_.addEventListener('mousedown', function(e) {
315 // Prevent blurring of list, which would close the menu. 320 // Prevent blurring of list, which would close the menu.
316 e.preventDefault(); 321 e.preventDefault();
317 }, true); 322 }, true);
318 var parent = $('network-menus'); 323 var parent = $('network-menus');
319 if (existing) 324 if (existing)
320 parent.replaceChild(this.menu_, existing); 325 parent.replaceChild(this.menu_, existing);
321 else 326 else
322 parent.appendChild(this.menu_); 327 parent.appendChild(this.menu_);
323 } 328 }
324 var top = this.offsetTop + this.clientHeight; 329 var top = this.offsetTop + this.clientHeight;
325 var menuId = this.getMenuName_(); 330 var menuId = this.getMenuName_();
326 if (menuId != activeMenu_ || rebuild) { 331 if (menuId != activeMenu_ || rebuild) {
327 closeMenu_(); 332 closeMenu_();
328 activeMenu_ = menuId; 333 activeMenu_ = menuId;
329 this.menu_.style.setProperty('top', top + 'px'); 334 this.menu_.style.setProperty('top', top + 'px');
330 this.menu_.hidden = false; 335 this.menu_.hidden = false;
331 } 336 }
337 if (rescan)
338 chrome.send('refreshNetworks');
332 }, 339 },
333 }; 340 };
334 341
335 /** 342 /**
336 * Creates a control for selecting or configuring a network connection based 343 * Creates a control for selecting or configuring a network connection based
337 * on the type of connection (e.g. wifi versus vpn). 344 * on the type of connection (e.g. wifi versus vpn).
338 * @param {{key: string, 345 * @param {{key: string,
339 * networkList: Array.<Object>} data Description of the network. 346 * networkList: Array.<Object>} data Description of the network.
340 * @constructor 347 * @constructor
341 */ 348 */
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 * Whether the Network list is disabled. Only used for display purpose. 1002 * Whether the Network list is disabled. Only used for display purpose.
996 * @type {boolean} 1003 * @type {boolean}
997 */ 1004 */
998 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR); 1005 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR);
999 1006
1000 // Export 1007 // Export
1001 return { 1008 return {
1002 NetworkList: NetworkList 1009 NetworkList: NetworkList
1003 }; 1010 };
1004 }); 1011 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698