OLD | NEW |
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 var ArrayDataModel = cr.ui.ArrayDataModel; | 6 var ArrayDataModel = cr.ui.ArrayDataModel; |
7 var List = cr.ui.List; | 7 var List = cr.ui.List; |
8 var ListItem = cr.ui.ListItem; | 8 var ListItem = cr.ui.ListItem; |
9 var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; | 9 var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; |
10 var Menu = cr.ui.Menu; | 10 var Menu = cr.ui.Menu; |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 loadData_('VPN', data.vpnList, data.rememberedList); | 996 loadData_('VPN', data.vpnList, data.rememberedList); |
997 else | 997 else |
998 networkList.deleteItem('VPN'); | 998 networkList.deleteItem('VPN'); |
999 networkList.endBatchUpdates(); | 999 networkList.endBatchUpdates(); |
1000 }; | 1000 }; |
1001 | 1001 |
1002 /** | 1002 /** |
1003 * Replaces a network menu with a button for reenabling the type of network. | 1003 * Replaces a network menu with a button for reenabling the type of network. |
1004 * @param {string} name The type of network (WiFi, Cellular or Wimax). | 1004 * @param {string} name The type of network (WiFi, Cellular or Wimax). |
1005 * @param {string} command The command for reenabling the network. | 1005 * @param {string} command The command for reenabling the network. |
1006 * @param {string} type of icon (WiFi or Cellular). | 1006 * @param {string} icon Type of icon (WiFi or Cellular). |
1007 * @private | 1007 * @private |
1008 */ | 1008 */ |
1009 function addEnableNetworkButton_(name, command, icon) { | 1009 function addEnableNetworkButton_(name, command, icon) { |
1010 var subtitle = loadTimeData.getString('networkDisabled'); | 1010 var subtitle = loadTimeData.getString('networkDisabled'); |
1011 var enableNetwork = function() { | 1011 var enableNetwork = function() { |
1012 chrome.send(command); | 1012 chrome.send(command); |
1013 }; | 1013 }; |
1014 var networkList = $('network-list'); | 1014 var networkList = $('network-list'); |
1015 networkList.update({key: name, | 1015 networkList.update({key: name, |
1016 subtitle: subtitle, | 1016 subtitle: subtitle, |
(...skipping 29 matching lines...) Expand all Loading... |
1046 // Prevent focus blurring as that would close any currently open menu. | 1046 // Prevent focus blurring as that would close any currently open menu. |
1047 if (event.type == 'mousedown') | 1047 if (event.type == 'mousedown') |
1048 return; | 1048 return; |
1049 ControlledSettingIndicator.prototype.handleEvent.call(this, event); | 1049 ControlledSettingIndicator.prototype.handleEvent.call(this, event); |
1050 }, | 1050 }, |
1051 | 1051 |
1052 /** | 1052 /** |
1053 * Handle mouse events received by the bubble, preventing focus blurring as | 1053 * Handle mouse events received by the bubble, preventing focus blurring as |
1054 * that would close any currently open menu and preventing propagation to | 1054 * that would close any currently open menu and preventing propagation to |
1055 * any elements located behind the bubble. | 1055 * any elements located behind the bubble. |
1056 * @param {Event} Mouse event. | 1056 * @param {Event} event Mouse event. |
1057 */ | 1057 */ |
1058 stopEvent: function(event) { | 1058 stopEvent: function(event) { |
1059 event.preventDefault(); | 1059 event.preventDefault(); |
1060 event.stopPropagation(); | 1060 event.stopPropagation(); |
1061 }, | 1061 }, |
1062 | 1062 |
1063 /** @override */ | 1063 /** @override */ |
1064 toggleBubble_: function() { | 1064 toggleBubble_: function() { |
1065 if (activeMenu_ && !$(activeMenu_).contains(this)) | 1065 if (activeMenu_ && !$(activeMenu_).contains(this)) |
1066 closeMenu_(); | 1066 closeMenu_(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 * Whether the Network list is disabled. Only used for display purpose. | 1147 * Whether the Network list is disabled. Only used for display purpose. |
1148 * @type {boolean} | 1148 * @type {boolean} |
1149 */ | 1149 */ |
1150 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR); | 1150 cr.defineProperty(NetworkList, 'disabled', cr.PropertyKind.BOOL_ATTR); |
1151 | 1151 |
1152 // Export | 1152 // Export |
1153 return { | 1153 return { |
1154 NetworkList: NetworkList | 1154 NetworkList: NetworkList |
1155 }; | 1155 }; |
1156 }); | 1156 }); |
OLD | NEW |