blob: 715f5b6096c9f106dfa6d2b1cd29f0b74e4a9522 [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"
avi655876a2015-12-25 07:18:1512#include "base/macros.h"
blundellbde024d2015-09-30 13:47:0713#include "components/sessions/core/live_tab_context.h"
chrishab1ba090f2017-08-18 22:00:5014#include "ui/base/ui_base_types.h"
[email protected]fb7da4132011-03-15 15:51:0015
16class Browser;
blundell7bf49a3d2015-09-14 18:38:1117class Profile;
[email protected]fb7da4132011-03-15 15:51:0018
blundell80c5b2a02015-09-17 18:22:1219namespace content {
20class WebContents;
21}
22
chrishab1ba090f2017-08-18 22:00:5023namespace gfx {
24class Rect;
25}
26
blundellbde024d2015-09-30 13:47:0727// Implementation of LiveTabContext which uses an instance of
[email protected]fb7da4132011-03-15 15:51:0028// Browser in order to fulfil its duties.
blundellbde024d2015-09-30 13:47:0729class BrowserLiveTabContext : public sessions::LiveTabContext {
[email protected]fb7da4132011-03-15 15:51:0030 public:
blundellbde024d2015-09-30 13:47:0731 explicit BrowserLiveTabContext(Browser* browser) : browser_(browser) {}
32 ~BrowserLiveTabContext() override {}
[email protected]fb7da4132011-03-15 15:51:0033
blundellbde024d2015-09-30 13:47:0734 // Overridden from LiveTabContext:
dcheng5dd5ff62014-10-21 12:42:3835 void ShowBrowserWindow() override;
36 const SessionID& GetSessionID() const override;
37 int GetTabCount() const override;
38 int GetSelectedIndex() const override;
39 std::string GetAppName() const override;
blundell80c5b2a02015-09-17 18:22:1240 sessions::LiveTab* GetLiveTabAt(int index) const override;
41 sessions::LiveTab* GetActiveLiveTab() const override;
dcheng5dd5ff62014-10-21 12:42:3842 bool IsTabPinned(int index) const override;
chrishab1ba090f2017-08-18 22:00:5043 const gfx::Rect GetRestoredBounds() const override;
44 ui::WindowShowState GetRestoredState() const override;
45 std::string GetWorkspace() const override;
46
blundell80c5b2a02015-09-17 18:22:1247 sessions::LiveTab* AddRestoredTab(
[email protected]40a7e412013-04-29 18:13:0148 const std::vector<sessions::SerializedNavigationEntry>& navigations,
[email protected]fb7da4132011-03-15 15:51:0049 int tab_index,
50 int selected_navigation,
51 const std::string& extension_app_id,
52 bool select,
53 bool pin,
54 bool from_last_session,
blundell579e373e2015-09-22 07:04:4355 const sessions::PlatformSpecificTabData* storage_namespace,
mostynb205d6252014-10-04 00:49:2256 const std::string& user_agent_override) override;
blundell80c5b2a02015-09-17 18:22:1257 sessions::LiveTab* ReplaceRestoredTab(
[email protected]40a7e412013-04-29 18:13:0158 const std::vector<sessions::SerializedNavigationEntry>& navigations,
[email protected]fb7da4132011-03-15 15:51:0059 int selected_navigation,
60 bool from_last_session,
61 const std::string& extension_app_id,
blundell579e373e2015-09-22 07:04:4362 const sessions::PlatformSpecificTabData* tab_platform_data,
mostynb205d6252014-10-04 00:49:2263 const std::string& user_agent_override) override;
dcheng5dd5ff62014-10-21 12:42:3864 void CloseTab() override;
[email protected]fb7da4132011-03-15 15:51:0065
blundell7bf49a3d2015-09-14 18:38:1166 // see Browser::Create
chrishab1ba090f2017-08-18 22:00:5067 static sessions::LiveTabContext* Create(Profile* profile,
68 const std::string& app_name,
69 const gfx::Rect& bounds,
70 ui::WindowShowState show_state,
71 const std::string& workspace);
blundell7bf49a3d2015-09-14 18:38:1172
73 // see browser::FindBrowserForWebContents
blundellbde024d2015-09-30 13:47:0774 static sessions::LiveTabContext* FindContextForWebContents(
blundell7bf49a3d2015-09-14 18:38:1175 const content::WebContents* contents);
76
77 // see chrome::FindBrowserWithID
blundellbde024d2015-09-30 13:47:0778 // Returns the LiveTabContext of the Browser with |desired_id| if
scottmgd161e6c2016-02-17 02:08:0179 // such a Browser exists.
blundellbde024d2015-09-30 13:47:0780 static sessions::LiveTabContext* FindContextWithID(
scottmgd161e6c2016-02-17 02:08:0181 SessionID::id_type desired_id);
blundell7bf49a3d2015-09-14 18:38:1182
[email protected]fb7da4132011-03-15 15:51:0083 private:
84 Browser* browser_;
85
blundellbde024d2015-09-30 13:47:0786 DISALLOW_COPY_AND_ASSIGN(BrowserLiveTabContext);
[email protected]fb7da4132011-03-15 15:51:0087};
88
blundellbde024d2015-09-30 13:47:0789#endif // CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_