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