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

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

Issue 12001002: InstantExtended: Transient naventry for preview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 10 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 728
729 void NavigationControllerImpl::UpdateVirtualURLToURL( 729 void NavigationControllerImpl::UpdateVirtualURLToURL(
730 NavigationEntryImpl* entry, const GURL& new_url) { 730 NavigationEntryImpl* entry, const GURL& new_url) {
731 GURL new_virtual_url(new_url); 731 GURL new_virtual_url(new_url);
732 if (BrowserURLHandlerImpl::GetInstance()->ReverseURLRewrite( 732 if (BrowserURLHandlerImpl::GetInstance()->ReverseURLRewrite(
733 &new_virtual_url, entry->GetVirtualURL(), browser_context_)) { 733 &new_virtual_url, entry->GetVirtualURL(), browser_context_)) {
734 entry->SetVirtualURL(new_virtual_url); 734 entry->SetVirtualURL(new_virtual_url);
735 } 735 }
736 } 736 }
737 737
738 void NavigationControllerImpl::AddTransientEntry(NavigationEntryImpl* entry) {
739 // Discard any current transient entry, we can only have one at a time.
740 int index = 0;
741 if (last_committed_entry_index_ != -1)
742 index = last_committed_entry_index_ + 1;
743 DiscardTransientEntry();
744 entries_.insert(
745 entries_.begin() + index, linked_ptr<NavigationEntryImpl>(entry));
746 transient_entry_index_ = index;
747 web_contents_->NotifyNavigationStateChanged(kInvalidateAll);
748 }
749
750 void NavigationControllerImpl::LoadURL( 738 void NavigationControllerImpl::LoadURL(
751 const GURL& url, 739 const GURL& url,
752 const Referrer& referrer, 740 const Referrer& referrer,
753 PageTransition transition, 741 PageTransition transition,
754 const std::string& extra_headers) { 742 const std::string& extra_headers) {
755 LoadURLParams params(url); 743 LoadURLParams params(url);
756 params.referrer = referrer; 744 params.referrer = referrer;
757 params.transition_type = transition; 745 params.transition_type = transition;
758 params.extra_headers = extra_headers; 746 params.extra_headers = extra_headers;
759 LoadURLWithParams(params); 747 LoadURLWithParams(params);
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 } 1740 }
1753 return -1; 1741 return -1;
1754 } 1742 }
1755 1743
1756 NavigationEntry* NavigationControllerImpl::GetTransientEntry() const { 1744 NavigationEntry* NavigationControllerImpl::GetTransientEntry() const {
1757 if (transient_entry_index_ == -1) 1745 if (transient_entry_index_ == -1)
1758 return NULL; 1746 return NULL;
1759 return entries_[transient_entry_index_].get(); 1747 return entries_[transient_entry_index_].get();
1760 } 1748 }
1761 1749
1750 void NavigationControllerImpl::AddTransientEntry(NavigationEntry* entry) {
1751 // Discard any current transient entry, we can only have one at a time.
1752 int index = 0;
1753 if (last_committed_entry_index_ != -1)
1754 index = last_committed_entry_index_ + 1;
1755 DiscardTransientEntry();
1756 entries_.insert(
1757 entries_.begin() + index, linked_ptr<NavigationEntryImpl>(
1758 NavigationEntryImpl::FromNavigationEntry(entry)));
1759 transient_entry_index_ = index;
1760 web_contents_->NotifyNavigationStateChanged(kInvalidateAll);
1761 }
1762
1762 void NavigationControllerImpl::InsertEntriesFrom( 1763 void NavigationControllerImpl::InsertEntriesFrom(
1763 const NavigationControllerImpl& source, 1764 const NavigationControllerImpl& source,
1764 int max_index) { 1765 int max_index) {
1765 DCHECK_LE(max_index, source.GetEntryCount()); 1766 DCHECK_LE(max_index, source.GetEntryCount());
1766 size_t insert_index = 0; 1767 size_t insert_index = 0;
1767 for (int i = 0; i < max_index; i++) { 1768 for (int i = 0; i < max_index; i++) {
1768 // When cloning a tab, copy all entries except interstitial pages 1769 // When cloning a tab, copy all entries except interstitial pages
1769 if (source.entries_[i].get()->GetPageType() != 1770 if (source.entries_[i].get()->GetPageType() !=
1770 PAGE_TYPE_INTERSTITIAL) { 1771 PAGE_TYPE_INTERSTITIAL) {
1771 entries_.insert(entries_.begin() + insert_index++, 1772 entries_.insert(entries_.begin() + insert_index++,
1772 linked_ptr<NavigationEntryImpl>( 1773 linked_ptr<NavigationEntryImpl>(
1773 new NavigationEntryImpl(*source.entries_[i]))); 1774 new NavigationEntryImpl(*source.entries_[i])));
1774 } 1775 }
1775 } 1776 }
1776 } 1777 }
1777 1778
1778 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1779 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1779 const base::Callback<base::Time()>& get_timestamp_callback) { 1780 const base::Callback<base::Time()>& get_timestamp_callback) {
1780 get_timestamp_callback_ = get_timestamp_callback; 1781 get_timestamp_callback_ = get_timestamp_callback;
1781 } 1782 }
1782 1783
1783 void NavigationControllerImpl::SetTakeScreenshotCallbackForTest( 1784 void NavigationControllerImpl::SetTakeScreenshotCallbackForTest(
1784 const base::Callback<void(RenderViewHost*)>& take_screenshot_callback) { 1785 const base::Callback<void(RenderViewHost*)>& take_screenshot_callback) {
1785 take_screenshot_callback_ = take_screenshot_callback; 1786 take_screenshot_callback_ = take_screenshot_callback;
1786 } 1787 }
1787 1788
1788 } // namespace content 1789 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl.h ('k') | content/public/browser/navigation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698