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 #ifndef CHROME_BROWSER_UI_SYNC_BROWSER_SYNCED_WINDOW_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_SYNC_BROWSER_SYNCED_WINDOW_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_SYNC_BROWSER_SYNCED_WINDOW_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_SYNC_BROWSER_SYNCED_WINDOW_DELEGATE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 9 #include "chrome/browser/sync/glue/synced_window_delegate.h" |
10 #include "components/sessions/session_id.h" | 10 #include "components/sessions/session_id.h" |
11 | 11 |
12 class Browser; | 12 class Browser; |
13 | 13 |
14 namespace browser_sync { | 14 namespace browser_sync { |
15 class SyncedTabDelegate; | 15 class SyncedTabDelegate; |
16 } | 16 } |
17 | 17 |
18 // A BrowserSyncedWindowDelegate is the Browser-based implementation of | 18 // A BrowserSyncedWindowDelegate is the Browser-based implementation of |
19 // SyncedWindowDelegate. | 19 // SyncedWindowDelegate. |
20 class BrowserSyncedWindowDelegate : public browser_sync::SyncedWindowDelegate { | 20 class BrowserSyncedWindowDelegate : public browser_sync::SyncedWindowDelegate { |
21 public: | 21 public: |
22 explicit BrowserSyncedWindowDelegate(Browser* browser); | 22 explicit BrowserSyncedWindowDelegate(Browser* browser); |
23 ~BrowserSyncedWindowDelegate() override; | 23 ~BrowserSyncedWindowDelegate() override; |
24 | 24 |
25 // Add all BrowserSyncedWindowDelegate instances to the output set. | |
26 static void GetAllHelper( | |
27 std::set<const browser_sync::SyncedWindowDelegate*>* delegates); | |
28 | |
29 // Find the SyncedWindowDelegate for a particular browser window id. Note | |
30 // that this only considers Browser windows (AppWindow are not considered). | |
31 static const browser_sync::SyncedWindowDelegate* FindByIdHelper( | |
32 SessionID::id_type id); | |
33 | |
34 // SyncedWindowDelegate: | 25 // SyncedWindowDelegate: |
35 bool HasWindow() const override; | 26 bool HasWindow() const override; |
36 SessionID::id_type GetSessionId() const override; | 27 SessionID::id_type GetSessionId() const override; |
37 int GetTabCount() const override; | 28 int GetTabCount() const override; |
38 int GetActiveIndex() const override; | 29 int GetActiveIndex() const override; |
39 bool IsApp() const override; | 30 bool IsApp() const override; |
40 bool IsTypeTabbed() const override; | 31 bool IsTypeTabbed() const override; |
41 bool IsTypePopup() const override; | 32 bool IsTypePopup() const override; |
42 bool IsTabPinned(const browser_sync::SyncedTabDelegate* tab) const override; | 33 bool IsTabPinned(const browser_sync::SyncedTabDelegate* tab) const override; |
43 browser_sync::SyncedTabDelegate* GetTabAt(int index) const override; | 34 browser_sync::SyncedTabDelegate* GetTabAt(int index) const override; |
44 SessionID::id_type GetTabIdAt(int index) const override; | 35 SessionID::id_type GetTabIdAt(int index) const override; |
45 bool IsSessionRestoreInProgress() const override; | 36 bool IsSessionRestoreInProgress() const override; |
46 bool ShouldSync() const override; | 37 bool ShouldSync() const override; |
47 | 38 |
48 private: | 39 private: |
49 Browser* browser_; | 40 Browser* browser_; |
50 | 41 |
51 DISALLOW_COPY_AND_ASSIGN(BrowserSyncedWindowDelegate); | 42 DISALLOW_COPY_AND_ASSIGN(BrowserSyncedWindowDelegate); |
52 }; | 43 }; |
53 | 44 |
54 #endif // CHROME_BROWSER_UI_SYNC_BROWSER_SYNCED_WINDOW_DELEGATE_H_ | 45 #endif // CHROME_BROWSER_UI_SYNC_BROWSER_SYNCED_WINDOW_DELEGATE_H_ |
OLD | NEW |