summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_function_dispatcher.h
diff options
context:
space:
mode:
authortwiz@google.com <twiz@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-16 23:28:26 +0000
committertwiz@google.com <twiz@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-16 23:28:26 +0000
commitb2725756d6f40456048f052427746f347dcd8219 (patch)
treecf02ff046b428d9418291f0f7c6376ac71bbb1ea /chrome/browser/extensions/extension_function_dispatcher.h
parentba1d6b0893d6d07cf1fb924f4212446d4e6136d4 (diff)
downloadchromium_src-b2725756d6f40456048f052427746f347dcd8219.zip
chromium_src-b2725756d6f40456048f052427746f347dcd8219.tar.gz
chromium_src-b2725756d6f40456048f052427746f347dcd8219.tar.bz2
Refactoring of the chrome.experimental.popup API implementation to allow display of pop-ups for extensions viewed through a tab-contents view.I added a new class, ExtensionPopupHost. This class implements the necessary environment for managing child popup windows from either an ExtensionHost, or an ExtensionDOMUI. Note that this class is added as a member to ExtensionHost and ExtensionDOMUI.
I decided to take this approach to prevent multiple inheritance of the NotificationObserver class: Both ExtensionPopupHost and ExtensionHost must inherit from this class, and I was uncertain of how the system would behave wrt virtual inheritance. Please comment on if I should have used the inheritance approach. I also removed the customHandler tag (in extension_api.json) that I had added in the initial submission. The arguments in the schema are now those that users of the API see. The nodocs tags were also removed. The api experimental.popup.getAnchorWindow() has been renamed to popup.getParentWindow, as per a suggestion from Erik K. BUG=none TEST=extension_popup_apitest.cc Review URL: http://codereview.chromium.org/385061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function_dispatcher.h')
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/chrome/browser/extensions/extension_function_dispatcher.h b/chrome/browser/extensions/extension_function_dispatcher.h
index d9c0ea5..df50ceb 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.h
+++ b/chrome/browser/extensions/extension_function_dispatcher.h
@@ -14,8 +14,10 @@
class Browser;
class Extension;
+class ExtensionDOMUI;
class ExtensionFunction;
class ExtensionHost;
+class ExtensionPopupHost;
class Profile;
class RenderViewHost;
class RenderViewHostDelegate;
@@ -33,6 +35,7 @@ class ExtensionFunctionDispatcher {
public:
virtual Browser* GetBrowser() = 0;
virtual ExtensionHost* GetExtensionHost() { return NULL; }
+ virtual ExtensionDOMUI* GetExtensionDOMUI() { return NULL; }
};
// The peer object allows us to notify ExtensionFunctions when we are
@@ -43,10 +46,10 @@ class ExtensionFunctionDispatcher {
: dispatcher_(dispatcher) {}
ExtensionFunctionDispatcher* dispatcher_;
- private:
- friend class base::RefCounted<Peer>;
+ private:
+ friend class base::RefCounted<Peer>;
- ~Peer() {}
+ ~Peer() {}
};
// Gets a list of all known extension function names.
@@ -79,10 +82,18 @@ class ExtensionFunctionDispatcher {
// example, for positioning windows, or alert boxes, or creating tabs.
Browser* GetBrowser();
+ // Get the extension popup hosting environment for the ExtensionHost
+ // or ExtensionDOMUI associted with this dispatcher.
+ ExtensionPopupHost* GetPopupHost();
+
// Gets the ExtensionHost associated with this object. In the case of
// tab hosted extension pages, this will return NULL.
ExtensionHost* GetExtensionHost();
+ // Gets the ExtensionDOMUI associated with this object. In the case of
+ // non-tab-hosted extension pages, this will return NULL.
+ ExtensionDOMUI* GetExtensionDOMUI();
+
// Gets the extension the function is being invoked by. This should not ever
// return NULL.
Extension* GetExtension();