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 class TabContentsSyncedTabDelegate
;
19 namespace browser_sync
{
20 // On Android a tab can exist even without web contents.
22 // SyncedTabDelegateAndroid wraps TabContentsSyncedTabDelegate and provides
23 // a method to set web contents later when tab is brought to memory.
24 class SyncedTabDelegateAndroid
: public browser_sync::SyncedTabDelegate
{
26 explicit SyncedTabDelegateAndroid(TabAndroid
* owning_tab_
);
27 ~SyncedTabDelegateAndroid() override
;
29 // Methods from SyncedTabDelegate.
30 SessionID::id_type
GetWindowId() const override
;
31 SessionID::id_type
GetSessionId() const override
;
32 bool IsBeingDestroyed() const override
;
33 Profile
* profile() const override
;
34 std::string
GetExtensionAppId() const override
;
35 int GetCurrentEntryIndex() const override
;
36 int GetEntryCount() const override
;
37 int GetPendingEntryIndex() const override
;
38 content::NavigationEntry
* GetPendingEntry() const override
;
39 content::NavigationEntry
* GetEntryAtIndex(int i
) const override
;
40 content::NavigationEntry
* GetActiveEntry() const override
;
41 bool IsPinned() const override
;
42 bool HasWebContents() const override
;
43 content::WebContents
* GetWebContents() const override
;
44 int GetSyncId() const override
;
45 void SetSyncId(int sync_id
) override
;
47 // Supervised user related methods.
49 bool ProfileIsSupervised() const override
;
50 const std::vector
<const content::NavigationEntry
*>* GetBlockedNavigations()
53 // Set the web contents for this tab. Also creates
54 // TabContentsSyncedTabDelegate for this tab.
55 virtual void SetWebContents(content::WebContents
* web_contents
);
56 // Set web contents to null.
57 virtual void ResetWebContents();
60 content::WebContents
* web_contents_
;
61 TabAndroid
* tab_android_
;
62 TabContentsSyncedTabDelegate
* tab_contents_delegate_
;
64 DISALLOW_COPY_AND_ASSIGN(SyncedTabDelegateAndroid
);
66 } // namespace browser_sync
68 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_