Chromium Code Reviews| 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 /* | 5 /* |
| 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 bool NavigationControllerImpl::CanGoForward() const { | 579 bool NavigationControllerImpl::CanGoForward() const { |
| 580 return CanGoToOffset(1); | 580 return CanGoToOffset(1); |
| 581 } | 581 } |
| 582 | 582 |
| 583 bool NavigationControllerImpl::CanGoToOffset(int offset) const { | 583 bool NavigationControllerImpl::CanGoToOffset(int offset) const { |
| 584 int index = GetIndexForOffset(offset); | 584 int index = GetIndexForOffset(offset); |
| 585 return index >= 0 && index < GetEntryCount(); | 585 return index >= 0 && index < GetEntryCount(); |
| 586 } | 586 } |
| 587 | 587 |
| 588 void NavigationControllerImpl::GoBack() { | 588 void NavigationControllerImpl::GoBack() { |
| 589 TRACE_EVENT0("browser,navigation", | |
| 590 "NavigationControllerImpl::GoBack"); | |
| 589 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. | 591 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. |
| 590 GoToIndex(GetIndexForOffset(-1)); | 592 GoToIndex(GetIndexForOffset(-1)); |
| 591 } | 593 } |
| 592 | 594 |
| 593 void NavigationControllerImpl::GoForward() { | 595 void NavigationControllerImpl::GoForward() { |
| 596 TRACE_EVENT0("browser,navigation", | |
| 597 "NavigationControllerImpl::GoForward"); | |
| 594 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. | 598 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. |
| 595 GoToIndex(GetIndexForOffset(1)); | 599 GoToIndex(GetIndexForOffset(1)); |
| 596 } | 600 } |
| 597 | 601 |
| 598 void NavigationControllerImpl::GoToIndex(int index) { | 602 void NavigationControllerImpl::GoToIndex(int index) { |
| 599 if (index < 0 || index >= static_cast<int>(entries_.size())) { | 603 if (index < 0 || index >= static_cast<int>(entries_.size())) { |
| 600 NOTREACHED(); | 604 NOTREACHED(); |
| 601 return; | 605 return; |
| 602 } | 606 } |
| 603 | 607 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 615 DiscardNonCommittedEntries(); | 619 DiscardNonCommittedEntries(); |
| 616 | 620 |
| 617 pending_entry_index_ = index; | 621 pending_entry_index_ = index; |
| 618 entries_[pending_entry_index_]->SetTransitionType( | 622 entries_[pending_entry_index_]->SetTransitionType( |
| 619 ui::PageTransitionFromInt( | 623 ui::PageTransitionFromInt( |
| 620 entries_[pending_entry_index_]->GetTransitionType() | | 624 entries_[pending_entry_index_]->GetTransitionType() | |
| 621 ui::PAGE_TRANSITION_FORWARD_BACK)); | 625 ui::PAGE_TRANSITION_FORWARD_BACK)); |
| 622 NavigateToPendingEntry(ReloadType::NONE); | 626 NavigateToPendingEntry(ReloadType::NONE); |
| 623 } | 627 } |
| 624 | 628 |
| 625 void NavigationControllerImpl::GoToOffset(int offset) { | 629 void NavigationControllerImpl::GoToOffset(int offset) { |
|
nasko
2017/03/16 20:34:44
Might be useful to add tracing to this one and GoT
tdresser
2017/03/17 13:31:44
If we only instrumented GoToIndex, we'd have full
| |
| 626 // Note: This is actually reached in unit tests. | 630 // Note: This is actually reached in unit tests. |
| 627 if (!CanGoToOffset(offset)) | 631 if (!CanGoToOffset(offset)) |
| 628 return; | 632 return; |
| 629 | 633 |
| 630 GoToIndex(GetIndexForOffset(offset)); | 634 GoToIndex(GetIndexForOffset(offset)); |
| 631 } | 635 } |
| 632 | 636 |
| 633 bool NavigationControllerImpl::RemoveEntryAtIndex(int index) { | 637 bool NavigationControllerImpl::RemoveEntryAtIndex(int index) { |
| 634 if (index == last_committed_entry_index_ || | 638 if (index == last_committed_entry_index_ || |
| 635 index == pending_entry_index_) | 639 index == pending_entry_index_) |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2152 } | 2156 } |
| 2153 } | 2157 } |
| 2154 } | 2158 } |
| 2155 | 2159 |
| 2156 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2160 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2157 const base::Callback<base::Time()>& get_timestamp_callback) { | 2161 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2158 get_timestamp_callback_ = get_timestamp_callback; | 2162 get_timestamp_callback_ = get_timestamp_callback; |
| 2159 } | 2163 } |
| 2160 | 2164 |
| 2161 } // namespace content | 2165 } // namespace content |
| OLD | NEW |