diff options
author | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-02 20:28:44 +0000 |
---|---|---|
committer | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-02 20:28:44 +0000 |
commit | 14392a5ec9b1c2679f6f58193ef6736123d4c442 (patch) | |
tree | 85eb33b09622b1ffa629e6ab361f6be861bf10de /content/browser/web_contents/web_contents_impl.h | |
parent | adcf0f0434f7af0e399bb0a034ba706ce12f746c (diff) | |
download | chromium_src-14392a5ec9b1c2679f6f58193ef6736123d4c442.zip chromium_src-14392a5ec9b1c2679f6f58193ef6736123d4c442.tar.gz chromium_src-14392a5ec9b1c2679f6f58193ef6736123d4c442.tar.bz2 |
Create swapped-out opener RVHs after a process swap.
This is required to support cross-process JavaScript calls, like postMessage.
BUG=99202
TEST=window.opener present after a cross-process navigation.
Review URL: https://chromiumcodereview.appspot.com/10171018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/web_contents/web_contents_impl.h')
-rw-r--r-- | content/browser/web_contents/web_contents_impl.h | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index a2fcba7..b330375 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -19,6 +19,8 @@ #include "content/browser/web_contents/navigation_controller_impl.h" #include "content/browser/web_contents/render_view_host_manager.h" #include "content/common/content_export.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" #include "content/public/browser/render_view_host_delegate.h" #include "content/public/browser/web_contents.h" #include "content/public/common/renderer_preferences.h" @@ -56,13 +58,15 @@ struct WebIntentData; class CONTENT_EXPORT WebContentsImpl : public NON_EXPORTED_BASE(content::WebContents), public content::RenderViewHostDelegate, - public RenderViewHostManager::Delegate { + public RenderViewHostManager::Delegate, + public content::NotificationObserver { public: // See WebContents::Create for a description of these parameters. WebContentsImpl(content::BrowserContext* browser_context, content::SiteInstance* site_instance, int routing_id, const WebContentsImpl* base_web_contents, + WebContentsImpl* opener, SessionStorageNamespaceImpl* session_storage_namespace); virtual ~WebContentsImpl(); @@ -117,10 +121,6 @@ class CONTENT_EXPORT WebContentsImpl opener_web_ui_type_ = opener_web_ui_type; } - void set_has_opener(bool has_opener) { - has_opener_ = has_opener; - } - JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const { return java_bridge_dispatcher_host_manager_.get(); } @@ -340,7 +340,7 @@ class CONTENT_EXPORT WebContentsImpl // RenderViewHostManager::Delegate ------------------------------------------- virtual bool CreateRenderViewForRenderManager( - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderViewHost* render_view_host, int opener_route_id) OVERRIDE; virtual void BeforeUnloadFiredFromRenderManager( bool proceed, bool* proceed_to_fire_unload) OVERRIDE; @@ -350,6 +350,8 @@ class CONTENT_EXPORT WebContentsImpl content::RenderViewHost* render_view_host) OVERRIDE; virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE; virtual void NotifySwappedFromRenderManager() OVERRIDE; + virtual int CreateOpenerRenderViewsForRenderManager( + content::SiteInstance* instance) OVERRIDE; virtual NavigationControllerImpl& GetControllerForRenderManager() OVERRIDE; virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE; virtual content::NavigationEntry* @@ -359,6 +361,12 @@ class CONTENT_EXPORT WebContentsImpl virtual void CreateViewAndSetSizeForRVH( content::RenderViewHost* rvh) OVERRIDE; + // content::NotificationObserver --------------------------------------------- + + virtual void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; + protected: friend class content::WebContentsObserver; @@ -386,6 +394,9 @@ class CONTENT_EXPORT WebContentsImpl // TODO(brettw) TestWebContents shouldn't exist! friend class content::TestWebContents; + // Clears this tab's opener if it has been closed. + void OnWebContentsDestroyed(content::WebContents* web_contents); + // Callback function when showing JS dialogs. void OnDialogClosed(content::RenderViewHost* rvh, IPC::Message* reply_msg, @@ -512,6 +523,12 @@ class CONTENT_EXPORT WebContentsImpl int merge_history_length, int32 minimum_page_id); + // Recursively creates swapped out RenderViews for this tab's opener chain + // (including this tab) in the given SiteInstance, allowing other tabs to send + // cross-process JavaScript calls to their opener(s). Returns the route ID of + // this tab's RenderView for |instance|. + int CreateOpenerRenderViews(content::SiteInstance* instance); + // Misc non-view stuff ------------------------------------------------------- // Helper functions for sending notifications. @@ -530,6 +547,9 @@ class CONTENT_EXPORT WebContentsImpl // WARNING: this needs to be deleted after NavigationController. base::PropertyBag property_bag_; + // Listen for notifications as well. + content::NotificationRegistrar registrar_; + // Data for core operation --------------------------------------------------- // Delegate for notifying our owner about stuff. Not owned by us. @@ -547,6 +567,10 @@ class CONTENT_EXPORT WebContentsImpl // the observer list then. ObserverList<content::WebContentsObserver> observers_; + // The tab that opened this tab, if any. Will be set to null if the opener + // is closed. + WebContentsImpl* opener_; + // Helper classes ------------------------------------------------------------ // Manages creation and swapping of render views. @@ -674,9 +698,6 @@ class CONTENT_EXPORT WebContentsImpl // Our view type. Default is VIEW_TYPE_WEB_CONTENTS. content::ViewType view_type_; - // Is there an opener associated with this? - bool has_opener_; - // Color chooser that was opened by this tab. content::ColorChooser* color_chooser_; |