Chromium Code Reviews| Index: components/sessions/content/content_open_tab.h |
| diff --git a/components/sessions/content/content_open_tab.h b/components/sessions/content/content_open_tab.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d023c400266ae4abd850a5243ab20a3b9daeba7a |
| --- /dev/null |
| +++ b/components/sessions/content/content_open_tab.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_SESSIONS_CONTENT_CONTENT_OPEN_TAB_H_ |
| +#define COMPONENTS_SESSIONS_CONTENT_CONTENT_OPEN_TAB_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "components/sessions/content/content_serialized_navigation_builder.h" |
| +#include "components/sessions/core/open_tab.h" |
| +#include "components/sessions/sessions_export.h" |
| +#include "content/public/browser/navigation_controller.h" |
| +#include "content/public/browser/web_contents_user_data.h" |
| + |
| +namespace content { |
| +class NavigationEntry; |
| +class SessionStorageNamespace; |
| +} |
| + |
| +class PersistentTabRestoreServiceTest; |
| + |
| +namespace sessions { |
| + |
| +// An implementation of OpenTab that is backed by content::WebContents for use |
| +// on //content-based platforms. |
| +class SESSIONS_EXPORT ContentOpenTab |
| + : public OpenTab, |
| + public content::WebContentsUserData<ContentOpenTab> { |
| + public: |
| + ~ContentOpenTab() override; |
| + |
| + // OpenTab: |
| + int GetCurrentEntryIndex() override; |
| + int GetPendingEntryIndex() override; |
| + sessions::SerializedNavigationEntry GetEntryAtIndex(int index) override; |
| + sessions::SerializedNavigationEntry GetPendingEntry() override; |
| + int GetEntryCount() override; |
| + void LoadIfNecessary() override; |
| + const std::string& GetUserAgentOverride() const override; |
| + |
| + content::WebContents* web_contents() { return web_contents_; } |
| + const content::WebContents* web_contents() const { return web_contents_; } |
| + |
| + private: |
| + explicit ContentOpenTab(content::WebContents* contents); |
| + friend class content::WebContentsUserData<ContentOpenTab>; |
|
sky
2015/09/16 20:04:53
nit: generally friend decls are before functions (
blundell
2015/09/17 11:52:25
Done.
|
| + friend class ::PersistentTabRestoreServiceTest; |
| + |
| + content::NavigationController& navigation_controller() { |
| + return web_contents_->GetController(); |
| + } |
| + |
| + content::WebContents* web_contents_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ContentOpenTab); |
| +}; |
| + |
| +} // namespace sessions |
| + |
| +#endif // COMPONENTS_SESSIONS_CONTENT_CONTENT_OPEN_TAB_H_ |