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

Unified Diff: content/browser/web_contents/navigation_controller_impl.cc

Issue 10780013: Add reverse URL handler for shortening uber URLs (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: comments 3 Created 8 years, 4 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
Index: content/browser/web_contents/navigation_controller_impl.cc
diff --git a/content/browser/web_contents/navigation_controller_impl.cc b/content/browser/web_contents/navigation_controller_impl.cc
index dc49e94328368eecc10a1caa0d416835b118d46a..0afcec5bade43f1a436ba9020e1d4b1085ac105b 100644
--- a/content/browser/web_contents/navigation_controller_impl.cc
+++ b/content/browser/web_contents/navigation_controller_impl.cc
@@ -872,11 +872,23 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage(
update_virtual_url = new_entry->update_virtual_url_with_url();
} else {
new_entry = new NavigationEntryImpl;
+
+ // Find out whether the new entry needs to update its virtual URL on URL
+ // change and set up the entry accordingly. This is needed to correctly
+ // update the virtual URL when replaceState is called after a pushState.
+ // For example, this allows uber page to update the virtual URL by calling
+ // replaceState after the user navigates via the uber-frame.
+ GURL temp = params.url;
+ bool reverse_on_redirect = false;
+ BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(
+ &temp, browser_context_, &reverse_on_redirect);
+ new_entry->set_update_virtual_url_with_url(reverse_on_redirect);
+
// When navigating to a new page, give the browser URL handler a chance to
// update the virtual URL based on the new URL. For example, this is needed
// to show chrome://bookmarks/#1 when the bookmarks webui extension changes
// the URL.
- update_virtual_url = true;
+ update_virtual_url = reverse_on_redirect;
}
new_entry->SetURL(params.url);
« chrome/browser/chrome_content_browser_client.cc ('K') | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698