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.
5 #ifndef COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_
6 #define COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_
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"
16 class NavigationController
;
17 class NavigationEntry
;
18 class SessionStorageNamespace
;
21 class PersistentTabRestoreServiceTest
;
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
31 public base::SupportsUserData::Data
{
33 ~ContentLiveTab() override
;
35 static void CreateForWebContents(content::WebContents
* web_contents
);
36 static ContentLiveTab
* FromWebContents(content::WebContents
* web_contents
);
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
;
47 content::WebContents
* web_contents() { return web_contents_
; }
48 const content::WebContents
* web_contents() const { return web_contents_
; }
51 friend class base::SupportsUserData
;
52 friend class ::PersistentTabRestoreServiceTest
;
54 explicit ContentLiveTab(content::WebContents
* contents
);
56 content::NavigationController
& navigation_controller() {
57 return web_contents_
->GetController();
60 content::WebContents
* web_contents_
;
62 DISALLOW_COPY_AND_ASSIGN(ContentLiveTab
);
65 } // namespace sessions
67 #endif // COMPONENTS_SESSIONS_CONTENT_CONTENT_LIVE_TAB_H_