1 // Copyright 2013 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_ANDROID_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/sync/glue/synced_tab_delegate.h"
10 #include "content/public/browser/web_contents_user_data.h"
17 namespace browser_sync
{
18 // On Android a tab can exist even without web contents.
20 // SyncedTabDelegateAndroid wraps TabContentsSyncedTabDelegate and provides
21 // a method to set web contents later when tab is brought to memory.
22 class SyncedTabDelegateAndroid
: public browser_sync::SyncedTabDelegate
{
24 explicit SyncedTabDelegateAndroid(TabAndroid
* owning_tab_
);
25 ~SyncedTabDelegateAndroid() override
;
27 // Methods from SyncedTabDelegate.
28 SessionID::id_type
GetWindowId() const override
;
29 SessionID::id_type
GetSessionId() const override
;
30 bool IsBeingDestroyed() const override
;
31 Profile
* profile() const override
;
32 std::string
GetExtensionAppId() const override
;
33 int GetCurrentEntryIndex() const override
;
34 int GetEntryCount() const override
;
35 int GetPendingEntryIndex() const override
;
36 content::NavigationEntry
* GetPendingEntry() const override
;
37 content::NavigationEntry
* GetEntryAtIndex(int i
) const override
;
38 content::NavigationEntry
* GetActiveEntry() const override
;
39 bool IsPinned() const override
;
40 bool HasWebContents() const override
;
41 content::WebContents
* GetWebContents() const override
;
42 int GetSyncId() const override
;
43 void SetSyncId(int sync_id
) override
;
45 // Supervised user related methods.
47 bool ProfileIsSupervised() const override
;
48 const std::vector
<const content::NavigationEntry
*>* GetBlockedNavigations()
51 // Set the web contents for this tab. Also creates
52 // TabContentsSyncedTabDelegate for this tab.
53 virtual void SetWebContents(content::WebContents
* web_contents
);
54 // Set web contents to null.
55 virtual void ResetWebContents();
58 content::WebContents
* web_contents_
;
59 TabAndroid
* tab_android_
;
61 DISALLOW_COPY_AND_ASSIGN(SyncedTabDelegateAndroid
);
63 } // namespace browser_sync
65 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_