| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/sync/glue/synced_tab_delegate.h" | 11 #include "components/sync_sessions/synced_tab_delegate.h" |
| 10 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 class WebContents; | 15 class WebContents; |
| 14 } | 16 } |
| 15 | 17 |
| 16 class TabAndroid; | 18 class TabAndroid; |
| 17 class TabContentsSyncedTabDelegate; | 19 class TabContentsSyncedTabDelegate; |
| 18 | 20 |
| 19 namespace browser_sync { | 21 namespace browser_sync { |
| 20 // On Android a tab can exist even without web contents. | 22 // On Android a tab can exist even without web contents. |
| 21 | 23 |
| 22 // SyncedTabDelegateAndroid wraps TabContentsSyncedTabDelegate and provides | 24 // SyncedTabDelegateAndroid wraps TabContentsSyncedTabDelegate and provides |
| 23 // a method to set web contents later when tab is brought to memory. | 25 // a method to set web contents later when tab is brought to memory. |
| 24 class SyncedTabDelegateAndroid : public browser_sync::SyncedTabDelegate { | 26 class SyncedTabDelegateAndroid : public browser_sync::SyncedTabDelegate { |
| 25 public: | 27 public: |
| 26 explicit SyncedTabDelegateAndroid(TabAndroid* owning_tab_); | 28 explicit SyncedTabDelegateAndroid(TabAndroid* owning_tab_); |
| 27 ~SyncedTabDelegateAndroid() override; | 29 ~SyncedTabDelegateAndroid() override; |
| 28 | 30 |
| 29 // Methods from SyncedTabDelegate. | 31 // SyncedTabDelegate: |
| 30 SessionID::id_type GetWindowId() const override; | 32 SessionID::id_type GetWindowId() const override; |
| 31 SessionID::id_type GetSessionId() const override; | 33 SessionID::id_type GetSessionId() const override; |
| 32 bool IsBeingDestroyed() const override; | 34 bool IsBeingDestroyed() const override; |
| 33 Profile* profile() const override; | |
| 34 std::string GetExtensionAppId() const override; | 35 std::string GetExtensionAppId() const override; |
| 35 bool IsInitialBlankNavigation() const override; | 36 bool IsInitialBlankNavigation() const override; |
| 36 int GetCurrentEntryIndex() const override; | 37 int GetCurrentEntryIndex() const override; |
| 37 int GetEntryCount() const override; | 38 int GetEntryCount() const override; |
| 38 int GetPendingEntryIndex() const override; | 39 GURL GetVirtualURLAtIndex(int i) const override; |
| 39 content::NavigationEntry* GetPendingEntry() const override; | 40 GURL GetFaviconURLAtIndex(int i) const override; |
| 40 content::NavigationEntry* GetEntryAtIndex(int i) const override; | 41 ui::PageTransition GetTransitionAtIndex(int i) const override; |
| 41 content::NavigationEntry* GetActiveEntry() const override; | 42 void GetSerializedNavigationAtIndex( |
| 42 bool IsPinned() const override; | 43 int i, |
| 43 bool HasWebContents() const override; | 44 sessions::SerializedNavigationEntry* serialized_entry) const override; |
| 44 content::WebContents* GetWebContents() const override; | 45 bool IsPlaceholderTab() const override; |
| 45 int GetSyncId() const override; | 46 int GetSyncId() const override; |
| 46 void SetSyncId(int sync_id) override; | 47 void SetSyncId(int sync_id) override; |
| 47 | 48 bool ShouldSync(sync_sessions::SyncSessionsClient* sessions_client) override; |
| 48 // Supervised user related methods. | |
| 49 | |
| 50 bool ProfileIsSupervised() const override; | 49 bool ProfileIsSupervised() const override; |
| 51 const std::vector<const content::NavigationEntry*>* GetBlockedNavigations() | 50 const std::vector<const sessions::SerializedNavigationEntry*>* |
| 52 const override; | 51 GetBlockedNavigations() const override; |
| 53 | 52 |
| 54 // Set the web contents for this tab. Also creates | 53 // Set the web contents for this tab. Also creates |
| 55 // TabContentsSyncedTabDelegate for this tab. | 54 // TabContentsSyncedTabDelegate for this tab. |
| 56 virtual void SetWebContents(content::WebContents* web_contents); | 55 virtual void SetWebContents(content::WebContents* web_contents); |
| 57 // Set web contents to null. | 56 // Set web contents to null. |
| 58 virtual void ResetWebContents(); | 57 virtual void ResetWebContents(); |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 content::WebContents* web_contents_; | 60 content::WebContents* web_contents_; |
| 62 TabAndroid* tab_android_; | 61 TabAndroid* tab_android_; |
| 63 TabContentsSyncedTabDelegate* tab_contents_delegate_; | 62 TabContentsSyncedTabDelegate* tab_contents_delegate_; |
| 64 | 63 |
| 65 DISALLOW_COPY_AND_ASSIGN(SyncedTabDelegateAndroid); | 64 DISALLOW_COPY_AND_ASSIGN(SyncedTabDelegateAndroid); |
| 66 }; | 65 }; |
| 67 } // namespace browser_sync | 66 } // namespace browser_sync |
| 68 | 67 |
| 69 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ | 68 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ |
| OLD | NEW |