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

Unified Diff: chrome/browser/extensions/active_tab_permission_granter.cc

Issue 2677053004: Convert ActiveTabPermissionGranter to use the new navigation callbacks. (Closed)
Patch Set: add back comment Created 3 years, 10 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/extensions/active_tab_permission_granter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/active_tab_permission_granter.cc
diff --git a/chrome/browser/extensions/active_tab_permission_granter.cc b/chrome/browser/extensions/active_tab_permission_granter.cc
index f00ef4d1f7d490f76cea4d9440f395e924e1b18d..c1a1f7cdfb7fae420b3911f444364ca847230061 100644
--- a/chrome/browser/extensions/active_tab_permission_granter.cc
+++ b/chrome/browser/extensions/active_tab_permission_granter.cc
@@ -6,8 +6,8 @@
#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/profiles/profile.h"
-#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.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/web_contents.h"
@@ -139,12 +139,14 @@ void ActiveTabPermissionGranter::RevokeForTesting() {
ClearActiveExtensionsAndNotify();
}
-void ActiveTabPermissionGranter::DidNavigateMainFrame(
- const content::LoadCommittedDetails& details,
- const content::FrameNavigateParams& params) {
- if (details.is_in_page)
+void ActiveTabPermissionGranter::DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) {
+ // Important: sub-frames don't get granted!
+ if (!navigation_handle->IsInMainFrame() ||
+ !navigation_handle->HasCommitted() ||
+ navigation_handle->IsSamePage()) {
return;
- DCHECK(details.is_main_frame); // important: sub-frames don't get granted!
+ }
// Only clear the granted permissions for cross-origin navigations.
//
@@ -157,8 +159,9 @@ void ActiveTabPermissionGranter::DidNavigateMainFrame(
if (FeatureSwitch::scripts_require_action()->IsEnabled()) {
const content::NavigationEntry* navigation_entry =
web_contents()->GetController().GetVisibleEntry();
- if (!navigation_entry || (navigation_entry->GetURL().GetOrigin() !=
- details.previous_url.GetOrigin())) {
+ if (!navigation_entry ||
+ (navigation_entry->GetURL().GetOrigin() !=
+ navigation_handle->GetPreviousURL().GetOrigin())) {
ClearActiveExtensionsAndNotify();
}
} else {
« no previous file with comments | « chrome/browser/extensions/active_tab_permission_granter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698