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

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: 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 = document.querySelector('extensionoptions');
Fady Samuel 2014/08/20 14:53:55 This is weird to me. What if you have more than on
not at google - send to devlin 2014/08/20 14:56:48 That's a good point. Should we be doing this query
ericzeng 2014/08/20 17:26:00 I actually have a div that I should have nested th
51 if (extensionoptions) 51 if (extensionoptions)
52 $('extension-options-overlay').removeChild(extensionoptions); 52 $('extension-options-overlay').removeChild(extensionoptions);
53 }, 53 },
54 54
55 /** 55 /**
56 * Associate an extension with the overlay and display it. 56 * Associate an extension with the overlay and display it.
57 * @param {string} extensionId The id of the extension whose options page 57 * @param {string} extensionId The id of the extension whose options page
58 * should be displayed in the overlay. 58 * should be displayed in the overlay.
59 * @param {string} extensionName The name of the extension, which is used 59 * @param {string} extensionName The name of the extension, which is used
60 * as the header of the overlay. 60 * as the header of the overlay.
61 */ 61 */
62 setExtensionAndShowOverlay: function(extensionId, extensionName) { 62 setExtensionAndShowOverlay: function(extensionId, extensionName) {
63 var extensionoptions = new ExtensionOptions(); 63 var extensionoptions = new ExtensionOptions();
64 extensionoptions.extension = extensionId; 64 extensionoptions.extension = extensionId;
65 extensionoptions.autosize = 'on'; 65 extensionoptions.autosize = 'on';
66 66
67 extensionoptions.onclose = function() {
68 this.handleDismiss_();
Fady Samuel 2014/08/20 14:53:55 The intent here is to remove the extensionoptions
ericzeng 2014/08/20 17:26:00 The higher level intent is to close the entire ove
69 }.bind(this);
70
67 // TODO(ericzeng): Resize in a non-jarring way. 71 // TODO(ericzeng): Resize in a non-jarring way.
68 extensionoptions.onsizechanged = function(evt) { 72 extensionoptions.onsizechanged = function(evt) {
69 $('extension-options-overlay').style.width = evt.width; 73 $('extension-options-overlay').style.width = evt.width;
70 $('extension-options-overlay').style.height = evt.height; 74 $('extension-options-overlay').style.height = evt.height;
71 }.bind(this); 75 }.bind(this);
72 76
73 $('extension-options-overlay').appendChild(extensionoptions); 77 $('extension-options-overlay').appendChild(extensionoptions);
74 78
75 $('extension-options-overlay-title').textContent = extensionName; 79 $('extension-options-overlay-title').textContent = extensionName;
76 80
77 this.setVisible_(true); 81 this.setVisible_(true);
78 }, 82 },
79 83
80 /** 84 /**
81 * Toggles the visibility of the ExtensionOptionsOverlay. 85 * Toggles the visibility of the ExtensionOptionsOverlay.
82 * @param {boolean} isVisible Whether the overlay should be visible. 86 * @param {boolean} isVisible Whether the overlay should be visible.
83 * @private 87 * @private
84 */ 88 */
85 setVisible_: function(isVisible) { 89 setVisible_: function(isVisible) {
86 this.showOverlay_(isVisible ? $('extension-options-overlay') : null); 90 this.showOverlay_(isVisible ? $('extension-options-overlay') : null);
87 } 91 }
88 }; 92 };
89 93
90 // Export 94 // Export
91 return { 95 return {
92 ExtensionOptionsOverlay: ExtensionOptionsOverlay 96 ExtensionOptionsOverlay: ExtensionOptionsOverlay
93 }; 97 };
94 }); 98 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698