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 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. | 589 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. |
|
tdresser
2017/03/16 12:24:38
Move the comment below the trace event, it's refer
sunjian
2017/03/16 18:40:30
Acknowledged.
| |
| 590 TRACE_EVENT0("browser,navigation", | |
| 591 "NavigationControllerImpl::GoBack"); | |
| 590 GoToIndex(GetIndexForOffset(-1)); | 592 GoToIndex(GetIndexForOffset(-1)); |
| 591 } | 593 } |
| 592 | 594 |
| 593 void NavigationControllerImpl::GoForward() { | 595 void NavigationControllerImpl::GoForward() { |
| 594 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. | 596 // Call GoToIndex rather than GoToOffset to get the NOTREACHED() check. |
| 597 TRACE_EVENT0("browser,navigation", | |
| 598 "NavigationControllerImpl::GoForward"); | |
| 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 |
| 604 if (transient_entry_index_ != -1) { | 608 if (transient_entry_index_ != -1) { |
| (...skipping 1547 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 |