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

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

Issue 862403006: extensions: fix focus management for all dialogs (not just options). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@classList-fix
Patch Set: kalman@ review Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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('extensions', function() { 5 cr.define('extensions', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * The ExtensionOptionsOverlay will show an extension's options page using 9 * The ExtensionOptionsOverlay will show an extension's options page using
10 * an <extensionoptions> element. 10 * an <extensionoptions> element.
(...skipping 26 matching lines...) Expand all
37 cr.ui.overlay.globalInitialization(); 37 cr.ui.overlay.globalInitialization();
38 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this)); 38 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this));
39 39
40 this.showOverlay_ = showOverlay; 40 this.showOverlay_ = showOverlay;
41 }, 41 },
42 42
43 setInitialFocus: function() { 43 setInitialFocus: function() {
44 this.getExtensionOptions_().focus(); 44 this.getExtensionOptions_().focus();
45 }, 45 },
46 46
47 /** @return {?Element} */ 47 /**
48 * @return {?Element}
49 * @private
50 */
48 getExtensionOptions_: function() { 51 getExtensionOptions_: function() {
49 return $('extension-options-overlay-guest').querySelector( 52 return $('extension-options-overlay-guest').querySelector(
50 'extensionoptions'); 53 'extensionoptions');
51 }, 54 },
52 55
53 /** 56 /**
54 * Handles a click on the close button. 57 * Handles a click on the close button.
55 * @param {Event} event The click event. 58 * @param {Event} event The click event.
56 * @private 59 * @private
57 */ 60 */
58 handleDismiss_: function(event) { 61 handleDismiss_: function(event) {
59 this.setVisible_(false); 62 this.setVisible_(false);
60 var extensionoptions = this.getExtensionOptions_(); 63 var extensionoptions = this.getExtensionOptions_();
61 if (extensionoptions) 64 if (extensionoptions)
62 $('extension-options-overlay-guest').removeChild(extensionoptions); 65 $('extension-options-overlay-guest').removeChild(extensionoptions);
63 66
64 $('extension-options-overlay-icon').removeAttribute('src'); 67 $('extension-options-overlay-icon').removeAttribute('src');
65 68
66 // Remove the options query string. 69 // Remove the options query string.
67 uber.replaceState({}, ''); 70 uber.replaceState({}, '');
68 }, 71 },
69 72
70 /** 73 /**
71 * Associate an extension with the overlay and display it. 74 * Associate an extension with the overlay and display it.
72 * @param {string} extensionId The id of the extension whose options page 75 * @param {string} extensionId The id of the extension whose options page
73 * should be displayed in the overlay. 76 * should be displayed in the overlay.
74 * @param {string} extensionName The name of the extension, which is used 77 * @param {string} extensionName The name of the extension, which is used
75 * as the header of the overlay. 78 * as the header of the overlay.
76 * @param {string} extensionIcon The URL of the extension's icon. 79 * @param {string} extensionIcon The URL of the extension's icon.
77 * @param {function():void} shownCallback A function called when show 80 * @param {function():void} shownCallback A function called when
78 * animation completes. 81 * showing completes.
79 * @suppress {checkTypes} 82 * @suppress {checkTypes}
80 * TODO(vitalyp): remove the suppression after adding 83 * TODO(vitalyp): remove the suppression after adding
81 * chrome/renderer/resources/extensions/extension_options.js 84 * chrome/renderer/resources/extensions/extension_options.js
82 * to dependencies. 85 * to dependencies.
83 */ 86 */
84 setExtensionAndShowOverlay: function(extensionId, 87 setExtensionAndShowOverlay: function(extensionId,
85 extensionName, 88 extensionName,
86 extensionIcon, 89 extensionIcon,
87 shownCallback) { 90 shownCallback) {
88 var overlay = $('extension-options-overlay'); 91 var overlay = $('extension-options-overlay');
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 /** @type {HTMLDivElement} */($('extension-options-overlay')) : 193 /** @type {HTMLDivElement} */($('extension-options-overlay')) :
191 null); 194 null);
192 } 195 }
193 }; 196 };
194 197
195 // Export 198 // Export
196 return { 199 return {
197 ExtensionOptionsOverlay: ExtensionOptionsOverlay 200 ExtensionOptionsOverlay: ExtensionOptionsOverlay
198 }; 201 };
199 }); 202 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/extensions/extension_list.js ('k') | chrome/browser/resources/extensions/extensions.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698