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

Unified Diff: extensions/browser/extension_web_contents_observer.cc

Issue 2655853007: Convert ChromeExtensionWebContentsObserver to use the new navigation callbacks. (Closed)
Patch Set: nit Created 3 years, 11 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 | « extensions/browser/extension_web_contents_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_web_contents_observer.cc
diff --git a/extensions/browser/extension_web_contents_observer.cc b/extensions/browser/extension_web_contents_observer.cc
index 42823d1749d98e04fb227bf4c63529ac8179f92f..a4309b0a7a4941f8e0f144335fdbef3b0d2ffc89 100644
--- a/extensions/browser/extension_web_contents_observer.cc
+++ b/extensions/browser/extension_web_contents_observer.cc
@@ -6,6 +6,7 @@
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -135,12 +136,15 @@ void ExtensionWebContentsObserver::RenderFrameDeleted(
ExtensionApiFrameIdMap::Get()->RemoveFrameData(render_frame_host);
}
-void ExtensionWebContentsObserver::DidCommitProvisionalLoadForFrame(
- content::RenderFrameHost* render_frame_host,
- const GURL& url,
- ui::PageTransition transition_type) {
+void ExtensionWebContentsObserver::DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (!navigation_handle->HasCommitted())
+ return;
+
ProcessManager* pm = ProcessManager::Get(browser_context_);
+ content::RenderFrameHost* render_frame_host =
+ navigation_handle->GetRenderFrameHost();
if (pm->IsRenderFrameHostRegistered(render_frame_host)) {
const Extension* frame_extension =
GetExtensionFromFrame(render_frame_host, true);
@@ -162,7 +166,7 @@ void ExtensionWebContentsObserver::DidNavigateAnyFrame(
ProcessManager* pm = ProcessManager::Get(browser_context_);
if (!frame_extension) {
- // Should have been unregistered by DidCommitProvisionalLoadForFrame.
+ // Should have been unregistered by DidFinishNavigation.
DCHECK(!pm->IsRenderFrameHostRegistered(render_frame_host));
return;
}
« no previous file with comments | « extensions/browser/extension_web_contents_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698