diff options
author | fsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-14 00:03:17 +0000 |
---|---|---|
committer | fsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-14 00:03:17 +0000 |
commit | 8f6727ec1eeae964e55902c9841b2cb6a329a979 (patch) | |
tree | 105870b3890eea4fc7242fd4a13c64d6715d1ba9 /content | |
parent | 7e538da69a788cb62ae2d9c65bd11de405305895 (diff) | |
download | chromium_src-8f6727ec1eeae964e55902c9841b2cb6a329a979.zip chromium_src-8f6727ec1eeae964e55902c9841b2cb6a329a979.tar.gz chromium_src-8f6727ec1eeae964e55902c9841b2cb6a329a979.tar.bz2 |
<webview>: Cleanup WebRequest event listeners when embedder destroyed
<webivew> WebRequest event listeners should survive reparenting of the <webview> within the same embedder WebContents. Currently, event listeners are lost when the <webview> is removed from the DOM. This CL solves this problem.
Note that there is still a problem where custom elements break if the original page that created the element is closed. I have written a test that exercises this problem and I've left the test disabled until we fix the problem.
BUG=281551
Test=WebViewTest.Shim_TestWebRequestListenerSurvivesReparenting
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=222090
R=jam@chromium.org, lazyboy@chromium.org, mpcomplete@chromium.org
Review URL: https://codereview.chromium.org/23514016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/browser_plugin/browser_plugin_guest.cc | 10 | ||||
-rw-r--r-- | content/browser/browser_plugin/browser_plugin_guest.h | 4 | ||||
-rw-r--r-- | content/public/browser/browser_plugin_guest_delegate.h | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index dc7b670..269900e 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -319,8 +319,7 @@ class BrowserPluginGuest::EmbedderRenderViewHostObserver // RenderViewHostObserver: virtual void RenderViewHostDestroyed( RenderViewHost* render_view_host) OVERRIDE { - browser_plugin_guest_->embedder_web_contents_ = NULL; - browser_plugin_guest_->Destroy(); + browser_plugin_guest_->EmbedderDestroyed(); } private: @@ -424,6 +423,13 @@ int BrowserPluginGuest::RequestPermission( return request_id; } +void BrowserPluginGuest::EmbedderDestroyed() { + embedder_web_contents_ = NULL; + if (delegate_) + delegate_->EmbedderDestroyed(); + Destroy(); +} + void BrowserPluginGuest::Destroy() { is_in_destruction_ = true; if (!attached() && opener()) diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index 491e535..abc5395 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -104,6 +104,10 @@ class CONTENT_EXPORT BrowserPluginGuest BrowserPluginGuest* opener, bool has_render_view); + // Called when the embedder RenderViewHost is destroyed to give the + // BrowserPluginGuest an opportunity to clean up after itself. + void EmbedderDestroyed(); + // Destroys the guest WebContents and all its associated state, including // this BrowserPluginGuest, and its new unattached windows. void Destroy(); diff --git a/content/public/browser/browser_plugin_guest_delegate.h b/content/public/browser/browser_plugin_guest_delegate.h index c7a18c6..9500c0c 100644 --- a/content/public/browser/browser_plugin_guest_delegate.h +++ b/content/public/browser/browser_plugin_guest_delegate.h @@ -39,6 +39,9 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate { // gracefully. virtual void GuestProcessGone(base::TerminationStatus status) {} + // Informs the delegate that the embedder has been destroyed. + virtual void EmbedderDestroyed() {} + virtual bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); // Notification that a load in the guest resulted in abort. Note that |url| |