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

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

Issue 488293003: Embedded Extension Options: Improve the overlay popup UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
« no previous file with comments | « chrome/browser/resources/extensions/extension_options_overlay.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = 50 var extensionoptions =
51 $('extension-options-overlay-guest') 51 $('extension-options-overlay-guest')
52 .querySelector('extensionoptions'); 52 .querySelector('extensionoptions');
53 53
54 if (extensionoptions) 54 if (extensionoptions)
55 $('extension-options-overlay-guest').removeChild(extensionoptions); 55 $('extension-options-overlay-guest').removeChild(extensionoptions);
56
57 $('extension-options-overlay-icon').removeAttribute('src');
56 }, 58 },
57 59
58 /** 60 /**
59 * Associate an extension with the overlay and display it. 61 * Associate an extension with the overlay and display it.
60 * @param {string} extensionId The id of the extension whose options page 62 * @param {string} extensionId The id of the extension whose options page
61 * should be displayed in the overlay. 63 * should be displayed in the overlay.
62 * @param {string} extensionName The name of the extension, which is used 64 * @param {string} extensionName The name of the extension, which is used
63 * as the header of the overlay. 65 * as the header of the overlay.
66 * @param {string} extensionIcon The URL of the extension's icon.
64 */ 67 */
65 setExtensionAndShowOverlay: function(extensionId, extensionName) { 68 setExtensionAndShowOverlay: function(extensionId,
69 extensionName,
70 extensionIcon) {
66 $('extension-options-overlay-title').textContent = extensionName; 71 $('extension-options-overlay-title').textContent = extensionName;
72 $('extension-options-overlay-icon').src = extensionIcon;
73
74 this.setVisible_(true);
67 75
68 var extensionoptions = new ExtensionOptions(); 76 var extensionoptions = new ExtensionOptions();
69 extensionoptions.extension = extensionId; 77 extensionoptions.extension = extensionId;
70 extensionoptions.autosize = 'on'; 78 extensionoptions.autosize = 'on';
71 79
72 // The <extensionoptions> content's size needs to be restricted to the 80 // The <extensionoptions> content's size needs to be restricted to the
73 // bounds of the overlay window. The overlay gives a min width and 81 // bounds of the overlay window. The overlay gives a min width and
74 // max height, but the maxheight does not include our header height 82 // max height, but the maxheight does not include our header height
75 // (title and close button), so we need to subtract that to get the 83 // (title and close button), so we need to subtract that to get the
76 // max height for the extension options. 84 // max height for the extension options.
77 var headerHeight = $('extension-options-overlay-title').offsetHeight; 85 var headerHeight = $('extension-options-overlay-header').offsetHeight;
78 var overlayMaxHeight = 86 var overlayMaxHeight =
79 parseInt($('extension-options-overlay').style.maxHeight); 87 parseInt($('extension-options-overlay').style.maxHeight);
80 extensionoptions.maxheight = overlayMaxHeight - headerHeight; 88 extensionoptions.maxheight = overlayMaxHeight - headerHeight;
81 89
82 extensionoptions.minwidth = 90 extensionoptions.minwidth =
83 parseInt(window.getComputedStyle($('extension-options-overlay')) 91 parseInt(window.getComputedStyle($('extension-options-overlay'))
84 .minWidth); 92 .minWidth);
85 93
86 extensionoptions.setDeferAutoSize(true); 94 extensionoptions.setDeferAutoSize(true);
87 95
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Don't allow the <extensionoptions> to autosize until the overlay 132 // Don't allow the <extensionoptions> to autosize until the overlay
125 // animation is complete. 133 // animation is complete.
126 extensionoptions.setDeferAutoSize(true); 134 extensionoptions.setDeferAutoSize(true);
127 135
128 // Move the <extensionoptions> off screen until the overlay is ready 136 // Move the <extensionoptions> off screen until the overlay is ready
129 $('extension-options-overlay-guest').style.position = 'fixed'; 137 $('extension-options-overlay-guest').style.position = 'fixed';
130 $('extension-options-overlay-guest').style.left = 138 $('extension-options-overlay-guest').style.left =
131 window.outerWidth + 'px'; 139 window.outerWidth + 'px';
132 140
133 $('extension-options-overlay-guest').appendChild(extensionoptions); 141 $('extension-options-overlay-guest').appendChild(extensionoptions);
134 this.setVisible_(true);
135 }, 142 },
136 143
137 /** 144 /**
138 * Toggles the visibility of the ExtensionOptionsOverlay. 145 * Toggles the visibility of the ExtensionOptionsOverlay.
139 * @param {boolean} isVisible Whether the overlay should be visible. 146 * @param {boolean} isVisible Whether the overlay should be visible.
140 * @private 147 * @private
141 */ 148 */
142 setVisible_: function(isVisible) { 149 setVisible_: function(isVisible) {
143 this.showOverlay_(isVisible ? $('extension-options-overlay') : null); 150 this.showOverlay_(isVisible ? $('extension-options-overlay') : null);
144 } 151 }
145 }; 152 };
146 153
147 // Export 154 // Export
148 return { 155 return {
149 ExtensionOptionsOverlay: ExtensionOptionsOverlay 156 ExtensionOptionsOverlay: ExtensionOptionsOverlay
150 }; 157 };
151 }); 158 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/extensions/extension_options_overlay.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698