Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync / glue / synced_window_delegate.h
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.
4
5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_WINDOW_DELEGATE_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_WINDOW_DELEGATE_H_
7
8 #include <set>
9
10 #include "components/sessions/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 WindowList
21
22   // This method is to be used instead of using the BrowserList iterator.
23   static const std::set<SyncedWindowDelegate*> GetSyncedWindowDelegates();
24
25   // This method is to be used instead of using BrowserList::FindBrowserWithId()
26   static const SyncedWindowDelegate* FindSyncedWindowDelegateWithId(
27       SessionID::id_type id);
28
29   // Methods originating from Browser.
30
31   // Returns true iff this browser has a visible window representation
32   // associated with it. Sometimes, if a window is being created/removed the
33   // model object may exist without its UI counterpart.
34   virtual bool HasWindow() const = 0;
35
36   // see Browser::session_id
37   virtual SessionID::id_type GetSessionId() const = 0;
38
39   // see Browser::tab_count
40   virtual int GetTabCount() const = 0;
41
42   // see Browser::active_index
43   virtual int GetActiveIndex() const = 0;
44
45   // see Browser::is_app
46   virtual bool IsApp() const = 0;
47
48   // see Browser::is_type_tabbed
49   virtual bool IsTypeTabbed() const = 0;
50
51   // see Browser::is_type_popup
52   virtual bool IsTypePopup() const = 0;
53
54   // Methods derivated from Browser
55
56   // Returns true iff the provided tab is currently "pinned" in the tab strip.
57   virtual bool IsTabPinned(const SyncedTabDelegate* tab) const = 0;
58
59   // see TabStripModel::GetWebContentsAt
60   virtual SyncedTabDelegate* GetTabAt(int index) const = 0;
61
62   // Return the tab id for the tab at |index|.
63   virtual SessionID::id_type GetTabIdAt(int index) const = 0;
64
65   // Return true if we are currently restoring sessions asynchronously.
66   virtual bool IsSessionRestoreInProgress() const = 0;
67
68  protected:
69   virtual ~SyncedWindowDelegate() {}
70 };
71
72 }  // namespace browser_sync
73
74 #endif  // CHROME_BROWSER_SYNC_GLUE_SYNCED_WINDOW_DELEGATE_H_