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__
11 #include "chrome/browser/sessions/session_id.h"
16 class NavigationEntry
;
20 namespace browser_sync
{
22 // A SyncedTabDelegate is used to insulate the sync code from depending
23 // directly on WebContents, NavigationController, and the extensions TabHelper.
24 class SyncedTabDelegate
{
26 virtual ~SyncedTabDelegate() {}
28 // Methods from TabContents.
30 virtual SessionID::id_type
GetWindowId() const = 0;
31 virtual SessionID::id_type
GetSessionId() const = 0;
32 virtual bool IsBeingDestroyed() const = 0;
33 virtual Profile
* profile() const = 0;
35 // Method derived from extensions TabHelper.
37 virtual std::string
GetExtensionAppId() const = 0;
39 // Methods from NavigationController.
41 virtual int GetCurrentEntryIndex() const = 0;
42 virtual int GetEntryCount() const = 0;
43 virtual int GetPendingEntryIndex() const = 0;
44 virtual content::NavigationEntry
* GetPendingEntry() const = 0;
45 virtual content::NavigationEntry
* GetEntryAtIndex(int i
) const = 0;
46 virtual content::NavigationEntry
* GetActiveEntry() const = 0;
48 // Managed user related methods.
50 virtual bool ProfileIsManaged() const = 0;
51 virtual const std::vector
<const content::NavigationEntry
*>*
52 GetBlockedNavigations() const = 0;
54 virtual bool IsPinned() const = 0;
55 virtual bool HasWebContents() const = 0;
56 virtual content::WebContents
* GetWebContents() const = 0;
58 // Session sync related methods.
59 virtual int GetSyncId() const = 0;
60 virtual void SetSyncId(int sync_id
) = 0;
61 // Returns the SyncedTabDelegate associated with WebContents.
62 static SyncedTabDelegate
* ImplFromWebContents(
63 content::WebContents
* web_contents
);
66 } // namespace browser_sync
68 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__