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 |
11 // on the page. | 11 // on the page. |
12 var ExtensionCommandList = extensions.ExtensionCommandList; | 12 var ExtensionCommandList = extensions.ExtensionCommandList; |
13 | 13 |
14 /** | 14 /** |
15 * ExtensionCommandsOverlay class | 15 * ExtensionCommandsOverlay class |
16 * Encapsulated handling of the 'Extension Commands' overlay page. | 16 * Encapsulated handling of the 'Extension Commands' overlay page. |
17 * @constructor | 17 * @constructor |
18 */ | 18 */ |
19 function ExtensionCommandsOverlay() { | 19 function ExtensionCommandsOverlay() {} |
20 } | |
21 | 20 |
22 cr.addSingletonGetter(ExtensionCommandsOverlay); | 21 cr.addSingletonGetter(ExtensionCommandsOverlay); |
23 | 22 |
24 ExtensionCommandsOverlay.prototype = { | 23 ExtensionCommandsOverlay.prototype = { |
25 /** | 24 /** |
26 * Initialize the page. | 25 * Initialize the page. |
27 */ | 26 */ |
28 initializePage: function() { | 27 initializePage: function() { |
29 var overlay = $('overlay'); | 28 var overlay = $('overlay'); |
30 cr.ui.overlay.setupOverlay(overlay); | 29 cr.ui.overlay.setupOverlay(overlay); |
31 cr.ui.overlay.globalInitialization(); | 30 cr.ui.overlay.globalInitialization(); |
32 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this)); | 31 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this)); |
33 | 32 |
34 this.extensionCommandList_ = new ExtensionCommandList( | 33 this.extensionCommandList_ = new ExtensionCommandList( |
35 /**@type {HTMLDivElement} */($('extension-command-list'))); | 34 /**@type {HTMLDivElement} */ ($('extension-command-list'))); |
36 | 35 |
37 $('extension-commands-dismiss').addEventListener('click', function() { | 36 $('extension-commands-dismiss').addEventListener('click', function() { |
38 cr.dispatchSimpleEvent(overlay, 'cancelOverlay'); | 37 cr.dispatchSimpleEvent(overlay, 'cancelOverlay'); |
39 }); | 38 }); |
40 | 39 |
41 // The ExtensionList will update us with its data, so we don't need to | 40 // The ExtensionList will update us with its data, so we don't need to |
42 // handle that here. | 41 // handle that here. |
43 }, | 42 }, |
44 | 43 |
45 /** | 44 /** |
(...skipping 26 matching lines...) Expand all Loading... |
72 // and potentially configure. | 71 // and potentially configure. |
73 document.querySelector('.extension-commands-config').hidden = | 72 document.querySelector('.extension-commands-config').hidden = |
74 !hasAnyCommands; | 73 !hasAnyCommands; |
75 | 74 |
76 $('no-commands').hidden = hasAnyCommands; | 75 $('no-commands').hidden = hasAnyCommands; |
77 overlay.extensionCommandList_.classList.toggle( | 76 overlay.extensionCommandList_.classList.toggle( |
78 'empty-extension-commands-list', !hasAnyCommands); | 77 'empty-extension-commands-list', !hasAnyCommands); |
79 }; | 78 }; |
80 | 79 |
81 // Export | 80 // Export |
82 return { | 81 return {ExtensionCommandsOverlay: ExtensionCommandsOverlay}; |
83 ExtensionCommandsOverlay: ExtensionCommandsOverlay | |
84 }; | |
85 }); | 82 }); |
OLD | NEW |