summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_host.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_host.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_host.h')
-rw-r--r--chrome/browser/extensions/extension_host.h43
1 files changed, 5 insertions, 38 deletions
diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h
index e9b414d..9407b85 100644
--- a/chrome/browser/extensions/extension_host.h
+++ b/chrome/browser/extensions/extension_host.h
@@ -10,11 +10,11 @@
#include "base/perftimer.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
+#include "chrome/browser/extensions/extension_popup_host.h"
#include "chrome/browser/jsmessage_box_client.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
#if defined(TOOLKIT_VIEWS)
-#include "chrome/browser/views/browser_bubble.h"
#include "chrome/browser/views/extensions/extension_view.h"
#elif defined(OS_LINUX)
#include "chrome/browser/gtk/extension_view_gtk.h"
@@ -26,9 +26,6 @@
class Browser;
class Extension;
-#if defined(TOOLKIT_VIEWS)
-class ExtensionPopup;
-#endif
class ExtensionProcessManager;
class RenderProcessHost;
class RenderWidgetHost;
@@ -40,10 +37,7 @@ struct WebPreferences;
// It handles setting up the renderer process, if needed, with special
// privileges available to extensions. It may have a view to be shown in the
// in the browser UI, or it may be hidden.
-class ExtensionHost : // NOLINT
-#if defined(TOOLKIT_VIEWS)
- public BrowserBubble::Delegate,
-#endif
+class ExtensionHost : public ExtensionPopupHost::PopupDelegate,
public RenderViewHostDelegate,
public RenderViewHostDelegate::View,
public ExtensionFunctionDispatcher::Delegate,
@@ -84,14 +78,6 @@ class ExtensionHost : // NOLINT
}
Profile* profile() const { return profile_; }
-#if defined(TOOLKIT_VIEWS)
- ExtensionPopup* child_popup() const { return child_popup_; }
- void set_child_popup(ExtensionPopup* popup) { child_popup_ = popup; }
-#endif
-
- // Dismiss the hosted pop-up, if one is present.
- void DismissPopup();
-
// Sets the the ViewType of this host (e.g. mole, toolstrip).
void SetRenderViewType(ViewType::Type type);
@@ -109,22 +95,6 @@ class ExtensionHost : // NOLINT
// Insert the theme CSS for a toolstrip/mole.
void InsertThemeCSS();
-#if defined(TOOLKIT_VIEWS)
- // BrowserBubble::Delegate implementation.
- // Called when the Browser Window that this bubble is attached to moves.
- virtual void BubbleBrowserWindowMoved(BrowserBubble* bubble);
-
- // Called with the Browser Window that this bubble is attached to is
- // about to close.
- virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble);
-
- // Called when the bubble became active / got focus.
- virtual void BubbleGotFocus(BrowserBubble* bubble);
-
- // Called when the bubble became inactive / lost focus.
- virtual void BubbleLostFocus(BrowserBubble* bubble);
-#endif // defined(TOOLKIT_VIEWS)
-
// RenderViewHostDelegate implementation.
virtual RenderViewHostDelegate::View* GetViewDelegate();
virtual const GURL& GetURL() const { return url_; }
@@ -204,6 +174,9 @@ class ExtensionHost : // NOLINT
virtual Browser* GetBrowser();
virtual ExtensionHost* GetExtensionHost() { return this; }
+ // ExtensionPopupHost::Delegate
+ virtual RenderViewHost* GetRenderViewHost() { return render_view_host(); }
+
// Returns true if we're hosting a background page.
// This isn't valid until CreateRenderView is called.
bool is_background_page() const { return !view(); }
@@ -238,12 +211,6 @@ class ExtensionHost : // NOLINT
// The URL being hosted.
GURL url_;
-#if defined(TOOLKIT_VIEWS)
- // A popup view that is anchored to and owned by this ExtensionHost. However,
- // the popup contains its own separate ExtensionHost
- ExtensionPopup* child_popup_;
-#endif
-
NotificationRegistrar registrar_;
scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;