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

Unified Diff: chrome/renderer/resources/extensions/extension_options.js

Issue 867393002: <extensionoptions>: Add experimental attach/detach API Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/extension_options.js
diff --git a/chrome/renderer/resources/extensions/extension_options.js b/chrome/renderer/resources/extensions/extension_options.js
index 1b8fa7892bd56d6c5ad35eebdcac3273df59fc33..7709a1c0123035134df773297bf5a89aa3372366 100644
--- a/chrome/renderer/resources/extensions/extension_options.js
+++ b/chrome/renderer/resources/extensions/extension_options.js
@@ -46,6 +46,8 @@ ExtensionOptionsImpl.VIEW_TYPE = 'ExtensionOptions';
// Add extra functionality to |this.element|.
ExtensionOptionsImpl.setupElement = function(proto) {
var apiMethods = [
+ 'attach',
+ 'detach',
'setDeferAutoSize',
'resumeDeferredAutoSize'
];
@@ -263,4 +265,32 @@ ExtensionOptionsImpl.prototype.resumeDeferredAutoSize = function() {
}
};
+/**
+ * Attaches a guest to this <extensionoptions> element.
+ */
+ExtensionOptionsImpl.prototype.attach = function(guest) {
+ if (this.guest === guest) {
+ return;
+ }
+ this.guest.destroy();
+ this.guest = guest;
+ this.attachWindow();
+};
+
+/**
+ * Detaches the guest from this <extensionoptions> element.
+ */
+ExtensionOptionsImpl.prototype.detach = function() {
+ // If we don't have a WindowProxy to this guest, then there's nothing to
+ // detach.
+ if (!this.guest.getContentWindow()) {
+ return null;
+ }
+ var guest = this.guest;
+ guest.detach();
+
+ this.guest = new GuestView('extensionoptions');
+ return guest;
+};
+
GuestViewContainer.registerElement(ExtensionOptionsImpl);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698