| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 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 COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_ |
| 6 #define COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/supports_user_data.h" |
| 10 #include "components/sessions/content/content_serialized_navigation_builder.h" |
| 11 #include "components/sessions/core/live_tab.h" |
| 12 #include "components/sessions/sessions_export.h" |
| 13 #include "content/public/browser/web_contents.h" |
| 14 |
| 15 namespace content { |
| 16 class NavigationController; |
| 17 class NavigationEntry; |
| 18 class SessionStorageNamespace; |
| 19 } |
| 20 |
| 21 class PersistentTabRestoreServiceTest; |
| 22 |
| 23 namespace sessions { |
| 24 |
| 25 // An implementation of LiveTab that is backed by content::WebContents for use |
| 26 // on //content-based platforms. |
| 27 // Implementation note: This class can't be a WebContentsUserData due to that |
| 28 // class being unusable in the component build. crbug.com/532866 |
| 29 class SESSIONS_EXPORT ContentLiveTab |
| 30 : public LiveTab, |
| 31 public base::SupportsUserData::Data { |
| 32 public: |
| 33 ~ContentLiveTab() override; |
| 34 |
| 35 static void CreateForWebContents(content::WebContents* web_contents); |
| 36 static ContentLiveTab* FromWebContents(content::WebContents* web_contents); |
| 37 |
| 38 // LiveTab: |
| 39 int GetCurrentEntryIndex() override; |
| 40 int GetPendingEntryIndex() override; |
| 41 sessions::SerializedNavigationEntry GetEntryAtIndex(int index) override; |
| 42 sessions::SerializedNavigationEntry GetPendingEntry() override; |
| 43 int GetEntryCount() override; |
| 44 void LoadIfNecessary() override; |
| 45 const std::string& GetUserAgentOverride() const override; |
| 46 |
| 47 content::WebContents* web_contents() { return web_contents_; } |
| 48 const content::WebContents* web_contents() const { return web_contents_; } |
| 49 |
| 50 private: |
| 51 friend class base::SupportsUserData; |
| 52 friend class ::PersistentTabRestoreServiceTest; |
| 53 |
| 54 explicit ContentLiveTab(content::WebContents* contents); |
| 55 |
| 56 content::NavigationController& navigation_controller() { |
| 57 return web_contents_->GetController(); |
| 58 } |
| 59 |
| 60 content::WebContents* web_contents_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(ContentLiveTab); |
| 63 }; |
| 64 |
| 65 } // namespace sessions |
| 66 |
| 67 #endif // COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_ |
| OLD | NEW |