blob: 6b34776023e8150ff2b8baf2b517e60ae1a87672 [file] [log] [blame]
[email protected]a636d8e52012-02-28 15:40:411// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]fb7da4132011-03-15 15:51:002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
blundellbde024d2015-09-30 13:47:075#ifndef CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_
6#define CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_
[email protected]fb7da4132011-03-15 15:51:007
8#include <string>
9#include <vector>
10
11#include "base/compiler_specific.h"
blundell7bf49a3d2015-09-14 18:38:1112#include "chrome/browser/ui/host_desktop.h"
blundellbde024d2015-09-30 13:47:0713#include "components/sessions/core/live_tab_context.h"
[email protected]fb7da4132011-03-15 15:51:0014
15class Browser;
blundell7bf49a3d2015-09-14 18:38:1116class Profile;
[email protected]fb7da4132011-03-15 15:51:0017
blundell80c5b2a02015-09-17 18:22:1218namespace content {
19class WebContents;
20}
21
blundellbde024d2015-09-30 13:47:0722// Implementation of LiveTabContext which uses an instance of
[email protected]fb7da4132011-03-15 15:51:0023// Browser in order to fulfil its duties.
blundellbde024d2015-09-30 13:47:0724class BrowserLiveTabContext : public sessions::LiveTabContext {
[email protected]fb7da4132011-03-15 15:51:0025 public:
blundellbde024d2015-09-30 13:47:0726 explicit BrowserLiveTabContext(Browser* browser) : browser_(browser) {}
27 ~BrowserLiveTabContext() override {}
[email protected]fb7da4132011-03-15 15:51:0028
blundellbde024d2015-09-30 13:47:0729 // Overridden from LiveTabContext:
dcheng5dd5ff62014-10-21 12:42:3830 void ShowBrowserWindow() override;
31 const SessionID& GetSessionID() const override;
32 int GetTabCount() const override;
33 int GetSelectedIndex() const override;
34 std::string GetAppName() const override;
blundell80c5b2a02015-09-17 18:22:1235 sessions::LiveTab* GetLiveTabAt(int index) const override;
36 sessions::LiveTab* GetActiveLiveTab() const override;
dcheng5dd5ff62014-10-21 12:42:3837 bool IsTabPinned(int index) const override;
blundell80c5b2a02015-09-17 18:22:1238 sessions::LiveTab* AddRestoredTab(
[email protected]40a7e412013-04-29 18:13:0139 const std::vector<sessions::SerializedNavigationEntry>& navigations,
[email protected]fb7da4132011-03-15 15:51:0040 int tab_index,
41 int selected_navigation,
42 const std::string& extension_app_id,
43 bool select,
44 bool pin,
45 bool from_last_session,
blundell579e373e2015-09-22 07:04:4346 const sessions::PlatformSpecificTabData* storage_namespace,
mostynb205d6252014-10-04 00:49:2247 const std::string& user_agent_override) override;
blundell80c5b2a02015-09-17 18:22:1248 sessions::LiveTab* ReplaceRestoredTab(
[email protected]40a7e412013-04-29 18:13:0149 const std::vector<sessions::SerializedNavigationEntry>& navigations,
[email protected]fb7da4132011-03-15 15:51:0050 int selected_navigation,
51 bool from_last_session,
52 const std::string& extension_app_id,
blundell579e373e2015-09-22 07:04:4353 const sessions::PlatformSpecificTabData* tab_platform_data,
mostynb205d6252014-10-04 00:49:2254 const std::string& user_agent_override) override;
dcheng5dd5ff62014-10-21 12:42:3855 void CloseTab() override;
[email protected]fb7da4132011-03-15 15:51:0056
blundell7bf49a3d2015-09-14 18:38:1157 // see Browser::Create
blundellbde024d2015-09-30 13:47:0758 static sessions::LiveTabContext* Create(
blundell7bf49a3d2015-09-14 18:38:1159 Profile* profile,
60 chrome::HostDesktopType host_desktop_type,
61 const std::string& app_name);
62
63 // see browser::FindBrowserForWebContents
blundellbde024d2015-09-30 13:47:0764 static sessions::LiveTabContext* FindContextForWebContents(
blundell7bf49a3d2015-09-14 18:38:1165 const content::WebContents* contents);
66
67 // see chrome::FindBrowserWithID
blundellbde024d2015-09-30 13:47:0768 // Returns the LiveTabContext of the Browser with |desired_id| if
blundell7bf49a3d2015-09-14 18:38:1169 // such a Browser exists and is on the desktop defined by |host_desktop_type|.
blundellbde024d2015-09-30 13:47:0770 static sessions::LiveTabContext* FindContextWithID(
blundell7bf49a3d2015-09-14 18:38:1171 SessionID::id_type desired_id,
72 chrome::HostDesktopType host_desktop_type);
73
[email protected]fb7da4132011-03-15 15:51:0074 private:
75 Browser* browser_;
76
blundellbde024d2015-09-30 13:47:0777 DISALLOW_COPY_AND_ASSIGN(BrowserLiveTabContext);
[email protected]fb7da4132011-03-15 15:51:0078};
79
blundellbde024d2015-09-30 13:47:0780#endif // CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_