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 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNCED_WINDOW_DELEGATE_H_ | |
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNCED_WINDOW_DELEGATE_H_ | |
7 | |
8 #include <set> | |
9 | |
10 #include "components/sessions/core/session_id.h" | |
11 | |
12 namespace browser_sync { | |
13 | |
14 class SyncedTabDelegate; | |
15 | |
16 // A SyncedWindowDelegate is used to insulate the sync code from depending | |
17 // directly on Browser and BrowserList. | |
18 class SyncedWindowDelegate { | |
19 public: | |
20 // Methods originating from Browser. | |
21 | |
22 // Returns true iff this browser has a visible window representation | |
23 // associated with it. Sometimes, if a window is being created/removed the | |
24 // model object may exist without its UI counterpart. | |
25 virtual bool HasWindow() const = 0; | |
26 | |
27 // see Browser::session_id | |
28 virtual SessionID::id_type GetSessionId() const = 0; | |
29 | |
30 // see Browser::tab_count | |
31 virtual int GetTabCount() const = 0; | |
32 | |
33 // see Browser::active_index | |
34 virtual int GetActiveIndex() const = 0; | |
35 | |
36 // see Browser::is_app | |
37 virtual bool IsApp() const = 0; | |
38 | |
39 // see Browser::is_type_tabbed | |
40 virtual bool IsTypeTabbed() const = 0; | |
41 | |
42 // see Browser::is_type_popup | |
43 virtual bool IsTypePopup() const = 0; | |
44 | |
45 // Methods derivated from Browser | |
46 | |
47 // Returns true iff the provided tab is currently "pinned" in the tab strip. | |
48 virtual bool IsTabPinned(const SyncedTabDelegate* tab) const = 0; | |
49 | |
50 // see TabStripModel::GetWebContentsAt | |
51 virtual SyncedTabDelegate* GetTabAt(int index) const = 0; | |
52 | |
53 // Return the tab id for the tab at |index|. | |
54 virtual SessionID::id_type GetTabIdAt(int index) const = 0; | |
55 | |
56 // Return true if we are currently restoring sessions asynchronously. | |
57 virtual bool IsSessionRestoreInProgress() const = 0; | |
58 | |
59 // Helper methods. | |
60 | |
61 // Return true if this window should be considered for syncing. | |
62 virtual bool ShouldSync() const = 0; | |
63 | |
64 protected: | |
65 virtual ~SyncedWindowDelegate() {} | |
66 }; | |
67 | |
68 } // namespace browser_sync | |
69 | |
70 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNCED_WINDOW_DELEGATE_H_ | |
OLD | NEW |