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="../shared/js/cr/ui/drag_wrapper.js"></include> | 5 <include src="../shared/js/cr/ui/drag_wrapper.js"></include> |
6 <include src="../uber/uber_utils.js"></include> | 6 <include src="../uber/uber_utils.js"></include> |
| 7 <include src="extension_commands_overlay.js"></include> |
7 <include src="extension_list.js"></include> | 8 <include src="extension_list.js"></include> |
8 <include src="pack_extension_overlay.js"></include> | 9 <include src="pack_extension_overlay.js"></include> |
9 | 10 |
10 // Used for observing function of the backend datasource for this page by | 11 // Used for observing function of the backend datasource for this page by |
11 // tests. | 12 // tests. |
12 var webui_responded_ = false; | 13 var webui_responded_ = false; |
13 | 14 |
14 cr.define('extensions', function() { | 15 cr.define('extensions', function() { |
15 var ExtensionsList = options.ExtensionsList; | 16 var ExtensionsList = options.ExtensionsList; |
16 | 17 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 this.handleUpdateExtensionNow_.bind(this)); | 95 this.handleUpdateExtensionNow_.bind(this)); |
95 | 96 |
96 if (!loadTimeData.getBoolean('offStoreInstallEnabled')) { | 97 if (!loadTimeData.getBoolean('offStoreInstallEnabled')) { |
97 this.dragWrapper_ = new cr.ui.DragWrapper(document.documentElement, | 98 this.dragWrapper_ = new cr.ui.DragWrapper(document.documentElement, |
98 dragWrapperHandler); | 99 dragWrapperHandler); |
99 } | 100 } |
100 | 101 |
101 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance(); | 102 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance(); |
102 packExtensionOverlay.initializePage(); | 103 packExtensionOverlay.initializePage(); |
103 | 104 |
| 105 // Hook up the configure commands link to the overlay. |
| 106 var link = document.querySelector('.extension-commands-config'); |
| 107 link.addEventListener('click', |
| 108 this.handleExtensionCommandsConfig_.bind(this)); |
| 109 |
| 110 // Initialize the Commands overlay. |
| 111 var extensionCommandsOverlay = |
| 112 extensions.ExtensionCommandsOverlay.getInstance(); |
| 113 extensionCommandsOverlay.initializePage(); |
| 114 |
104 cr.ui.overlay.setupOverlay($('dropTargetOverlay')); | 115 cr.ui.overlay.setupOverlay($('dropTargetOverlay')); |
105 }, | 116 }, |
106 | 117 |
107 /** | 118 /** |
108 * Handles the Load Unpacked Extension button. | 119 * Handles the Load Unpacked Extension button. |
109 * @param {Event} e Change event. | 120 * @param {Event} e Change event. |
110 * @private | 121 * @private |
111 */ | 122 */ |
112 handleLoadUnpackedExtension_: function(e) { | 123 handleLoadUnpackedExtension_: function(e) { |
113 chrome.send('extensionSettingsLoadUnpackedExtension'); | 124 chrome.send('extensionSettingsLoadUnpackedExtension'); |
114 | 125 |
115 // TODO(jhawkins): Refactor metrics support out of options and use it | 126 // TODO(jhawkins): Refactor metrics support out of options and use it |
116 // in extensions.html. | 127 // in extensions.html. |
117 chrome.send('coreOptionsUserMetricsAction', | 128 chrome.send('coreOptionsUserMetricsAction', |
118 ['Options_LoadUnpackedExtension']); | 129 ['Options_LoadUnpackedExtension']); |
119 }, | 130 }, |
120 | 131 |
121 /** | 132 /** |
122 * Handles the Pack Extension button. | 133 * Handles the Pack Extension button. |
123 * @param {Event} e Change event. | 134 * @param {Event} e Change event. |
124 * @private | 135 * @private |
125 */ | 136 */ |
126 handlePackExtension_: function(e) { | 137 handlePackExtension_: function(e) { |
127 ExtensionSettings.showOverlay($('packExtensionOverlay')); | 138 ExtensionSettings.showOverlay($('packExtensionOverlay')); |
128 chrome.send('coreOptionsUserMetricsAction', ['Options_PackExtension']); | 139 chrome.send('coreOptionsUserMetricsAction', ['Options_PackExtension']); |
129 }, | 140 }, |
130 | 141 |
131 /** | 142 /** |
| 143 * Handles the Configure (Extension) Commands link. |
| 144 * @param {Event} e Change event. |
| 145 * @private |
| 146 */ |
| 147 handleExtensionCommandsConfig_: function(e) { |
| 148 ExtensionSettings.showOverlay($('extensionCommandsOverlay')); |
| 149 chrome.send('coreOptionsUserMetricsAction', |
| 150 ['Options_ExtensionCommands']); |
| 151 }, |
| 152 |
| 153 /** |
132 * Handles the Update Extension Now button. | 154 * Handles the Update Extension Now button. |
133 * @param {Event} e Change event. | 155 * @param {Event} e Change event. |
134 * @private | 156 * @private |
135 */ | 157 */ |
136 handleUpdateExtensionNow_: function(e) { | 158 handleUpdateExtensionNow_: function(e) { |
137 chrome.send('extensionSettingsAutoupdate'); | 159 chrome.send('extensionSettingsAutoupdate'); |
138 }, | 160 }, |
139 | 161 |
140 /** | 162 /** |
141 * Handles the Toggle Dev Mode button. | 163 * Handles the Toggle Dev Mode button. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 return { | 311 return { |
290 ExtensionSettings: ExtensionSettings | 312 ExtensionSettings: ExtensionSettings |
291 }; | 313 }; |
292 }); | 314 }); |
293 | 315 |
294 var ExtensionSettings = extensions.ExtensionSettings; | 316 var ExtensionSettings = extensions.ExtensionSettings; |
295 | 317 |
296 window.addEventListener('load', function(e) { | 318 window.addEventListener('load', function(e) { |
297 ExtensionSettings.getInstance().initialize(); | 319 ExtensionSettings.getInstance().initialize(); |
298 }); | 320 }); |
OLD | NEW |