OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ios/chrome/browser/tabs/tab_model_synced_window_delegate.h" |
| 6 |
| 7 #include <set> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 11 #include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" |
| 12 #include "ios/chrome/browser/tabs/tab.h" |
| 13 #include "ios/chrome/browser/tabs/tab_model.h" |
| 14 #import "ios/chrome/browser/ui/browser_list_ios.h" |
| 15 #import "ios/web/public/web_state/web_state.h" |
| 16 |
| 17 TabModelSyncedWindowDelegate::TabModelSyncedWindowDelegate(TabModel* tab_model) |
| 18 : tab_model_(tab_model) {} |
| 19 |
| 20 TabModelSyncedWindowDelegate::~TabModelSyncedWindowDelegate() {} |
| 21 |
| 22 bool TabModelSyncedWindowDelegate::IsTabPinned( |
| 23 const sync_sessions::SyncedTabDelegate* tab) const { |
| 24 return false; |
| 25 } |
| 26 |
| 27 sync_sessions::SyncedTabDelegate* TabModelSyncedWindowDelegate::GetTabAt( |
| 28 int index) const { |
| 29 sync_sessions::SyncedTabDelegate* delegate = |
| 30 IOSChromeSyncedTabDelegate::FromWebState( |
| 31 [tab_model_ tabAtIndex:index].webState); |
| 32 if (!delegate) { |
| 33 return nullptr; |
| 34 } |
| 35 return delegate; |
| 36 } |
| 37 |
| 38 SessionID::id_type TabModelSyncedWindowDelegate::GetTabIdAt(int index) const { |
| 39 return GetTabAt(index)->GetSessionId(); |
| 40 } |
| 41 |
| 42 bool TabModelSyncedWindowDelegate::IsSessionRestoreInProgress() const { |
| 43 return false; |
| 44 } |
| 45 |
| 46 bool TabModelSyncedWindowDelegate::HasWindow() const { |
| 47 return true; |
| 48 } |
| 49 |
| 50 SessionID::id_type TabModelSyncedWindowDelegate::GetSessionId() const { |
| 51 return tab_model_.sessionID.id(); |
| 52 } |
| 53 |
| 54 int TabModelSyncedWindowDelegate::GetTabCount() const { |
| 55 return [tab_model_ count]; |
| 56 } |
| 57 |
| 58 int TabModelSyncedWindowDelegate::GetActiveIndex() const { |
| 59 Tab* current_tab = [tab_model_ currentTab]; |
| 60 DCHECK(current_tab); |
| 61 return [tab_model_ indexOfTab:current_tab]; |
| 62 } |
| 63 |
| 64 bool TabModelSyncedWindowDelegate::IsApp() const { |
| 65 return false; |
| 66 } |
| 67 |
| 68 bool TabModelSyncedWindowDelegate::IsTypeTabbed() const { |
| 69 return true; |
| 70 } |
| 71 |
| 72 bool TabModelSyncedWindowDelegate::IsTypePopup() const { |
| 73 return false; |
| 74 } |
| 75 |
| 76 bool TabModelSyncedWindowDelegate::ShouldSync() const { |
| 77 return true; |
| 78 } |
OLD | NEW |