| 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"); | |
| 591 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. | 589 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. |
| 592 GoToIndex(GetIndexForOffset(-1)); | 590 GoToIndex(GetIndexForOffset(-1)); |
| 593 } | 591 } |
| 594 | 592 |
| 595 void NavigationControllerImpl::GoForward() { | 593 void NavigationControllerImpl::GoForward() { |
| 596 TRACE_EVENT0("browser,navigation", | |
| 597 "NavigationControllerImpl::GoForward"); | |
| 598 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. | 594 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. |
| 599 GoToIndex(GetIndexForOffset(1)); | 595 GoToIndex(GetIndexForOffset(1)); |
| 600 } | 596 } |
| 601 | 597 |
| 602 void NavigationControllerImpl::GoToIndex(int index) { | 598 void NavigationControllerImpl::GoToIndex(int index) { |
| 599 TRACE_EVENT0("browser,navigation,benchmark", |
| 600 "NavigationControllerImpl::GoToIndex"); |
| 603 if (index < 0 || index >= static_cast<int>(entries_.size())) { | 601 if (index < 0 || index >= static_cast<int>(entries_.size())) { |
| 604 NOTREACHED(); | 602 NOTREACHED(); |
| 605 return; | 603 return; |
| 606 } | 604 } |
| 607 | 605 |
| 608 if (transient_entry_index_ != -1) { | 606 if (transient_entry_index_ != -1) { |
| 609 if (index == transient_entry_index_) { | 607 if (index == transient_entry_index_) { |
| 610 // Nothing to do when navigating to the transient. | 608 // Nothing to do when navigating to the transient. |
| 611 return; | 609 return; |
| 612 } | 610 } |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2158 } | 2156 } |
| 2159 } | 2157 } |
| 2160 } | 2158 } |
| 2161 | 2159 |
| 2162 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2160 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2163 const base::Callback<base::Time()>& get_timestamp_callback) { | 2161 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2164 get_timestamp_callback_ = get_timestamp_callback; | 2162 get_timestamp_callback_ = get_timestamp_callback; |
| 2165 } | 2163 } |
| 2166 | 2164 |
| 2167 } // namespace content | 2165 } // namespace content |
| OLD | NEW |