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

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

Issue 23447027: Merge 222390 "network_list.js should reflect the correct logged ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1599/src/
Patch Set: Created 7 years, 3 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 var enableDataRoaming_ = false; 105 var enableDataRoaming_ = false;
106 106
107 /** 107 /**
108 * Icon to use when not connected to a particular type of network. 108 * Icon to use when not connected to a particular type of network.
109 * @type {!Object.<string, string>} Mapping of network type to icon data url. 109 * @type {!Object.<string, string>} Mapping of network type to icon data url.
110 * @private 110 * @private
111 */ 111 */
112 var defaultIcons_ = {}; 112 var defaultIcons_ = {};
113 113
114 /** 114 /**
115 * Contains the current logged in user type, which is one of 'none',
116 * 'regular', 'owner', 'guest', 'retail-mode', 'public-account',
117 * 'locally-managed', and 'kiosk-app', or empty string if the data has not
118 * been set.
119 * @type {string}
120 * @private
121 */
122 var loggedInUserType_ = '';
123
124 /**
115 * Create an element in the network list for controlling network 125 * Create an element in the network list for controlling network
116 * connectivity. 126 * connectivity.
117 * @param {Object} data Description of the network list or command. 127 * @param {Object} data Description of the network list or command.
118 * @constructor 128 * @constructor
119 */ 129 */
120 function NetworkListItem(data) { 130 function NetworkListItem(data) {
121 var el = cr.doc.createElement('li'); 131 var el = cr.doc.createElement('li');
122 el.data_ = {}; 132 el.data_ = {};
123 for (var key in data) 133 for (var key in data)
124 el.data_[key] = data[key]; 134 el.data_[key] = data[key];
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 label: loadTimeData.getString('otherCellularNetworks'), 466 label: loadTimeData.getString('otherCellularNetworks'),
457 command: createAddConnectionCallback_(Constants.TYPE_CELLULAR), 467 command: createAddConnectionCallback_(Constants.TYPE_CELLULAR),
458 addClass: ['other-cellulars'], 468 addClass: ['other-cellulars'],
459 data: {} 469 data: {}
460 }; 470 };
461 addendum.push(entry); 471 addendum.push(entry);
462 } 472 }
463 473
464 var label = enableDataRoaming_ ? 'disableDataRoaming' : 474 var label = enableDataRoaming_ ? 'disableDataRoaming' :
465 'enableDataRoaming'; 475 'enableDataRoaming';
466 var disabled = !UIAccountTweaks.currentUserIsOwner(); 476 var disabled = loggedInUserType_ != 'owner';
467 var entry = {label: loadTimeData.getString(label), 477 var entry = {label: loadTimeData.getString(label),
468 data: {}}; 478 data: {}};
469 if (disabled) { 479 if (disabled) {
470 entry.command = null; 480 entry.command = null;
471 entry.tooltip = 481 entry.tooltip =
472 loadTimeData.getString('dataRoamingDisableToggleTooltip'); 482 loadTimeData.getString('dataRoamingDisableToggleTooltip');
473 } else { 483 } else {
474 var self = this; 484 var self = this;
475 entry.command = function() { 485 entry.command = function() {
476 options.Preferences.setBooleanPref( 486 options.Preferences.setBooleanPref(
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 /** 936 /**
927 * Sets the default icon to use for each network type if disconnected. 937 * Sets the default icon to use for each network type if disconnected.
928 * @param {!Object.<string, string>} data Mapping of network type to icon 938 * @param {!Object.<string, string>} data Mapping of network type to icon
929 * data url. 939 * data url.
930 */ 940 */
931 NetworkList.setDefaultNetworkIcons = function(data) { 941 NetworkList.setDefaultNetworkIcons = function(data) {
932 defaultIcons_ = Object.create(data); 942 defaultIcons_ = Object.create(data);
933 }; 943 };
934 944
935 /** 945 /**
946 * Sets the current logged in user type.
947 * @param {string} userType Current logged in user type.
948 */
949 NetworkList.updateLoggedInUserType = function(userType) {
950 loggedInUserType_ = String(userType);
951 };
952
953 /**
936 * Chrome callback for updating network controls. 954 * Chrome callback for updating network controls.
937 * @param {Object} data Description of available network devices and their 955 * @param {Object} data Description of available network devices and their
938 * corresponding state. 956 * corresponding state.
939 */ 957 */
940 NetworkList.refreshNetworkData = function(data) { 958 NetworkList.refreshNetworkData = function(data) {
941 var networkList = $('network-list'); 959 var networkList = $('network-list');
942 networkList.startBatchUpdates(); 960 networkList.startBatchUpdates();
943 cellularAvailable_ = data.cellularAvailable; 961 cellularAvailable_ = data.cellularAvailable;
944 cellularEnabled_ = data.cellularEnabled; 962 cellularEnabled_ = data.cellularEnabled;
945 cellularSupportsScan_ = data.cellularSupportsScan; 963 cellularSupportsScan_ = data.cellularSupportsScan;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 * Whether the Network list is disabled. Only used for display purpose. 1175 * Whether the Network list is disabled. Only used for display purpose.
1158 * @type {boolean} 1176 * @type {boolean}
1159 */ 1177 */
1160 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR); 1178 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR);
1161 1179
1162 // Export 1180 // Export
1163 return { 1181 return {
1164 NetworkList: NetworkList 1182 NetworkList: NetworkList
1165 }; 1183 };
1166 }); 1184 });
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