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

Unified Diff: trunk/src/chrome/browser/guestview/webview/webview_guest.cc

Issue 23965004: Revert 222090 "<webview>: Cleanup WebRequest event listeners whe..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 | « trunk/src/chrome/browser/guestview/webview/webview_guest.h ('k') | trunk/src/chrome/chrome_renderer.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/chrome/browser/guestview/webview/webview_guest.cc
===================================================================
--- trunk/src/chrome/browser/guestview/webview/webview_guest.cc (revision 222122)
+++ trunk/src/chrome/browser/guestview/webview/webview_guest.cc (working copy)
@@ -71,13 +71,15 @@
void* profile,
const std::string& extension_id,
int embedder_process_id,
- int view_instance_id) {
+ int embedder_routing_id,
+ int guest_instance_id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
ExtensionWebRequestEventRouter::GetInstance()->RemoveWebViewEventListeners(
profile,
extension_id,
embedder_process_id,
- view_instance_id);
+ embedder_routing_id,
+ guest_instance_id);
}
void AttachWebViewHelpers(WebContents* contents) {
@@ -152,24 +154,6 @@
DispatchEvent(new GuestView::Event(webview::kEventClose, args.Pass()));
}
-void WebViewGuest::EmbedderDestroyed() {
- // 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,
- browser_context(), extension_id(),
- embedder_render_process_id(),
- view_instance_id()));
-}
-
void WebViewGuest::GuestProcessGone(base::TerminationStatus status) {
scoped_ptr<DictionaryValue> args(new DictionaryValue());
args->SetInteger(webview::kProcessId,
@@ -415,6 +399,20 @@
void WebViewGuest::WebContentsDestroyed(WebContents* web_contents) {
RemoveWebViewFromExtensionRendererState(web_contents);
+ // TODO(fsamuel): WebRequest event listeners for <webview> should survive
+ // reparenting of a <webview> within a single embedder. The lifetime of
+ // WebRequest event listeners should be equal to the lifetime of the embedder
+ // WebContents rather than the guest until http://crbug.com/156219 is
+ // resolved.
+ content::BrowserThread::PostTask(
+ content::BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(
+ &RemoveWebViewEventListenersOnIOThread,
+ browser_context(), extension_id(),
+ embedder_render_process_id(),
+ embedder_routing_id(),
+ view_instance_id()));
}
void WebViewGuest::LoadHandlerCalled() {
@@ -435,6 +433,7 @@
void WebViewGuest::AddWebViewToExtensionRendererState() {
ExtensionRendererState::WebViewInfo webview_info;
webview_info.embedder_process_id = embedder_render_process_id();
+ webview_info.embedder_routing_id = embedder_web_contents()->GetRoutingID();
webview_info.instance_id = view_instance_id();
content::BrowserThread::PostTask(
« no previous file with comments | « trunk/src/chrome/browser/guestview/webview/webview_guest.h ('k') | trunk/src/chrome/chrome_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698