| Index: chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
|
| diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
|
| index 428b72a55b36cc37f0c7715385d60f6865fd2643..1a6b9f70253321a5ea1b3cb54fc3247c896f0af8 100644
|
| --- a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
|
| +++ b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
|
| @@ -26,6 +26,19 @@
|
| #endif // defined(ENABLE_FULL_PRINTING)
|
| #endif // defined(ENABLE_PRINTING)
|
|
|
| +void RemoveWebViewEventListenersOnIOThread(
|
| + void* profile,
|
| + const std::string& extension_id,
|
| + int embedder_process_id,
|
| + int view_instance_id) {
|
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
|
| + ExtensionWebRequestEventRouter::GetInstance()->RemoveWebViewEventListeners(
|
| + profile,
|
| + extension_id,
|
| + embedder_process_id,
|
| + view_instance_id);
|
| +}
|
| +
|
| ChromeWebViewGuestDelegate::ChromeWebViewGuestDelegate(
|
| extensions::WebViewGuest* web_view_guest)
|
| : pending_context_menu_request_id_(0),
|
| @@ -91,6 +104,25 @@ void ChromeWebViewGuestDelegate::OnAttachWebViewHelpers(
|
| new ChromePDFWebContentsHelperClient()));
|
| }
|
|
|
| +void ChromeWebViewGuestDelegate::OnEmbedderDestroyed() {
|
| + // TODO(fsamuel): WebRequest event listeners for <webview> should survive
|
| + // reparenting of a <webview> within a single embedder. Right now, we keep
|
| + // around the browser state for the listener for the lifetime of the embedder.
|
| + // Ideally, the lifetime of the listeners should match the lifetime of the
|
| + // <webview> DOM node. Once http://crbug.com/156219 is resolved we can move
|
| + // the call to RemoveWebViewEventListenersOnIOThread back to
|
| + // WebViewGuest::WebContentsDestroyed.
|
| + content::BrowserThread::PostTask(
|
| + content::BrowserThread::IO,
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &RemoveWebViewEventListenersOnIOThread,
|
| + web_view_guest()->browser_context(),
|
| + web_view_guest()->embedder_extension_id(),
|
| + web_view_guest()->embedder_render_process_id(),
|
| + web_view_guest()->view_instance_id()));
|
| +}
|
| +
|
| void ChromeWebViewGuestDelegate::OnDidAttachToEmbedder() {
|
| // TODO(fsamuel): This code should be implemented in GuestViewBase once the
|
| // ZoomController moves to the extensions module.
|
|
|