Chromium Code Reviews| 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..0beb2099d6ab8c73e183398f87514d05df6b894a 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,13 @@ 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) { |
| + if (!navigation_handle->IsInMainFrame() || |
| + !navigation_handle->HasCommitted() || |
| + navigation_handle->IsSamePage()) { |
| return; |
| - DCHECK(details.is_main_frame); // important: sub-frames don't get granted! |
|
Devlin
2017/02/07 02:42:47
Nit: maybe preserve this comment?
jam
2017/02/07 04:17:03
Done.
|
| + } |
| // Only clear the granted permissions for cross-origin navigations. |
| // |
| @@ -157,8 +158,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 { |