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

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

Issue 2889003002: Change NavigationEntry to use virtual URL in error pages for blocked navigations (Closed)
Patch Set: rebase Created 3 years, 7 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 | « no previous file | content/browser/browser_side_navigation_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/navigation_observer.cc
diff --git a/chrome/browser/extensions/navigation_observer.cc b/chrome/browser/extensions/navigation_observer.cc
index 730ddcdbeee52c7758411e9d5c0acd5131a8254b..0640c7133acec17ce6fb7be5adc69b9bba4383a0 100644
--- a/chrome/browser/extensions/navigation_observer.cc
+++ b/chrome/browser/extensions/navigation_observer.cc
@@ -69,7 +69,16 @@ void NavigationObserver::PromptToEnableExtensionIfNecessary(
if (!nav_entry)
return;
- const GURL& url = nav_entry->GetURL();
+ // With a disabled extension, the navigation is blocked, which results in
+ // an error page and NavigationEntry with "about:blank" URL. In this case,
+ // the virtual URL is the real URL the user navigated to, so if this is the
+ // case, use it instead.
+ const GURL& url = (nav_entry->GetPageType() == content::PAGE_TYPE_ERROR &&
+ nav_entry->GetURL() == url::kAboutBlankURL &&
+ nav_entry->GetVirtualURL().SchemeIs(kExtensionScheme))
+ ? nav_entry->GetVirtualURL()
+ : nav_entry->GetURL();
+
// NOTE: We only consider chrome-extension:// urls, and deliberately don't
// consider hosted app urls. This is because it's really annoying to visit the
// site associated with a hosted app (like calendar.google.com or
« no previous file with comments | « no previous file | content/browser/browser_side_navigation_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698