OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 // when the tab is being destroyed for shutdown, since it won't return to | 1726 // when the tab is being destroyed for shutdown, since it won't return to |
1727 // NavigateToEntry in that case.) http://crbug.com/347742. | 1727 // NavigateToEntry in that case.) http://crbug.com/347742. |
1728 CHECK(!in_navigate_to_pending_entry_ || delegate_->IsBeingDestroyed()); | 1728 CHECK(!in_navigate_to_pending_entry_ || delegate_->IsBeingDestroyed()); |
1729 | 1729 |
1730 if (pending_entry_index_ == -1) | 1730 if (pending_entry_index_ == -1) |
1731 delete pending_entry_; | 1731 delete pending_entry_; |
1732 pending_entry_ = NULL; | 1732 pending_entry_ = NULL; |
1733 pending_entry_index_ = -1; | 1733 pending_entry_index_ = -1; |
1734 } | 1734 } |
1735 | 1735 |
| 1736 void NavigationControllerImpl::FillHistoryParametersForNavigationEntry( |
| 1737 const NavigationEntryImpl& entry, |
| 1738 int* pending_history_list_offset, |
| 1739 int* current_history_list_offset, |
| 1740 int* current_history_list_length) const { |
| 1741 if (entry.should_clear_history_list()) { |
| 1742 // Set the history list related parameters to the same values a |
| 1743 // NavigationController would return before its first navigation. This will |
| 1744 // fully clear the RenderView's view of the session history. |
| 1745 *pending_history_list_offset = -1; |
| 1746 *current_history_list_offset = -1; |
| 1747 *current_history_list_length = 0; |
| 1748 } else { |
| 1749 *pending_history_list_offset = GetIndexOfEntry(&entry); |
| 1750 *current_history_list_offset = GetLastCommittedEntryIndex(); |
| 1751 *current_history_list_length = GetEntryCount(); |
| 1752 } |
| 1753 } |
| 1754 |
1736 void NavigationControllerImpl::DiscardTransientEntry() { | 1755 void NavigationControllerImpl::DiscardTransientEntry() { |
1737 if (transient_entry_index_ == -1) | 1756 if (transient_entry_index_ == -1) |
1738 return; | 1757 return; |
1739 entries_.erase(entries_.begin() + transient_entry_index_); | 1758 entries_.erase(entries_.begin() + transient_entry_index_); |
1740 if (last_committed_entry_index_ > transient_entry_index_) | 1759 if (last_committed_entry_index_ > transient_entry_index_) |
1741 last_committed_entry_index_--; | 1760 last_committed_entry_index_--; |
1742 transient_entry_index_ = -1; | 1761 transient_entry_index_ = -1; |
1743 } | 1762 } |
1744 | 1763 |
1745 int NavigationControllerImpl::GetEntryIndexWithPageID( | 1764 int NavigationControllerImpl::GetEntryIndexWithPageID( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 } | 1805 } |
1787 } | 1806 } |
1788 } | 1807 } |
1789 | 1808 |
1790 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1809 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1791 const base::Callback<base::Time()>& get_timestamp_callback) { | 1810 const base::Callback<base::Time()>& get_timestamp_callback) { |
1792 get_timestamp_callback_ = get_timestamp_callback; | 1811 get_timestamp_callback_ = get_timestamp_callback; |
1793 } | 1812 } |
1794 | 1813 |
1795 } // namespace content | 1814 } // namespace content |
OLD | NEW |