Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/browser/resources/extensions/extensions.js

Issue 10444100: Implements a focus manager for the extensions page. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_commands_overlay.js"></include>
8 <include src="extension_focus_manager.js"></include>
8 <include src="extension_list.js"></include> 9 <include src="extension_list.js"></include>
9 <include src="pack_extension_overlay.js"></include> 10 <include src="pack_extension_overlay.js"></include>
10 11
11 // Used for observing function of the backend datasource for this page by 12 // Used for observing function of the backend datasource for this page by
12 // tests. 13 // tests.
13 var webui_responded_ = false; 14 var webui_responded_ = false;
14 15
15 cr.define('extensions', function() { 16 cr.define('extensions', function() {
16 var ExtensionsList = options.ExtensionsList; 17 var ExtensionsList = options.ExtensionsList;
17 18
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 var link = document.querySelector('.extension-commands-config'); 107 var link = document.querySelector('.extension-commands-config');
107 link.addEventListener('click', 108 link.addEventListener('click',
108 this.handleExtensionCommandsConfig_.bind(this)); 109 this.handleExtensionCommandsConfig_.bind(this));
109 110
110 // Initialize the Commands overlay. 111 // Initialize the Commands overlay.
111 var extensionCommandsOverlay = 112 var extensionCommandsOverlay =
112 extensions.ExtensionCommandsOverlay.getInstance(); 113 extensions.ExtensionCommandsOverlay.getInstance();
113 extensionCommandsOverlay.initializePage(); 114 extensionCommandsOverlay.initializePage();
114 115
115 cr.ui.overlay.setupOverlay($('dropTargetOverlay')); 116 cr.ui.overlay.setupOverlay($('dropTargetOverlay'));
117
118 extensions.ExtensionFocusManager.getInstance().initialize();
116 }, 119 },
117 120
118 /** 121 /**
119 * Handles the Load Unpacked Extension button. 122 * Handles the Load Unpacked Extension button.
120 * @param {Event} e Change event. 123 * @param {Event} e Change event.
121 * @private 124 * @private
122 */ 125 */
123 handleLoadUnpackedExtension_: function(e) { 126 handleLoadUnpackedExtension_: function(e) {
124 chrome.send('extensionSettingsLoadUnpackedExtension'); 127 chrome.send('extensionSettingsLoadUnpackedExtension');
125 128
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 loadTimeData.getString('cancel'), 255 loadTimeData.getString('cancel'),
253 function() { 256 function() {
254 chrome.send('pack', [crx_path, pem_path, overrideFlags]); 257 chrome.send('pack', [crx_path, pem_path, overrideFlags]);
255 closeAlert(); 258 closeAlert();
256 }, 259 },
257 closeAlert); 260 closeAlert);
258 ExtensionSettings.showOverlay($('alertOverlay')); 261 ExtensionSettings.showOverlay($('alertOverlay'));
259 } 262 }
260 263
261 /** 264 /**
265 * Returns the current overlay or null if one does not exist.
266 * @return {Element} The overlay element.
267 */
268 ExtensionSettings.getCurrentOverlay = function() {
269 return document.querySelector('#overlay .page.showing');
270 }
271
272 /**
262 * Sets the given overlay to show. This hides whatever overlay is currently 273 * Sets the given overlay to show. This hides whatever overlay is currently
263 * showing, if any. 274 * showing, if any.
264 * @param {HTMLElement} node The overlay page to show. If falsey, all overlays 275 * @param {HTMLElement} node The overlay page to show. If falsey, all overlays
265 * are hidden. 276 * are hidden.
266 */ 277 */
267 ExtensionSettings.showOverlay = function(node) { 278 ExtensionSettings.showOverlay = function(node) {
268 var currentlyShowingOverlay = 279 var currentlyShowingOverlay = ExtensionSettings.getCurrentOverlay();
269 document.querySelector('#overlay .page.showing');
270 if (currentlyShowingOverlay) 280 if (currentlyShowingOverlay)
271 currentlyShowingOverlay.classList.remove('showing'); 281 currentlyShowingOverlay.classList.remove('showing');
272 282
273 if (node) 283 if (node)
274 node.classList.add('showing'); 284 node.classList.add('showing');
275 overlay.hidden = !node; 285 overlay.hidden = !node;
276 uber.invokeMethodOnParent(node ? 'beginInterceptingEvents' : 286 uber.invokeMethodOnParent(node ? 'beginInterceptingEvents' :
277 'stopInterceptingEvents'); 287 'stopInterceptingEvents');
278 } 288 }
279 289
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return { 321 return {
312 ExtensionSettings: ExtensionSettings 322 ExtensionSettings: ExtensionSettings
313 }; 323 };
314 }); 324 });
315 325
316 var ExtensionSettings = extensions.ExtensionSettings; 326 var ExtensionSettings = extensions.ExtensionSettings;
317 327
318 window.addEventListener('load', function(e) { 328 window.addEventListener('load', function(e) {
319 ExtensionSettings.getInstance().initialize(); 329 ExtensionSettings.getInstance().initialize();
320 }); 330 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/extensions/extensions.html ('k') | chrome/browser/resources/shared/js/cr/ui/overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698