Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: ios/chrome/browser/tabs/tab_model_synced_window_delegate.mm

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/tabs/tab_model_synced_window_delegate.mm
diff --git a/ios/chrome/browser/tabs/tab_model_synced_window_delegate.mm b/ios/chrome/browser/tabs/tab_model_synced_window_delegate.mm
new file mode 100644
index 0000000000000000000000000000000000000000..9e8701e7649ac6023c8c4b3fc3353baf5820363f
--- /dev/null
+++ b/ios/chrome/browser/tabs/tab_model_synced_window_delegate.mm
@@ -0,0 +1,78 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/tabs/tab_model_synced_window_delegate.h"
+
+#include <set>
+
+#include "base/logging.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h"
+#include "ios/chrome/browser/tabs/tab.h"
+#include "ios/chrome/browser/tabs/tab_model.h"
+#import "ios/chrome/browser/ui/browser_list_ios.h"
+#import "ios/web/public/web_state/web_state.h"
+
+TabModelSyncedWindowDelegate::TabModelSyncedWindowDelegate(TabModel* tab_model)
+ : tab_model_(tab_model) {}
+
+TabModelSyncedWindowDelegate::~TabModelSyncedWindowDelegate() {}
+
+bool TabModelSyncedWindowDelegate::IsTabPinned(
+ const sync_sessions::SyncedTabDelegate* tab) const {
+ return false;
+}
+
+sync_sessions::SyncedTabDelegate* TabModelSyncedWindowDelegate::GetTabAt(
+ int index) const {
+ sync_sessions::SyncedTabDelegate* delegate =
+ IOSChromeSyncedTabDelegate::FromWebState(
+ [tab_model_ tabAtIndex:index].webState);
+ if (!delegate) {
+ return nullptr;
+ }
+ return delegate;
+}
+
+SessionID::id_type TabModelSyncedWindowDelegate::GetTabIdAt(int index) const {
+ return GetTabAt(index)->GetSessionId();
+}
+
+bool TabModelSyncedWindowDelegate::IsSessionRestoreInProgress() const {
+ return false;
+}
+
+bool TabModelSyncedWindowDelegate::HasWindow() const {
+ return true;
+}
+
+SessionID::id_type TabModelSyncedWindowDelegate::GetSessionId() const {
+ return tab_model_.sessionID.id();
+}
+
+int TabModelSyncedWindowDelegate::GetTabCount() const {
+ return [tab_model_ count];
+}
+
+int TabModelSyncedWindowDelegate::GetActiveIndex() const {
+ Tab* current_tab = [tab_model_ currentTab];
+ DCHECK(current_tab);
+ return [tab_model_ indexOfTab:current_tab];
+}
+
+bool TabModelSyncedWindowDelegate::IsApp() const {
+ return false;
+}
+
+bool TabModelSyncedWindowDelegate::IsTypeTabbed() const {
+ return true;
+}
+
+bool TabModelSyncedWindowDelegate::IsTypePopup() const {
+ return false;
+}
+
+bool TabModelSyncedWindowDelegate::ShouldSync() const {
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698