OLD | NEW |
1 // Copyright (c) 2012 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_UI_SYNC_TAB_CONTENTS_SYNCED_TAB_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ |
6 #define CHROME_BROWSER_UI_SYNC_TAB_CONTENTS_SYNCED_TAB_DELEGATE_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/sessions/session_id.h" | |
10 #include "chrome/browser/sync/glue/synced_tab_delegate.h" | 9 #include "chrome/browser/sync/glue/synced_tab_delegate.h" |
11 #include "content/public/browser/web_contents_user_data.h" | 10 #include "content/public/browser/web_contents_user_data.h" |
12 | 11 |
13 namespace content { | 12 namespace content { |
14 class WebContents; | 13 class WebContents; |
15 } | 14 } |
16 | 15 |
17 class TabContentsSyncedTabDelegate | 16 class TabAndroid; |
18 : public browser_sync::SyncedTabDelegate, | 17 // On Android a tab can exist even without web contents. |
19 public content::WebContentsUserData<TabContentsSyncedTabDelegate> { | 18 |
| 19 // SyncedTabDelegateAndroid wraps TabContentsSyncedTabDelegate and provides |
| 20 // a method to set web contents later when tab is brought to memory. |
| 21 class SyncedTabDelegateAndroid : public browser_sync::SyncedTabDelegate { |
20 public: | 22 public: |
21 virtual ~TabContentsSyncedTabDelegate(); | 23 explicit SyncedTabDelegateAndroid(TabAndroid* owning_tab_); |
| 24 virtual ~SyncedTabDelegateAndroid(); |
22 | 25 |
23 // Methods from SyncedTabDelegate. | 26 // Methods from SyncedTabDelegate. |
24 virtual SessionID::id_type GetWindowId() const OVERRIDE; | 27 virtual SessionID::id_type GetWindowId() const OVERRIDE; |
25 virtual SessionID::id_type GetSessionId() const OVERRIDE; | 28 virtual SessionID::id_type GetSessionId() const OVERRIDE; |
26 virtual bool IsBeingDestroyed() const OVERRIDE; | 29 virtual bool IsBeingDestroyed() const OVERRIDE; |
27 virtual Profile* profile() const OVERRIDE; | 30 virtual Profile* profile() const OVERRIDE; |
28 virtual std::string GetExtensionAppId() const OVERRIDE; | 31 virtual std::string GetExtensionAppId() const OVERRIDE; |
29 virtual int GetCurrentEntryIndex() const OVERRIDE; | 32 virtual int GetCurrentEntryIndex() const OVERRIDE; |
30 virtual int GetEntryCount() const OVERRIDE; | 33 virtual int GetEntryCount() const OVERRIDE; |
31 virtual int GetPendingEntryIndex() const OVERRIDE; | 34 virtual int GetPendingEntryIndex() const OVERRIDE; |
32 virtual content::NavigationEntry* GetPendingEntry() const OVERRIDE; | 35 virtual content::NavigationEntry* GetPendingEntry() const OVERRIDE; |
33 virtual content::NavigationEntry* GetEntryAtIndex(int i) const OVERRIDE; | 36 virtual content::NavigationEntry* GetEntryAtIndex(int i) const OVERRIDE; |
34 virtual content::NavigationEntry* GetActiveEntry() const OVERRIDE; | 37 virtual content::NavigationEntry* GetActiveEntry() const OVERRIDE; |
| 38 virtual bool IsPinned() const OVERRIDE; |
| 39 virtual bool HasWebContents() const OVERRIDE; |
| 40 |
| 41 // Managed user related methods. |
| 42 |
35 virtual bool ProfileIsManaged() const OVERRIDE; | 43 virtual bool ProfileIsManaged() const OVERRIDE; |
36 virtual const std::vector<const content::NavigationEntry*>* | 44 virtual const std::vector<const content::NavigationEntry*>* |
37 GetBlockedNavigations() const OVERRIDE; | 45 GetBlockedNavigations() const OVERRIDE; |
38 virtual bool IsPinned() const OVERRIDE; | 46 |
| 47 // Set the web contents for this tab. Also creates |
| 48 // TabContentsSyncedTabDelegate for this tab. |
| 49 virtual void SetWebContents(content::WebContents* web_contents); |
| 50 // Set web contents to null. |
| 51 virtual void ResetWebContents(); |
39 | 52 |
40 private: | 53 private: |
41 explicit TabContentsSyncedTabDelegate(content::WebContents* web_contents); | 54 content::WebContents* web_contents_; |
42 friend class content::WebContentsUserData<TabContentsSyncedTabDelegate>; | 55 TabAndroid* tab_android_; |
43 | 56 |
44 content::WebContents* web_contents_; | 57 DISALLOW_COPY_AND_ASSIGN(SyncedTabDelegateAndroid); |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(TabContentsSyncedTabDelegate); | |
47 }; | 58 }; |
48 | 59 |
49 #endif // CHROME_BROWSER_UI_SYNC_TAB_CONTENTS_SYNCED_TAB_DELEGATE_H_ | 60 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_ |
OLD | NEW |