| 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 "ios/web/navigation/navigation_manager_impl.h" | 5 #include "ios/web/navigation/navigation_manager_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 NSUInteger idx = static_cast<NSUInteger>(index); | 280 NSUInteger idx = static_cast<NSUInteger>(index); |
| 281 NSArray* entries = [session_controller_ entries]; | 281 NSArray* entries = [session_controller_ entries]; |
| 282 if (idx >= entries.count) | 282 if (idx >= entries.count) |
| 283 return false; | 283 return false; |
| 284 | 284 |
| 285 [session_controller_ removeEntryAtIndex:index]; | 285 [session_controller_ removeEntryAtIndex:index]; |
| 286 return true; | 286 return true; |
| 287 } | 287 } |
| 288 | 288 |
| 289 bool NavigationManagerImpl::CanGoBack() const { | 289 bool NavigationManagerImpl::CanGoBack() const { |
| 290 return [session_controller_ canGoBack]; | 290 return CanGoToOffset(-1); |
| 291 } | 291 } |
| 292 | 292 |
| 293 bool NavigationManagerImpl::CanGoForward() const { | 293 bool NavigationManagerImpl::CanGoForward() const { |
| 294 return [session_controller_ canGoForward]; | 294 return CanGoToOffset(1); |
| 295 } |
| 296 |
| 297 bool NavigationManagerImpl::CanGoToOffset(int offset) const { |
| 298 return [session_controller_ canGoDelta:offset]; |
| 295 } | 299 } |
| 296 | 300 |
| 297 void NavigationManagerImpl::GoBack() { | 301 void NavigationManagerImpl::GoBack() { |
| 298 delegate_->GoToOffset(-1); | 302 delegate_->GoToOffset(-1); |
| 299 } | 303 } |
| 300 | 304 |
| 301 void NavigationManagerImpl::GoForward() { | 305 void NavigationManagerImpl::GoForward() { |
| 302 delegate_->GoToOffset(1); | 306 delegate_->GoToOffset(1); |
| 303 } | 307 } |
| 304 | 308 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 327 void NavigationManagerImpl::RemoveTransientURLRewriters() { | 331 void NavigationManagerImpl::RemoveTransientURLRewriters() { |
| 328 transient_url_rewriters_.reset(); | 332 transient_url_rewriters_.reset(); |
| 329 } | 333 } |
| 330 | 334 |
| 331 void NavigationManagerImpl::CopyState( | 335 void NavigationManagerImpl::CopyState( |
| 332 NavigationManagerImpl* navigation_manager) { | 336 NavigationManagerImpl* navigation_manager) { |
| 333 SetSessionController([navigation_manager->GetSessionController() copy]); | 337 SetSessionController([navigation_manager->GetSessionController() copy]); |
| 334 } | 338 } |
| 335 | 339 |
| 336 } // namespace web | 340 } // namespace web |
| OLD | NEW |