OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 5 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
11 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | 11 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "components/sessions/core/session_id.h" | 13 #include "components/sessions/core/session_id.h" |
14 | 14 |
15 // BrowserSyncedWindowDelegate implementations | 15 // BrowserSyncedWindowDelegate implementations |
skym
2016/09/14 22:29:58
Can you remove this? I don't think we put this kin
maxbogue
2016/09/15 00:43:54
Done.
| |
16 | 16 |
17 BrowserSyncedWindowDelegate::BrowserSyncedWindowDelegate(Browser* browser) | 17 BrowserSyncedWindowDelegate::BrowserSyncedWindowDelegate(Browser* browser) |
18 : browser_(browser) {} | 18 : browser_(browser) {} |
19 | 19 |
20 BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {} | 20 BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {} |
21 | 21 |
22 bool BrowserSyncedWindowDelegate::IsTabPinned( | 22 bool BrowserSyncedWindowDelegate::IsTabPinned( |
23 const browser_sync::SyncedTabDelegate* tab) const { | 23 const sync_sessions::SyncedTabDelegate* tab) const { |
24 for (int i = 0; i < browser_->tab_strip_model()->count(); i++) { | 24 for (int i = 0; i < browser_->tab_strip_model()->count(); i++) { |
25 browser_sync::SyncedTabDelegate* current = GetTabAt(i); | 25 sync_sessions::SyncedTabDelegate* current = GetTabAt(i); |
26 if (tab == current) | 26 if (tab == current) |
27 return browser_->tab_strip_model()->IsTabPinned(i); | 27 return browser_->tab_strip_model()->IsTabPinned(i); |
28 } | 28 } |
29 // The window and tab are not always updated atomically, so it's possible | 29 // The window and tab are not always updated atomically, so it's possible |
30 // one of the values was stale. We'll retry later, just ignore for now. | 30 // one of the values was stale. We'll retry later, just ignore for now. |
31 return false; | 31 return false; |
32 } | 32 } |
33 | 33 |
34 browser_sync::SyncedTabDelegate* BrowserSyncedWindowDelegate::GetTabAt( | 34 sync_sessions::SyncedTabDelegate* BrowserSyncedWindowDelegate::GetTabAt( |
35 int index) const { | 35 int index) const { |
36 return TabContentsSyncedTabDelegate::FromWebContents( | 36 return TabContentsSyncedTabDelegate::FromWebContents( |
37 browser_->tab_strip_model()->GetWebContentsAt(index)); | 37 browser_->tab_strip_model()->GetWebContentsAt(index)); |
38 } | 38 } |
39 | 39 |
40 SessionID::id_type BrowserSyncedWindowDelegate::GetTabIdAt(int index) const { | 40 SessionID::id_type BrowserSyncedWindowDelegate::GetTabIdAt(int index) const { |
41 return GetTabAt(index)->GetSessionId(); | 41 return GetTabAt(index)->GetSessionId(); |
42 } | 42 } |
43 | 43 |
44 bool BrowserSyncedWindowDelegate::HasWindow() const { | 44 bool BrowserSyncedWindowDelegate::HasWindow() const { |
(...skipping 26 matching lines...) Expand all Loading... | |
71 | 71 |
72 bool BrowserSyncedWindowDelegate::IsSessionRestoreInProgress() const { | 72 bool BrowserSyncedWindowDelegate::IsSessionRestoreInProgress() const { |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 bool BrowserSyncedWindowDelegate::ShouldSync() const { | 76 bool BrowserSyncedWindowDelegate::ShouldSync() const { |
77 if (IsApp()) | 77 if (IsApp()) |
78 return false; | 78 return false; |
79 return IsTypeTabbed() || IsTypePopup(); | 79 return IsTypeTabbed() || IsTypePopup(); |
80 } | 80 } |
OLD | NEW |