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