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

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

Issue 383013002: Remove additional dependencies from InternetOptionsHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rip out awkward debugging code Created 6 years, 5 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/options/chromeos/internet_options_handler.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 ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; 10 var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 var enableDataRoaming_ = false; 85 var enableDataRoaming_ = false;
86 86
87 /** 87 /**
88 * Icon to use when not connected to a particular type of network. 88 * Icon to use when not connected to a particular type of network.
89 * @type {!Object.<string, string>} Mapping of network type to icon data url. 89 * @type {!Object.<string, string>} Mapping of network type to icon data url.
90 * @private 90 * @private
91 */ 91 */
92 var defaultIcons_ = {}; 92 var defaultIcons_ = {};
93 93
94 /** 94 /**
95 * Contains the current logged in user type, which is one of 'none',
96 * 'regular', 'owner', 'guest', 'retail-mode', 'public-account',
97 * 'locally-managed', and 'kiosk-app', or empty string if the data has not
98 * been set.
99 * @type {string}
100 * @private
101 */
102 var loggedInUserType_ = '';
103
104 /**
105 * Returns the display name for 'network'. 95 * Returns the display name for 'network'.
106 * @param {Object} data The network data dictionary. 96 * @param {Object} data The network data dictionary.
107 */ 97 */
108 function getNetworkName(data) { 98 function getNetworkName(data) {
109 if (data.Type == 'Ethernet') 99 if (data.Type == 'Ethernet')
110 return loadTimeData.getString('ethernetName'); 100 return loadTimeData.getString('ethernetName');
111 return data.Name; 101 return data.Name;
112 } 102 }
113 103
114 /** 104 /**
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 label: loadTimeData.getString('otherCellularNetworks'), 448 label: loadTimeData.getString('otherCellularNetworks'),
459 command: createAddConnectionCallback_('Cellular'), 449 command: createAddConnectionCallback_('Cellular'),
460 addClass: ['other-cellulars'], 450 addClass: ['other-cellulars'],
461 data: {} 451 data: {}
462 }; 452 };
463 addendum.push(entry); 453 addendum.push(entry);
464 } 454 }
465 455
466 var label = enableDataRoaming_ ? 'disableDataRoaming' : 456 var label = enableDataRoaming_ ? 'disableDataRoaming' :
467 'enableDataRoaming'; 457 'enableDataRoaming';
468 var disabled = loggedInUserType_ != 'owner'; 458 var disabled = !loadTimeData.getValue('loggedInAsOwner');
469 var entry = {label: loadTimeData.getString(label), 459 var entry = {label: loadTimeData.getString(label),
470 data: {}}; 460 data: {}};
471 if (disabled) { 461 if (disabled) {
472 entry.command = null; 462 entry.command = null;
473 entry.tooltip = 463 entry.tooltip =
474 loadTimeData.getString('dataRoamingDisableToggleTooltip'); 464 loadTimeData.getString('dataRoamingDisableToggleTooltip');
475 } else { 465 } else {
476 var self = this; 466 var self = this;
477 entry.command = function() { 467 entry.command = function() {
478 options.Preferences.setBooleanPref( 468 options.Preferences.setBooleanPref(
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 /** 925 /**
936 * Sets the default icon to use for each network type if disconnected. 926 * Sets the default icon to use for each network type if disconnected.
937 * @param {!Object.<string, string>} data Mapping of network type to icon 927 * @param {!Object.<string, string>} data Mapping of network type to icon
938 * data url. 928 * data url.
939 */ 929 */
940 NetworkList.setDefaultNetworkIcons = function(data) { 930 NetworkList.setDefaultNetworkIcons = function(data) {
941 defaultIcons_ = Object.create(data); 931 defaultIcons_ = Object.create(data);
942 }; 932 };
943 933
944 /** 934 /**
945 * Sets the current logged in user type.
946 * @param {string} userType Current logged in user type.
947 */
948 NetworkList.updateLoggedInUserType = function(userType) {
949 loggedInUserType_ = String(userType);
950 };
951
952 /**
953 * Chrome callback for updating network controls. 935 * Chrome callback for updating network controls.
954 * @param {Object} data Description of available network devices and their 936 * @param {Object} data Description of available network devices and their
955 * corresponding state. 937 * corresponding state.
956 */ 938 */
957 NetworkList.refreshNetworkData = function(data) { 939 NetworkList.refreshNetworkData = function(data) {
958 var networkList = $('network-list'); 940 var networkList = $('network-list');
959 networkList.startBatchUpdates(); 941 networkList.startBatchUpdates();
960 cellularAvailable_ = data.cellularAvailable; 942 cellularAvailable_ = data.cellularAvailable;
961 cellularEnabled_ = data.cellularEnabled; 943 cellularEnabled_ = data.cellularEnabled;
962 cellularSupportsScan_ = data.cellularSupportsScan; 944 cellularSupportsScan_ = data.cellularSupportsScan;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 * Whether the Network list is disabled. Only used for display purpose. 1144 * Whether the Network list is disabled. Only used for display purpose.
1163 * @type {boolean} 1145 * @type {boolean}
1164 */ 1146 */
1165 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR); 1147 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR);
1166 1148
1167 // Export 1149 // Export
1168 return { 1150 return {
1169 NetworkList: NetworkList 1151 NetworkList: NetworkList
1170 }; 1152 };
1171 }); 1153 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/chromeos/internet_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698