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

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: comments 4 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 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 // case! We should have some more tracking to know for sure. 865 // case! We should have some more tracking to know for sure.
866 new_entry = new NavigationEntryImpl(*pending_entry_); 866 new_entry = new NavigationEntryImpl(*pending_entry_);
867 867
868 // Don't use the page type from the pending entry. Some interstitial page 868 // Don't use the page type from the pending entry. Some interstitial page
869 // may have set the type to interstitial. Once we commit, however, the page 869 // may have set the type to interstitial. Once we commit, however, the page
870 // type must always be normal. 870 // type must always be normal.
871 new_entry->set_page_type(content::PAGE_TYPE_NORMAL); 871 new_entry->set_page_type(content::PAGE_TYPE_NORMAL);
872 update_virtual_url = new_entry->update_virtual_url_with_url(); 872 update_virtual_url = new_entry->update_virtual_url_with_url();
873 } else { 873 } else {
874 new_entry = new NavigationEntryImpl; 874 new_entry = new NavigationEntryImpl;
875
876 // Find out whether the new entry needs to update its virtual URL on URL
877 // change and set up the entry accordingly. This is needed to correctly
878 // update the virtual URL when replaceState is called after a pushState.
879 // For example, this allows uber page to update the virtual URL by calling
jam 2012/08/08 23:37:52 nit: uber page should not be mentioned in content,
880 // replaceState after the user navigates via the uber-frame.
881 GURL temp = params.url;
882 bool reverse_on_redirect = false;
883 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(
884 &temp, browser_context_, &reverse_on_redirect);
885 new_entry->set_update_virtual_url_with_url(reverse_on_redirect);
886
875 // When navigating to a new page, give the browser URL handler a chance to 887 // When navigating to a new page, give the browser URL handler a chance to
876 // update the virtual URL based on the new URL. For example, this is needed 888 // update the virtual URL based on the new URL. For example, this is needed
877 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes 889 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes
878 // the URL. 890 // the URL.
879 update_virtual_url = true; 891 update_virtual_url = reverse_on_redirect;
880 } 892 }
881 893
882 new_entry->SetURL(params.url); 894 new_entry->SetURL(params.url);
883 if (update_virtual_url) 895 if (update_virtual_url)
884 UpdateVirtualURLToURL(new_entry, params.url); 896 UpdateVirtualURLToURL(new_entry, params.url);
885 new_entry->SetReferrer(params.referrer); 897 new_entry->SetReferrer(params.referrer);
886 new_entry->SetPageID(params.page_id); 898 new_entry->SetPageID(params.page_id);
887 new_entry->SetTransitionType(params.transition); 899 new_entry->SetTransitionType(params.transition);
888 new_entry->set_site_instance( 900 new_entry->set_site_instance(
889 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); 901 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance()));
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 for (int i = 0; i < max_index; i++) { 1466 for (int i = 0; i < max_index; i++) {
1455 // When cloning a tab, copy all entries except interstitial pages 1467 // When cloning a tab, copy all entries except interstitial pages
1456 if (source.entries_[i].get()->GetPageType() != 1468 if (source.entries_[i].get()->GetPageType() !=
1457 content::PAGE_TYPE_INTERSTITIAL) { 1469 content::PAGE_TYPE_INTERSTITIAL) {
1458 entries_.insert(entries_.begin() + insert_index++, 1470 entries_.insert(entries_.begin() + insert_index++,
1459 linked_ptr<NavigationEntryImpl>( 1471 linked_ptr<NavigationEntryImpl>(
1460 new NavigationEntryImpl(*source.entries_[i]))); 1472 new NavigationEntryImpl(*source.entries_[i])));
1461 } 1473 }
1462 } 1474 }
1463 } 1475 }
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