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

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: added tests 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
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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // When navigating to a new page, give the browser URL handler a chance to 875 // 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 876 // 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 877 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes
878 // the URL. 878 // the URL.
879 update_virtual_url = true; 879 GURL temp = params.url;
880 bool reverse_on_redirect = false;
881 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(
Alexei Svitkine (slow) 2012/08/02 22:00:11 Can you add a comment explaining what this is doin
882 &temp, browser_context_, &reverse_on_redirect);
883 update_virtual_url = reverse_on_redirect;
884 new_entry->set_update_virtual_url_with_url(reverse_on_redirect);
880 } 885 }
881 886
882 new_entry->SetURL(params.url); 887 new_entry->SetURL(params.url);
883 if (update_virtual_url) 888 if (update_virtual_url)
884 UpdateVirtualURLToURL(new_entry, params.url); 889 UpdateVirtualURLToURL(new_entry, params.url);
885 new_entry->SetReferrer(params.referrer); 890 new_entry->SetReferrer(params.referrer);
886 new_entry->SetPageID(params.page_id); 891 new_entry->SetPageID(params.page_id);
887 new_entry->SetTransitionType(params.transition); 892 new_entry->SetTransitionType(params.transition);
888 new_entry->set_site_instance( 893 new_entry->set_site_instance(
889 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); 894 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++) { 1459 for (int i = 0; i < max_index; i++) {
1455 // When cloning a tab, copy all entries except interstitial pages 1460 // When cloning a tab, copy all entries except interstitial pages
1456 if (source.entries_[i].get()->GetPageType() != 1461 if (source.entries_[i].get()->GetPageType() !=
1457 content::PAGE_TYPE_INTERSTITIAL) { 1462 content::PAGE_TYPE_INTERSTITIAL) {
1458 entries_.insert(entries_.begin() + insert_index++, 1463 entries_.insert(entries_.begin() + insert_index++,
1459 linked_ptr<NavigationEntryImpl>( 1464 linked_ptr<NavigationEntryImpl>(
1460 new NavigationEntryImpl(*source.entries_[i]))); 1465 new NavigationEntryImpl(*source.entries_[i])));
1461 } 1466 }
1462 } 1467 }
1463 } 1468 }
OLDNEW
« chrome/browser/chrome_content_browser_client_unittest.cc ('K') | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698