Home | History | Annotate | Download | only in glue
      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.
      4 
      5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_
      6 #define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_
      7 
      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"
     11 
     12 namespace content {
     13 class WebContents;
     14 }
     15 
     16 class TabAndroid;
     17 namespace browser_sync {
     18 // On Android a tab can exist even without web contents.
     19 
     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 {
     23  public:
     24   explicit SyncedTabDelegateAndroid(TabAndroid* owning_tab_);
     25   virtual ~SyncedTabDelegateAndroid();
     26 
     27   // Methods from SyncedTabDelegate.
     28   virtual SessionID::id_type GetWindowId() const OVERRIDE;
     29   virtual SessionID::id_type GetSessionId() const OVERRIDE;
     30   virtual bool IsBeingDestroyed() const OVERRIDE;
     31   virtual Profile* profile() const OVERRIDE;
     32   virtual std::string GetExtensionAppId() const OVERRIDE;
     33   virtual int GetCurrentEntryIndex() const OVERRIDE;
     34   virtual int GetEntryCount() const OVERRIDE;
     35   virtual int GetPendingEntryIndex() const OVERRIDE;
     36   virtual content::NavigationEntry* GetPendingEntry() const OVERRIDE;
     37   virtual content::NavigationEntry* GetEntryAtIndex(int i) const OVERRIDE;
     38   virtual content::NavigationEntry* GetActiveEntry() const OVERRIDE;
     39   virtual bool IsPinned() const OVERRIDE;
     40   virtual bool HasWebContents() const OVERRIDE;
     41   virtual int GetSyncId() const OVERRIDE;
     42   virtual void SetSyncId(int sync_id) OVERRIDE;
     43 
     44   // Managed user related methods.
     45 
     46   virtual bool ProfileIsManaged() const OVERRIDE;
     47   virtual const std::vector<const content::NavigationEntry*>*
     48       GetBlockedNavigations() const OVERRIDE;
     49 
     50   // Set the web contents for this tab. Also creates
     51   // TabContentsSyncedTabDelegate for this tab.
     52   virtual void SetWebContents(content::WebContents* web_contents);
     53   // Set web contents to null.
     54   virtual void ResetWebContents();
     55 
     56  private:
     57   content::WebContents* web_contents_;
     58   TabAndroid* tab_android_;
     59 
     60   DISALLOW_COPY_AND_ASSIGN(SyncedTabDelegateAndroid);
     61 };
     62 }  // namespace browser_sync
     63 
     64 #endif  // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_ANDROID_H_
     65