Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / browser_tab_restore_service_delegate.h
blobe0dd2d5682d771ba7bc63efd05e9d96b2dcfb5db
1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_
6 #define CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/ui/host_desktop.h"
13 #include "components/sessions/core/tab_restore_service_delegate.h"
15 class Browser;
16 class Profile;
18 namespace content {
19 class WebContents;
22 // Implementation of TabRestoreServiceDelegate which uses an instance of
23 // Browser in order to fulfil its duties.
24 class BrowserTabRestoreServiceDelegate
25 : public sessions::TabRestoreServiceDelegate {
26 public:
27 explicit BrowserTabRestoreServiceDelegate(Browser* browser)
28 : browser_(browser) {}
29 ~BrowserTabRestoreServiceDelegate() override {}
31 // Overridden from TabRestoreServiceDelegate:
32 void ShowBrowserWindow() override;
33 const SessionID& GetSessionID() const override;
34 int GetTabCount() const override;
35 int GetSelectedIndex() const override;
36 std::string GetAppName() const override;
37 sessions::LiveTab* GetLiveTabAt(int index) const override;
38 sessions::LiveTab* GetActiveLiveTab() const override;
39 bool IsTabPinned(int index) const override;
40 sessions::LiveTab* AddRestoredTab(
41 const std::vector<sessions::SerializedNavigationEntry>& navigations,
42 int tab_index,
43 int selected_navigation,
44 const std::string& extension_app_id,
45 bool select,
46 bool pin,
47 bool from_last_session,
48 const sessions::PlatformSpecificTabData* storage_namespace,
49 const std::string& user_agent_override) override;
50 sessions::LiveTab* ReplaceRestoredTab(
51 const std::vector<sessions::SerializedNavigationEntry>& navigations,
52 int selected_navigation,
53 bool from_last_session,
54 const std::string& extension_app_id,
55 const sessions::PlatformSpecificTabData* tab_platform_data,
56 const std::string& user_agent_override) override;
57 void CloseTab() override;
59 // see Browser::Create
60 static sessions::TabRestoreServiceDelegate* Create(
61 Profile* profile,
62 chrome::HostDesktopType host_desktop_type,
63 const std::string& app_name);
65 // see browser::FindBrowserForWebContents
66 static sessions::TabRestoreServiceDelegate* FindDelegateForWebContents(
67 const content::WebContents* contents);
69 // see chrome::FindBrowserWithID
70 // Returns the TabRestoreServiceDelegate of the Browser with |desired_id| if
71 // such a Browser exists and is on the desktop defined by |host_desktop_type|.
72 static sessions::TabRestoreServiceDelegate* FindDelegateWithID(
73 SessionID::id_type desired_id,
74 chrome::HostDesktopType host_desktop_type);
76 private:
77 Browser* browser_;
79 DISALLOW_COPY_AND_ASSIGN(BrowserTabRestoreServiceDelegate);
82 #endif // CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_