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

Side by Side Diff: content/browser/tab_contents/navigation_controller_impl.cc

Issue 9688019: Add a Content API around BrowserURLHandler. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix gypis Created 8 years, 9 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/tab_contents/navigation_controller_impl.h" 5 #include "content/browser/tab_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"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "content/browser/browser_url_handler.h" 13 #include "content/browser/browser_url_handler_impl.h"
14 #include "content/browser/child_process_security_policy_impl.h" 14 #include "content/browser/child_process_security_policy_impl.h"
15 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" 15 #include "content/browser/in_process_webkit/dom_storage_context_impl.h"
16 #include "content/browser/in_process_webkit/session_storage_namespace_impl.h" 16 #include "content/browser/in_process_webkit/session_storage_namespace_impl.h"
17 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary 17 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary
18 #include "content/browser/site_instance_impl.h" 18 #include "content/browser/site_instance_impl.h"
19 #include "content/browser/tab_contents/debug_urls.h" 19 #include "content/browser/tab_contents/debug_urls.h"
20 #include "content/browser/tab_contents/interstitial_page_impl.h" 20 #include "content/browser/tab_contents/interstitial_page_impl.h"
21 #include "content/browser/tab_contents/navigation_entry_impl.h" 21 #include "content/browser/tab_contents/navigation_entry_impl.h"
22 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
23 #include "content/common/view_messages.h" 23 #include "content/common/view_messages.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 PageTransition transition, 136 PageTransition transition,
137 bool is_renderer_initiated, 137 bool is_renderer_initiated,
138 const std::string& extra_headers, 138 const std::string& extra_headers,
139 BrowserContext* browser_context) { 139 BrowserContext* browser_context) {
140 // Allow the browser URL handler to rewrite the URL. This will, for example, 140 // Allow the browser URL handler to rewrite the URL. This will, for example,
141 // remove "view-source:" from the beginning of the URL to get the URL that 141 // remove "view-source:" from the beginning of the URL to get the URL that
142 // will actually be loaded. This real URL won't be shown to the user, just 142 // will actually be loaded. This real URL won't be shown to the user, just
143 // used internally. 143 // used internally.
144 GURL loaded_url(url); 144 GURL loaded_url(url);
145 bool reverse_on_redirect = false; 145 bool reverse_on_redirect = false;
146 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 146 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(
147 &loaded_url, browser_context, &reverse_on_redirect); 147 &loaded_url, browser_context, &reverse_on_redirect);
148 148
149 NavigationEntryImpl* entry = new NavigationEntryImpl( 149 NavigationEntryImpl* entry = new NavigationEntryImpl(
150 NULL, // The site instance for tabs is sent on navigation 150 NULL, // The site instance for tabs is sent on navigation
151 // (TabContents::GetSiteInstance). 151 // (TabContents::GetSiteInstance).
152 -1, 152 -1,
153 loaded_url, 153 loaded_url,
154 referrer, 154 referrer,
155 string16(), 155 string16(),
156 transition, 156 transition,
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 void NavigationControllerImpl::RemoveEntryAtIndex(int index) { 527 void NavigationControllerImpl::RemoveEntryAtIndex(int index) {
528 if (index == last_committed_entry_index_) 528 if (index == last_committed_entry_index_)
529 return; 529 return;
530 530
531 RemoveEntryAtIndexInternal(index); 531 RemoveEntryAtIndexInternal(index);
532 } 532 }
533 533
534 void NavigationControllerImpl::UpdateVirtualURLToURL( 534 void NavigationControllerImpl::UpdateVirtualURLToURL(
535 NavigationEntryImpl* entry, const GURL& new_url) { 535 NavigationEntryImpl* entry, const GURL& new_url) {
536 GURL new_virtual_url(new_url); 536 GURL new_virtual_url(new_url);
537 if (BrowserURLHandler::GetInstance()->ReverseURLRewrite( 537 if (BrowserURLHandlerImpl::GetInstance()->ReverseURLRewrite(
538 &new_virtual_url, entry->GetVirtualURL(), browser_context_)) { 538 &new_virtual_url, entry->GetVirtualURL(), browser_context_)) {
539 entry->SetVirtualURL(new_virtual_url); 539 entry->SetVirtualURL(new_virtual_url);
540 } 540 }
541 } 541 }
542 542
543 void NavigationControllerImpl::AddTransientEntry(NavigationEntryImpl* entry) { 543 void NavigationControllerImpl::AddTransientEntry(NavigationEntryImpl* entry) {
544 // Discard any current transient entry, we can only have one at a time. 544 // Discard any current transient entry, we can only have one at a time.
545 int index = 0; 545 int index = 0;
546 if (last_committed_entry_index_ != -1) 546 if (last_committed_entry_index_ != -1)
547 index = last_committed_entry_index_ + 1; 547 index = last_committed_entry_index_ + 1;
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 for (int i = 0; i < max_index; i++) { 1429 for (int i = 0; i < max_index; i++) {
1430 // When cloning a tab, copy all entries except interstitial pages 1430 // When cloning a tab, copy all entries except interstitial pages
1431 if (source.entries_[i].get()->GetPageType() != 1431 if (source.entries_[i].get()->GetPageType() !=
1432 content::PAGE_TYPE_INTERSTITIAL) { 1432 content::PAGE_TYPE_INTERSTITIAL) {
1433 entries_.insert(entries_.begin() + insert_index++, 1433 entries_.insert(entries_.begin() + insert_index++,
1434 linked_ptr<NavigationEntryImpl>( 1434 linked_ptr<NavigationEntryImpl>(
1435 new NavigationEntryImpl(*source.entries_[i]))); 1435 new NavigationEntryImpl(*source.entries_[i])));
1436 } 1436 }
1437 } 1437 }
1438 } 1438 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698