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

Side by Side 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: short uber Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/navigation_controller_impl.h" 5 #include "content/browser/web_contents/navigation_controller_impl.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" // Temporary 9 #include "base/string_number_conversions.h" // Temporary
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 // case! We should have some more tracking to know for sure. 916 // case! We should have some more tracking to know for sure.
917 new_entry = new NavigationEntryImpl(*pending_entry_); 917 new_entry = new NavigationEntryImpl(*pending_entry_);
918 918
919 // Don't use the page type from the pending entry. Some interstitial page 919 // Don't use the page type from the pending entry. Some interstitial page
920 // may have set the type to interstitial. Once we commit, however, the page 920 // may have set the type to interstitial. Once we commit, however, the page
921 // type must always be normal. 921 // type must always be normal.
922 new_entry->set_page_type(content::PAGE_TYPE_NORMAL); 922 new_entry->set_page_type(content::PAGE_TYPE_NORMAL);
923 update_virtual_url = new_entry->update_virtual_url_with_url(); 923 update_virtual_url = new_entry->update_virtual_url_with_url();
924 } else { 924 } else {
925 new_entry = new NavigationEntryImpl; 925 new_entry = new NavigationEntryImpl;
926
927 // Find out whether the new entry needs to update its virtual URL on URL
928 // change and set up the entry accordingly. This is needed to correctly
929 // update the virtual URL when replaceState is called after a pushState.
Charlie Reis 2012/09/13 22:10:09 We were always doing this before, by using true on
Cem Kocagil 2012/09/13 22:40:03 Actually the only thing that is of importance to m
Charlie Reis 2012/09/13 22:58:23 Oh, I didn't realize that was the important part.
930 GURL temp = params.url;
Charlie Reis 2012/09/13 22:10:09 nit: Please use a better variable name than temp.
931 bool reverse_on_redirect = false;
932 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(
933 &temp, browser_context_, &reverse_on_redirect);
934 new_entry->set_update_virtual_url_with_url(reverse_on_redirect);
935
926 // When navigating to a new page, give the browser URL handler a chance to 936 // When navigating to a new page, give the browser URL handler a chance to
927 // update the virtual URL based on the new URL. For example, this is needed 937 // update the virtual URL based on the new URL. For example, this is needed
928 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes 938 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes
929 // the URL. 939 // the URL.
930 update_virtual_url = true; 940 update_virtual_url = reverse_on_redirect;
931 } 941 }
932 942
933 new_entry->SetURL(params.url); 943 new_entry->SetURL(params.url);
934 if (update_virtual_url) 944 if (update_virtual_url)
935 UpdateVirtualURLToURL(new_entry, params.url); 945 UpdateVirtualURLToURL(new_entry, params.url);
936 new_entry->SetReferrer(params.referrer); 946 new_entry->SetReferrer(params.referrer);
937 new_entry->SetPageID(params.page_id); 947 new_entry->SetPageID(params.page_id);
938 new_entry->SetTransitionType(params.transition); 948 new_entry->SetTransitionType(params.transition);
939 new_entry->set_site_instance( 949 new_entry->set_site_instance(
940 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); 950 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance()));
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 for (int i = 0; i < max_index; i++) { 1574 for (int i = 0; i < max_index; i++) {
1565 // When cloning a tab, copy all entries except interstitial pages 1575 // When cloning a tab, copy all entries except interstitial pages
1566 if (source.entries_[i].get()->GetPageType() != 1576 if (source.entries_[i].get()->GetPageType() !=
1567 content::PAGE_TYPE_INTERSTITIAL) { 1577 content::PAGE_TYPE_INTERSTITIAL) {
1568 entries_.insert(entries_.begin() + insert_index++, 1578 entries_.insert(entries_.begin() + insert_index++,
1569 linked_ptr<NavigationEntryImpl>( 1579 linked_ptr<NavigationEntryImpl>(
1570 new NavigationEntryImpl(*source.entries_[i]))); 1580 new NavigationEntryImpl(*source.entries_[i])));
1571 } 1581 }
1572 } 1582 }
1573 } 1583 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698