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

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

Issue 490783002: Handle closing web contents in ExtensionOptionsGuest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 4 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 29 matching lines...) Expand all
40 this.showOverlay_ = showOverlay; 40 this.showOverlay_ = showOverlay;
41 }, 41 },
42 42
43 /** 43 /**
44 * Handles a click on the close button. 44 * Handles a click on the close button.
45 * @param {Event} e The click event. 45 * @param {Event} e The click event.
46 * @private 46 * @private
47 */ 47 */
48 handleDismiss_: function(event) { 48 handleDismiss_: function(event) {
49 this.setVisible_(false); 49 this.setVisible_(false);
50 var extensionoptions = document.querySelector('extensionoptions'); 50 var extensionoptions =
51 $('extension-options-overlay-guest')
52 .querySelector('extensionoptions');
53
51 if (extensionoptions) 54 if (extensionoptions)
52 $('extension-options-overlay').removeChild(extensionoptions); 55 $('extension-options-overlay-guest').removeChild(extensionoptions);
53 }, 56 },
54 57
55 /** 58 /**
56 * Associate an extension with the overlay and display it. 59 * Associate an extension with the overlay and display it.
57 * @param {string} extensionId The id of the extension whose options page 60 * @param {string} extensionId The id of the extension whose options page
58 * should be displayed in the overlay. 61 * should be displayed in the overlay.
59 * @param {string} extensionName The name of the extension, which is used 62 * @param {string} extensionName The name of the extension, which is used
60 * as the header of the overlay. 63 * as the header of the overlay.
61 */ 64 */
62 setExtensionAndShowOverlay: function(extensionId, extensionName) { 65 setExtensionAndShowOverlay: function(extensionId, extensionName) {
63 var extensionoptions = new ExtensionOptions(); 66 var extensionoptions = new ExtensionOptions();
64 extensionoptions.extension = extensionId; 67 extensionoptions.extension = extensionId;
65 extensionoptions.autosize = 'on'; 68 extensionoptions.autosize = 'on';
66 69
70 extensionoptions.onclose = function() {
71 this.handleDismiss_();
72 }.bind(this);
73
67 // TODO(ericzeng): Resize in a non-jarring way. 74 // TODO(ericzeng): Resize in a non-jarring way.
68 extensionoptions.onsizechanged = function(evt) { 75 extensionoptions.onsizechanged = function(evt) {
69 $('extension-options-overlay').style.width = evt.width; 76 $('extension-options-overlay').style.width = evt.width;
70 $('extension-options-overlay').style.height = evt.height; 77 $('extension-options-overlay').style.height = evt.height;
71 }.bind(this); 78 }.bind(this);
72 79
73 $('extension-options-overlay').appendChild(extensionoptions); 80 $('extension-options-overlay-guest').appendChild(extensionoptions);
74 81
75 $('extension-options-overlay-title').textContent = extensionName; 82 $('extension-options-overlay-title').textContent = extensionName;
76 83
77 this.setVisible_(true); 84 this.setVisible_(true);
78 }, 85 },
79 86
80 /** 87 /**
81 * Toggles the visibility of the ExtensionOptionsOverlay. 88 * Toggles the visibility of the ExtensionOptionsOverlay.
82 * @param {boolean} isVisible Whether the overlay should be visible. 89 * @param {boolean} isVisible Whether the overlay should be visible.
83 * @private 90 * @private
84 */ 91 */
85 setVisible_: function(isVisible) { 92 setVisible_: function(isVisible) {
86 this.showOverlay_(isVisible ? $('extension-options-overlay') : null); 93 this.showOverlay_(isVisible ? $('extension-options-overlay') : null);
87 } 94 }
88 }; 95 };
89 96
90 // Export 97 // Export
91 return { 98 return {
92 ExtensionOptionsOverlay: ExtensionOptionsOverlay 99 ExtensionOptionsOverlay: ExtensionOptionsOverlay
93 }; 100 };
94 }); 101 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698