| OLD | NEW |
| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 56 |
| 57 $('extension-options-overlay-icon').removeAttribute('src'); | 57 $('extension-options-overlay-icon').removeAttribute('src'); |
| 58 |
| 59 // Remove the options query string. |
| 60 uber.replaceState({}, ''); |
| 58 }, | 61 }, |
| 59 | 62 |
| 60 /** | 63 /** |
| 61 * Associate an extension with the overlay and display it. | 64 * Associate an extension with the overlay and display it. |
| 62 * @param {string} extensionId The id of the extension whose options page | 65 * @param {string} extensionId The id of the extension whose options page |
| 63 * should be displayed in the overlay. | 66 * should be displayed in the overlay. |
| 64 * @param {string} extensionName The name of the extension, which is used | 67 * @param {string} extensionName The name of the extension, which is used |
| 65 * as the header of the overlay. | 68 * as the header of the overlay. |
| 66 * @param {string} extensionIcon The URL of the extension's icon. | 69 * @param {string} extensionIcon The URL of the extension's icon. |
| 67 */ | 70 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 87 parseInt($('extension-options-overlay').style.maxHeight); | 90 parseInt($('extension-options-overlay').style.maxHeight); |
| 88 extensionoptions.maxheight = overlayMaxHeight - headerHeight; | 91 extensionoptions.maxheight = overlayMaxHeight - headerHeight; |
| 89 | 92 |
| 90 extensionoptions.minwidth = | 93 extensionoptions.minwidth = |
| 91 parseInt(window.getComputedStyle($('extension-options-overlay')) | 94 parseInt(window.getComputedStyle($('extension-options-overlay')) |
| 92 .minWidth); | 95 .minWidth); |
| 93 | 96 |
| 94 extensionoptions.setDeferAutoSize(true); | 97 extensionoptions.setDeferAutoSize(true); |
| 95 | 98 |
| 96 extensionoptions.onclose = function() { | 99 extensionoptions.onclose = function() { |
| 97 this.handleDismiss_(); | 100 cr.dispatchSimpleEvent($('overlay'), 'cancelOverlay'); |
| 98 }.bind(this); | 101 }.bind(this); |
| 99 | 102 |
| 100 // Resize the overlay if the <extensionoptions> changes size. | 103 // Resize the overlay if the <extensionoptions> changes size. |
| 101 extensionoptions.onsizechanged = function(evt) { | 104 extensionoptions.onsizechanged = function(evt) { |
| 102 var overlayStyle = | 105 var overlayStyle = |
| 103 window.getComputedStyle($('extension-options-overlay')); | 106 window.getComputedStyle($('extension-options-overlay')); |
| 104 var oldWidth = parseInt(overlayStyle.width); | 107 var oldWidth = parseInt(overlayStyle.width); |
| 105 var oldHeight = parseInt(overlayStyle.height); | 108 var oldHeight = parseInt(overlayStyle.height); |
| 106 | 109 |
| 107 // animationTime is the amount of time in ms that will be used to resize | 110 // animationTime is the amount of time in ms that will be used to resize |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 setVisible_: function(isVisible) { | 152 setVisible_: function(isVisible) { |
| 150 this.showOverlay_(isVisible ? $('extension-options-overlay') : null); | 153 this.showOverlay_(isVisible ? $('extension-options-overlay') : null); |
| 151 } | 154 } |
| 152 }; | 155 }; |
| 153 | 156 |
| 154 // Export | 157 // Export |
| 155 return { | 158 return { |
| 156 ExtensionOptionsOverlay: ExtensionOptionsOverlay | 159 ExtensionOptionsOverlay: ExtensionOptionsOverlay |
| 157 }; | 160 }; |
| 158 }); | 161 }); |
| OLD | NEW |