Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / sync / glue / synced_tab_delegate.h
blob0645e4eb949b532d44321ff70b5bbee64fd29ab8
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_TAB_DELEGATE_H__
6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__
8 #include <string>
9 #include <vector>
11 #include "components/sessions/session_id.h"
13 class Profile;
15 namespace content {
16 class NavigationEntry;
17 class WebContents;
20 namespace browser_sync {
21 class SyncedWindowDelegate;
23 // A SyncedTabDelegate is used to insulate the sync code from depending
24 // directly on WebContents, NavigationController, and the extensions TabHelper.
25 class SyncedTabDelegate {
26 public:
27 virtual ~SyncedTabDelegate() {}
29 // Methods from TabContents.
31 virtual SessionID::id_type GetWindowId() const = 0;
32 virtual SessionID::id_type GetSessionId() const = 0;
33 virtual bool IsBeingDestroyed() const = 0;
34 virtual Profile* profile() const = 0;
36 // Method derived from extensions TabHelper.
38 virtual std::string GetExtensionAppId() const = 0;
40 // Methods from NavigationController.
42 virtual int GetCurrentEntryIndex() const = 0;
43 virtual int GetEntryCount() const = 0;
44 virtual int GetPendingEntryIndex() const = 0;
45 virtual content::NavigationEntry* GetPendingEntry() const = 0;
46 virtual content::NavigationEntry* GetEntryAtIndex(int i) const = 0;
47 virtual content::NavigationEntry* GetActiveEntry() const = 0;
49 // The idea here is that GetEntryAtIndex may not always return the pending
50 // entry when asked for the entry at the pending index. These convinience
51 // methods will check for this case and then call the correct entry accessor.
52 content::NavigationEntry* GetCurrentEntryMaybePending() const;
53 content::NavigationEntry* GetEntryAtIndexMaybePending(int i) const;
55 // Supervised user related methods.
57 virtual bool ProfileIsSupervised() const = 0;
58 virtual const std::vector<const content::NavigationEntry*>*
59 GetBlockedNavigations() const = 0;
61 virtual bool IsPinned() const = 0;
62 virtual bool HasWebContents() const = 0;
63 virtual content::WebContents* GetWebContents() const = 0;
65 // Session sync related methods.
66 virtual int GetSyncId() const = 0;
67 virtual void SetSyncId(int sync_id) = 0;
69 // Returns true if this tab should be synchronized.
70 bool ShouldSync() const;
72 // Returns the SyncedTabDelegate associated with WebContents.
73 static SyncedTabDelegate* ImplFromWebContents(
74 content::WebContents* web_contents);
76 protected:
77 // Overridden by the tests to avoid interaction with static state.
78 virtual const SyncedWindowDelegate* GetSyncedWindowDelegate() const;
81 } // namespace browser_sync
83 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__