• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_TAB_DELEGATE_H__
6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__
7 
8 #include <string>
9 #include <vector>
10 
11 #include "components/sessions/session_id.h"
12 
13 class Profile;
14 
15 namespace content {
16 class NavigationEntry;
17 class WebContents;
18 }
19 
20 namespace browser_sync {
21 
22 // A SyncedTabDelegate is used to insulate the sync code from depending
23 // directly on WebContents, NavigationController, and the extensions TabHelper.
24 class SyncedTabDelegate {
25  public:
~SyncedTabDelegate()26   virtual ~SyncedTabDelegate() {}
27 
28   // Methods from TabContents.
29 
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;
34 
35   // Method derived from extensions TabHelper.
36 
37   virtual std::string GetExtensionAppId() const = 0;
38 
39   // Methods from NavigationController.
40 
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;
47 
48   // Supervised user related methods.
49 
50   virtual bool ProfileIsSupervised() const = 0;
51   virtual const std::vector<const content::NavigationEntry*>*
52       GetBlockedNavigations() const = 0;
53 
54   virtual bool IsPinned() const = 0;
55   virtual bool HasWebContents() const = 0;
56   virtual content::WebContents* GetWebContents() const = 0;
57 
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);
64 };
65 
66 }  // namespace browser_sync
67 
68 #endif  // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__
69