| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/sessions/ios/ios_live_tab.h" | 5 #include "components/sessions/ios/ios_live_tab.h" |
| 6 #include "ios/web/public/navigation_manager.h" | 6 #include "ios/web/public/navigation_manager.h" |
| 7 | 7 |
| 8 namespace { | 8 namespace { |
| 9 const char kIOSLiveTabWebStateUserDataKey[] = "ios_live_tab"; | 9 const char kIOSLiveTabWebStateUserDataKey[] = "ios_live_tab"; |
| 10 } | 10 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 IOSLiveTab::IOSLiveTab(web::WebState* web_state) : web_state_(web_state) {} | 27 IOSLiveTab::IOSLiveTab(web::WebState* web_state) : web_state_(web_state) {} |
| 28 | 28 |
| 29 IOSLiveTab::~IOSLiveTab() {} | 29 IOSLiveTab::~IOSLiveTab() {} |
| 30 | 30 |
| 31 bool IOSLiveTab::IsInitialBlankNavigation() { | 31 bool IOSLiveTab::IsInitialBlankNavigation() { |
| 32 return navigation_manager()->GetItemCount() == 0; | 32 return navigation_manager()->GetItemCount() == 0; |
| 33 } | 33 } |
| 34 | 34 |
| 35 int IOSLiveTab::GetCurrentEntryIndex() { | 35 int IOSLiveTab::GetCurrentEntryIndex() { |
| 36 return navigation_manager()->GetCurrentItemIndex(); | 36 return navigation_manager()->GetLastCommittedItemIndex(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 int IOSLiveTab::GetPendingEntryIndex() { | 39 int IOSLiveTab::GetPendingEntryIndex() { |
| 40 return navigation_manager()->GetPendingItemIndex(); | 40 return navigation_manager()->GetPendingItemIndex(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 sessions::SerializedNavigationEntry IOSLiveTab::GetEntryAtIndex(int index) { | 43 sessions::SerializedNavigationEntry IOSLiveTab::GetEntryAtIndex(int index) { |
| 44 return sessions::IOSSerializedNavigationBuilder::FromNavigationItem( | 44 return sessions::IOSSerializedNavigationBuilder::FromNavigationItem( |
| 45 index, *navigation_manager()->GetItemAtIndex(index)); | 45 index, *navigation_manager()->GetItemAtIndex(index)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 sessions::SerializedNavigationEntry IOSLiveTab::GetPendingEntry() { | 48 sessions::SerializedNavigationEntry IOSLiveTab::GetPendingEntry() { |
| 49 return sessions::IOSSerializedNavigationBuilder::FromNavigationItem( | 49 return sessions::IOSSerializedNavigationBuilder::FromNavigationItem( |
| 50 GetPendingEntryIndex(), *navigation_manager()->GetPendingItem()); | 50 GetPendingEntryIndex(), *navigation_manager()->GetPendingItem()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 int IOSLiveTab::GetEntryCount() { | 53 int IOSLiveTab::GetEntryCount() { |
| 54 return navigation_manager()->GetItemCount(); | 54 return navigation_manager()->GetItemCount(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 const std::string& IOSLiveTab::GetUserAgentOverride() const { | 57 const std::string& IOSLiveTab::GetUserAgentOverride() const { |
| 58 // Dynamic user agent overrides are not supported on iOS. | 58 // Dynamic user agent overrides are not supported on iOS. |
| 59 return user_agent_override_; | 59 return user_agent_override_; |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace sessions | 62 } // namespace sessions |
| OLD | NEW |