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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_WINDOW_DELEGATE_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_WINDOW_DELEGATE_H_
10 #include "components/sessions/session_id.h"
12 namespace browser_sync
{
14 class SyncedTabDelegate
;
16 // A SyncedWindowDelegate is used to insulate the sync code from depending
17 // directly on Browser and BrowserList.
18 class SyncedWindowDelegate
{
20 // Methods originating from WindowList
22 // Returns all SyncedWindowDelegate instances.
23 static std::set
<const SyncedWindowDelegate
*> GetAll();
25 // Find a SyncedWindowDelegate given its window's id.
26 static const SyncedWindowDelegate
* FindById(SessionID::id_type id
);
28 // Methods originating from Browser.
30 // Returns true iff this browser has a visible window representation
31 // associated with it. Sometimes, if a window is being created/removed the
32 // model object may exist without its UI counterpart.
33 virtual bool HasWindow() const = 0;
35 // see Browser::session_id
36 virtual SessionID::id_type
GetSessionId() const = 0;
38 // see Browser::tab_count
39 virtual int GetTabCount() const = 0;
41 // see Browser::active_index
42 virtual int GetActiveIndex() const = 0;
44 // see Browser::is_app
45 virtual bool IsApp() const = 0;
47 // see Browser::is_type_tabbed
48 virtual bool IsTypeTabbed() const = 0;
50 // see Browser::is_type_popup
51 virtual bool IsTypePopup() const = 0;
53 // Methods derivated from Browser
55 // Returns true iff the provided tab is currently "pinned" in the tab strip.
56 virtual bool IsTabPinned(const SyncedTabDelegate
* tab
) const = 0;
58 // see TabStripModel::GetWebContentsAt
59 virtual SyncedTabDelegate
* GetTabAt(int index
) const = 0;
61 // Return the tab id for the tab at |index|.
62 virtual SessionID::id_type
GetTabIdAt(int index
) const = 0;
64 // Return true if we are currently restoring sessions asynchronously.
65 virtual bool IsSessionRestoreInProgress() const = 0;
69 // Return true if this window should be considered for syncing.
70 virtual bool ShouldSync() const = 0;
73 virtual ~SyncedWindowDelegate() {}
76 } // namespace browser_sync
78 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_WINDOW_DELEGATE_H_