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

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

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed feedback Created 6 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 | Annotate | Revision Log
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 ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; 10 var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 self.menu_ = null; 472 self.menu_ = null;
473 }; 473 };
474 } 474 }
475 addendum.push(entry); 475 addendum.push(entry);
476 } 476 }
477 var list = this.data.rememberedNetworks; 477 var list = this.data.rememberedNetworks;
478 if (list && list.length > 0) { 478 if (list && list.length > 0) {
479 var callback = function(list) { 479 var callback = function(list) {
480 $('remembered-network-list').clear(); 480 $('remembered-network-list').clear();
481 var dialog = options.PreferredNetworks.getInstance(); 481 var dialog = options.PreferredNetworks.getInstance();
482 OptionsPage.showPageByName('preferredNetworksPage', false); 482 PageManager.showPageByName('preferredNetworksPage', false);
483 dialog.update(list); 483 dialog.update(list);
484 chrome.send('coreOptionsUserMetricsAction', 484 chrome.send('coreOptionsUserMetricsAction',
485 ['Options_NetworkShowPreferred']); 485 ['Options_NetworkShowPreferred']);
486 }; 486 };
487 addendum.push({label: loadTimeData.getString('preferredNetworks'), 487 addendum.push({label: loadTimeData.getString('preferredNetworks'),
488 command: callback, 488 command: callback,
489 data: list}); 489 data: list});
490 } 490 }
491 491
492 var networkGroup = this.ownerDocument.createElement('div'); 492 var networkGroup = this.ownerDocument.createElement('div');
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 this.selectionModel.unselectAll(); 801 this.selectionModel.unselectAll();
802 closeMenu_(); 802 closeMenu_();
803 }, 803 },
804 804
805 /** 805 /**
806 * Close bubble and menu when a different list item is selected. 806 * Close bubble and menu when a different list item is selected.
807 * @param {Event} event Event detailing the selection change. 807 * @param {Event} event Event detailing the selection change.
808 * @private 808 * @private
809 */ 809 */
810 onSelectionChange_: function(event) { 810 onSelectionChange_: function(event) {
811 OptionsPage.hideBubble(); 811 PageManager.hideBubble();
812 // A list item may temporarily become unselected while it is constructing 812 // A list item may temporarily become unselected while it is constructing
813 // its menu. The menu should therefore only be closed if a different item 813 // its menu. The menu should therefore only be closed if a different item
814 // is selected, not when the menu's owner item is deselected. 814 // is selected, not when the menu's owner item is deselected.
815 if (activeMenu_) { 815 if (activeMenu_) {
816 for (var i = 0; i < event.changes.length; ++i) { 816 for (var i = 0; i < event.changes.length; ++i) {
817 if (event.changes[i].selected) { 817 if (event.changes[i].selected) {
818 var item = this.dataModel.item(event.changes[i].index); 818 var item = this.dataModel.item(event.changes[i].index);
819 if (!item.getMenuName || item.getMenuName() != activeMenu_) { 819 if (!item.getMenuName || item.getMenuName() != activeMenu_) {
820 closeMenu_(); 820 closeMenu_();
821 return; 821 return;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 event.preventDefault(); 1056 event.preventDefault();
1057 event.stopPropagation(); 1057 event.stopPropagation();
1058 }, 1058 },
1059 1059
1060 /** @override */ 1060 /** @override */
1061 toggleBubble_: function() { 1061 toggleBubble_: function() {
1062 if (activeMenu_ && !$(activeMenu_).contains(this)) 1062 if (activeMenu_ && !$(activeMenu_).contains(this))
1063 closeMenu_(); 1063 closeMenu_();
1064 ControlledSettingIndicator.prototype.toggleBubble_.call(this); 1064 ControlledSettingIndicator.prototype.toggleBubble_.call(this);
1065 if (this.showingBubble) { 1065 if (this.showingBubble) {
1066 var bubble = OptionsPage.getVisibleBubble(); 1066 var bubble = PageManager.getVisibleBubble();
1067 bubble.addEventListener('mousedown', this.stopEvent); 1067 bubble.addEventListener('mousedown', this.stopEvent);
1068 bubble.addEventListener('click', this.stopEvent); 1068 bubble.addEventListener('click', this.stopEvent);
1069 } 1069 }
1070 } 1070 }
1071 }; 1071 };
1072 1072
1073 /** 1073 /**
1074 * Updates the list of available networks and their status, filtered by 1074 * Updates the list of available networks and their status, filtered by
1075 * network type. 1075 * network type.
1076 * @param {string} type The type of network. 1076 * @param {string} type The type of network.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 * Whether the Network list is disabled. Only used for display purpose. 1144 * Whether the Network list is disabled. Only used for display purpose.
1145 * @type {boolean} 1145 * @type {boolean}
1146 */ 1146 */
1147 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR); 1147 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR);
1148 1148
1149 // Export 1149 // Export
1150 return { 1150 return {
1151 NetworkList: NetworkList 1151 NetworkList: NetworkList
1152 }; 1152 };
1153 }); 1153 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698