| 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 #import "ios/web/navigation/navigation_manager_impl.h" | 5 #import "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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 330 } |
| 331 | 331 |
| 332 void NavigationManagerImpl::GoForward() { | 332 void NavigationManagerImpl::GoForward() { |
| 333 delegate_->GoToIndex(GetIndexForOffset(1)); | 333 delegate_->GoToIndex(GetIndexForOffset(1)); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void NavigationManagerImpl::GoToIndex(int index) { | 336 void NavigationManagerImpl::GoToIndex(int index) { |
| 337 delegate_->GoToIndex(index); | 337 delegate_->GoToIndex(index); |
| 338 } | 338 } |
| 339 | 339 |
| 340 NavigationItemList NavigationManagerImpl::GetBackwardItems() const { |
| 341 return [session_controller_ backwardItems]; |
| 342 } |
| 343 |
| 344 NavigationItemList NavigationManagerImpl::GetForwardItems() const { |
| 345 return [session_controller_ forwardItems]; |
| 346 } |
| 347 |
| 340 void NavigationManagerImpl::Reload(bool check_for_reposts) { | 348 void NavigationManagerImpl::Reload(bool check_for_reposts) { |
| 341 // Navigation manager may be empty if the only pending item failed to load | 349 // Navigation manager may be empty if the only pending item failed to load |
| 342 // with SSL error and the user has decided not to proceed. | 350 // with SSL error and the user has decided not to proceed. |
| 343 NavigationItem* item = GetVisibleItem(); | 351 NavigationItem* item = GetVisibleItem(); |
| 344 GURL url = item ? item->GetURL() : GURL(url::kAboutBlankURL); | 352 GURL url = item ? item->GetURL() : GURL(url::kAboutBlankURL); |
| 345 web::Referrer referrer = item ? item->GetReferrer() : web::Referrer(); | 353 web::Referrer referrer = item ? item->GetReferrer() : web::Referrer(); |
| 346 | 354 |
| 347 WebState::OpenURLParams params(url, referrer, | 355 WebState::OpenURLParams params(url, referrer, |
| 348 WindowOpenDisposition::CURRENT_TAB, | 356 WindowOpenDisposition::CURRENT_TAB, |
| 349 ui::PAGE_TRANSITION_RELOAD, NO); | 357 ui::PAGE_TRANSITION_RELOAD, NO); |
| 350 delegate_->GetWebState()->OpenURL(params); | 358 delegate_->GetWebState()->OpenURL(params); |
| 351 } | 359 } |
| 352 | 360 |
| 361 void NavigationManagerImpl::InsertStateFromManager( |
| 362 const NavigationManager* manager) { |
| 363 DCHECK(manager); |
| 364 CRWSessionController* other_session = |
| 365 static_cast<const NavigationManagerImpl*>(manager)->session_controller_; |
| 366 [session_controller_ insertStateFromSessionController:other_session]; |
| 367 } |
| 368 |
| 353 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> | 369 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> |
| 354 NavigationManagerImpl::GetTransientURLRewriters() { | 370 NavigationManagerImpl::GetTransientURLRewriters() { |
| 355 return std::move(transient_url_rewriters_); | 371 return std::move(transient_url_rewriters_); |
| 356 } | 372 } |
| 357 | 373 |
| 358 void NavigationManagerImpl::RemoveTransientURLRewriters() { | 374 void NavigationManagerImpl::RemoveTransientURLRewriters() { |
| 359 transient_url_rewriters_.reset(); | 375 transient_url_rewriters_.reset(); |
| 360 } | 376 } |
| 361 | 377 |
| 362 int NavigationManagerImpl::GetIndexForOffset(int offset) const { | 378 int NavigationManagerImpl::GetIndexForOffset(int offset) const { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 const ScopedNavigationItemImplList& items = [session_controller_ items]; | 461 const ScopedNavigationItemImplList& items = [session_controller_ items]; |
| 446 while (index >= 0) { | 462 while (index >= 0) { |
| 447 NavigationItem* item = items[index--].get(); | 463 NavigationItem* item = items[index--].get(); |
| 448 if (!client->IsAppSpecificURL(item->GetVirtualURL())) | 464 if (!client->IsAppSpecificURL(item->GetVirtualURL())) |
| 449 return item; | 465 return item; |
| 450 } | 466 } |
| 451 return nullptr; | 467 return nullptr; |
| 452 } | 468 } |
| 453 | 469 |
| 454 } // namespace web | 470 } // namespace web |
| OLD | NEW |