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 <include src="extension_command_list.js"> | 5 <include src="extension_command_list.js"> |
6 | 6 |
7 cr.define('extensions', function() { | 7 cr.define('extensions', function() { |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 // The Extension Commands list object that will be used to show the commands | 10 // The Extension Commands list object that will be used to show the commands |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 * @param {Event} e The click event. | 44 * @param {Event} e The click event. |
45 */ | 45 */ |
46 handleDismiss_: function(e) { | 46 handleDismiss_: function(e) { |
47 extensions.ExtensionSettings.showOverlay(null); | 47 extensions.ExtensionSettings.showOverlay(null); |
48 }, | 48 }, |
49 }; | 49 }; |
50 | 50 |
51 /** | 51 /** |
52 * Called by the dom_ui_ to re-populate the page with data representing | 52 * Called by the dom_ui_ to re-populate the page with data representing |
53 * the current state of extension commands. | 53 * the current state of extension commands. |
54 * @param {!{commands: Array.<{name: string, id: string, commands: ?Array}>}} | |
55 * extensionsData | |
56 */ | 54 */ |
57 ExtensionCommandsOverlay.returnExtensionsData = function(extensionsData) { | 55 ExtensionCommandsOverlay.returnExtensionsData = function(extensionsData) { |
58 ExtensionCommandList.prototype.data_ = extensionsData; | 56 ExtensionCommandList.prototype.data_ = extensionsData; |
59 var extensionCommandList = $('extension-command-list'); | 57 var extensionCommandList = $('extension-command-list'); |
60 ExtensionCommandList.decorate(extensionCommandList); | 58 ExtensionCommandList.decorate(extensionCommandList); |
61 | 59 |
62 // Make sure the config link is visible, since there are commands to show | 60 // Make sure the config link is visible, since there are commands to show |
63 // and potentially configure. | 61 // and potentially configure. |
64 document.querySelector('.extension-commands-config').hidden = | 62 document.querySelector('.extension-commands-config').hidden = |
65 extensionsData.commands.length == 0; | 63 extensionsData.commands.length == 0; |
66 | 64 |
67 $('no-commands').hidden = extensionsData.commands.length > 0; | 65 $('no-commands').hidden = extensionsData.commands.length > 0; |
68 var list = $('extension-command-list'); | 66 var list = $('extension-command-list'); |
69 if (extensionsData.commands.length == 0) | 67 if (extensionsData.commands.length == 0) |
70 list.classList.add('empty-extension-commands-list'); | 68 list.classList.add('empty-extension-commands-list'); |
71 else | 69 else |
72 list.classList.remove('empty-extension-commands-list'); | 70 list.classList.remove('empty-extension-commands-list'); |
73 }; | 71 } |
74 | 72 |
75 // Export | 73 // Export |
76 return { | 74 return { |
77 ExtensionCommandsOverlay: ExtensionCommandsOverlay | 75 ExtensionCommandsOverlay: ExtensionCommandsOverlay |
78 }; | 76 }; |
79 }); | 77 }); |
OLD | NEW |