Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / sync_driver / glue / synced_window_delegate.h
blobbbe73c3bbd4dbab3542b64dd21406d009b49eb7a
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.
5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNCED_WINDOW_DELEGATE_H_
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNCED_WINDOW_DELEGATE_H_
8 #include <set>
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 {
19 public:
20 // Methods originating from Browser.
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;
27 // see Browser::session_id
28 virtual SessionID::id_type GetSessionId() const = 0;
30 // see Browser::tab_count
31 virtual int GetTabCount() const = 0;
33 // see Browser::active_index
34 virtual int GetActiveIndex() const = 0;
36 // see Browser::is_app
37 virtual bool IsApp() const = 0;
39 // see Browser::is_type_tabbed
40 virtual bool IsTypeTabbed() const = 0;
42 // see Browser::is_type_popup
43 virtual bool IsTypePopup() const = 0;
45 // Methods derivated from Browser
47 // Returns true iff the provided tab is currently "pinned" in the tab strip.
48 virtual bool IsTabPinned(const SyncedTabDelegate* tab) const = 0;
50 // see TabStripModel::GetWebContentsAt
51 virtual SyncedTabDelegate* GetTabAt(int index) const = 0;
53 // Return the tab id for the tab at |index|.
54 virtual SessionID::id_type GetTabIdAt(int index) const = 0;
56 // Return true if we are currently restoring sessions asynchronously.
57 virtual bool IsSessionRestoreInProgress() const = 0;
59 // Helper methods.
61 // Return true if this window should be considered for syncing.
62 virtual bool ShouldSync() const = 0;
64 protected:
65 virtual ~SyncedWindowDelegate() {}
68 } // namespace browser_sync
70 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNCED_WINDOW_DELEGATE_H_