Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1103)

Unified Diff: chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc

Issue 620623002: Revert "Allow declarative webrequest and webrequest in extensions." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h ('k') | chrome/chrome_renderer.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h ('k') | chrome/chrome_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698