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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> | 353 std::unique_ptr<std::vector<BrowserURLRewriter::URLRewriter>> |
354 NavigationManagerImpl::GetTransientURLRewriters() { | 354 NavigationManagerImpl::GetTransientURLRewriters() { |
355 return std::move(transient_url_rewriters_); | 355 return std::move(transient_url_rewriters_); |
356 } | 356 } |
357 | 357 |
358 void NavigationManagerImpl::RemoveTransientURLRewriters() { | 358 void NavigationManagerImpl::RemoveTransientURLRewriters() { |
359 transient_url_rewriters_.reset(); | 359 transient_url_rewriters_.reset(); |
360 } | 360 } |
361 | 361 |
362 void NavigationManagerImpl::CopyState( | |
363 NavigationManagerImpl* navigation_manager) { | |
364 SetSessionController([navigation_manager->GetSessionController() copy]); | |
365 } | |
366 | |
367 int NavigationManagerImpl::GetIndexForOffset(int offset) const { | 362 int NavigationManagerImpl::GetIndexForOffset(int offset) const { |
368 int result = [session_controller_ pendingItemIndex] == -1 | 363 int result = [session_controller_ pendingItemIndex] == -1 |
369 ? GetCurrentItemIndex() | 364 ? GetCurrentItemIndex() |
370 : static_cast<int>([session_controller_ pendingItemIndex]); | 365 : static_cast<int>([session_controller_ pendingItemIndex]); |
371 | 366 |
372 if (offset < 0) { | 367 if (offset < 0) { |
373 if (GetTransientItem() && [session_controller_ pendingItemIndex] == -1) { | 368 if (GetTransientItem() && [session_controller_ pendingItemIndex] == -1) { |
374 // Going back from transient item that added to the end navigation stack | 369 // Going back from transient item that added to the end navigation stack |
375 // is a matter of discarding it as there is no need to move navigation | 370 // is a matter of discarding it as there is no need to move navigation |
376 // index back. | 371 // index back. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 const ScopedNavigationItemImplList& items = [session_controller_ items]; | 445 const ScopedNavigationItemImplList& items = [session_controller_ items]; |
451 while (index >= 0) { | 446 while (index >= 0) { |
452 NavigationItem* item = items[index--].get(); | 447 NavigationItem* item = items[index--].get(); |
453 if (!client->IsAppSpecificURL(item->GetVirtualURL())) | 448 if (!client->IsAppSpecificURL(item->GetVirtualURL())) |
454 return item; | 449 return item; |
455 } | 450 } |
456 return nullptr; | 451 return nullptr; |
457 } | 452 } |
458 | 453 |
459 } // namespace web | 454 } // namespace web |
OLD | NEW |