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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 } | 260 } |
261 | 261 |
262 int NavigationManagerImpl::GetItemCount() const { | 262 int NavigationManagerImpl::GetItemCount() const { |
263 return [session_controller_ items].size(); | 263 return [session_controller_ items].size(); |
264 } | 264 } |
265 | 265 |
266 NavigationItem* NavigationManagerImpl::GetItemAtIndex(size_t index) const { | 266 NavigationItem* NavigationManagerImpl::GetItemAtIndex(size_t index) const { |
267 return [session_controller_ itemAtIndex:index]; | 267 return [session_controller_ itemAtIndex:index]; |
268 } | 268 } |
269 | 269 |
270 int NavigationManagerImpl::GetIndexOfItem( | |
271 const web::NavigationItem* item) const { | |
272 return [session_controller_ indexOfItem:item]; | |
Eugene But (OOO till 7-30)
2017/06/02 18:08:08
NSNotFound will not survive this implicit case. We
kkhorimoto
2017/06/02 18:28:58
Done.
| |
273 } | |
274 | |
270 int NavigationManagerImpl::GetPendingItemIndex() const { | 275 int NavigationManagerImpl::GetPendingItemIndex() const { |
271 if (GetPendingItem()) { | 276 if (GetPendingItem()) { |
272 if ([session_controller_ pendingItemIndex] != -1) { | 277 if ([session_controller_ pendingItemIndex] != -1) { |
273 return [session_controller_ pendingItemIndex]; | 278 return [session_controller_ pendingItemIndex]; |
274 } | 279 } |
275 // TODO(crbug.com/665189): understand why last committed item index is | 280 // TODO(crbug.com/665189): understand why last committed item index is |
276 // returned here. | 281 // returned here. |
277 return GetLastCommittedItemIndex(); | 282 return GetLastCommittedItemIndex(); |
278 } | 283 } |
279 return -1; | 284 return -1; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
443 const ScopedNavigationItemImplList& items = [session_controller_ items]; | 448 const ScopedNavigationItemImplList& items = [session_controller_ items]; |
444 while (index >= 0) { | 449 while (index >= 0) { |
445 NavigationItem* item = items[index--].get(); | 450 NavigationItem* item = items[index--].get(); |
446 if (!client->IsAppSpecificURL(item->GetVirtualURL())) | 451 if (!client->IsAppSpecificURL(item->GetVirtualURL())) |
447 return item; | 452 return item; |
448 } | 453 } |
449 return nullptr; | 454 return nullptr; |
450 } | 455 } |
451 | 456 |
452 } // namespace web | 457 } // namespace web |
OLD | NEW |