| 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 "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" | 5 #include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "components/sessions/ios/ios_serialized_navigation_builder.h" | 8 #include "components/sessions/ios/ios_serialized_navigation_builder.h" |
| 9 #include "components/sync_sessions/sync_sessions_client.h" | 9 #include "components/sync_sessions/sync_sessions_client.h" |
| 10 #include "components/sync_sessions/synced_window_delegate.h" | 10 #include "components/sync_sessions/synced_window_delegate.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 std::string IOSChromeSyncedTabDelegate::GetExtensionAppId() const { | 55 std::string IOSChromeSyncedTabDelegate::GetExtensionAppId() const { |
| 56 return std::string(); | 56 return std::string(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool IOSChromeSyncedTabDelegate::IsInitialBlankNavigation() const { | 59 bool IOSChromeSyncedTabDelegate::IsInitialBlankNavigation() const { |
| 60 return web_state_->GetNavigationManager()->GetItemCount() == 0; | 60 return web_state_->GetNavigationManager()->GetItemCount() == 0; |
| 61 } | 61 } |
| 62 | 62 |
| 63 int IOSChromeSyncedTabDelegate::GetCurrentEntryIndex() const { | 63 int IOSChromeSyncedTabDelegate::GetCurrentEntryIndex() const { |
| 64 return web_state_->GetNavigationManager()->GetCurrentItemIndex(); | 64 return web_state_->GetNavigationManager()->GetLastCommittedItemIndex(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 int IOSChromeSyncedTabDelegate::GetEntryCount() const { | 67 int IOSChromeSyncedTabDelegate::GetEntryCount() const { |
| 68 return web_state_->GetNavigationManager()->GetItemCount(); | 68 return web_state_->GetNavigationManager()->GetItemCount(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 GURL IOSChromeSyncedTabDelegate::GetVirtualURLAtIndex(int i) const { | 71 GURL IOSChromeSyncedTabDelegate::GetVirtualURLAtIndex(int i) const { |
| 72 NavigationItem* item = GetPossiblyPendingItemAtIndex(web_state_, i); | 72 NavigationItem* item = GetPossiblyPendingItemAtIndex(web_state_, i); |
| 73 return item ? item->GetVirtualURL() : GURL(); | 73 return item ? item->GetVirtualURL() : GURL(); |
| 74 } | 74 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 for (int i = 0; i < entry_count; ++i) { | 127 for (int i = 0; i < entry_count; ++i) { |
| 128 const GURL& virtual_url = GetVirtualURLAtIndex(i); | 128 const GURL& virtual_url = GetVirtualURLAtIndex(i); |
| 129 if (!virtual_url.is_valid()) | 129 if (!virtual_url.is_valid()) |
| 130 continue; | 130 continue; |
| 131 | 131 |
| 132 if (sessions_client->ShouldSyncURL(virtual_url)) | 132 if (sessions_client->ShouldSyncURL(virtual_url)) |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 return false; | 135 return false; |
| 136 } | 136 } |
| OLD | NEW |