• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_
6 #define CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_
7 
8 #include <string>
9 #include <vector>
10 
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/sessions/tab_restore_service_delegate.h"
13 
14 class Browser;
15 class Profile;
16 class SessionStorageNamespace;
17 class TabContents;
18 class TabNavigation;
19 
20 // Implementation of TabRestoreServiceDelegate which uses an instance of
21 // Browser in order to fulfil its duties.
22 class BrowserTabRestoreServiceDelegate : public TabRestoreServiceDelegate {
23  public:
BrowserTabRestoreServiceDelegate(Browser * browser)24   explicit BrowserTabRestoreServiceDelegate(Browser* browser)
25       : browser_(browser) {}
~BrowserTabRestoreServiceDelegate()26   virtual ~BrowserTabRestoreServiceDelegate() {}
27 
28   // Overridden from TabRestoreServiceDelegate:
29   virtual void ShowBrowserWindow() OVERRIDE;
30   virtual const SessionID& GetSessionID() const OVERRIDE;
31   virtual int GetTabCount() const OVERRIDE;
32   virtual int GetSelectedIndex() const OVERRIDE;
33   virtual TabContents* GetTabContentsAt(int index) const OVERRIDE;
34   virtual TabContents* GetSelectedTabContents() const OVERRIDE;
35   virtual bool IsTabPinned(int index) const OVERRIDE;
36   virtual TabContents* AddRestoredTab(
37       const std::vector<TabNavigation>& navigations,
38       int tab_index,
39       int selected_navigation,
40       const std::string& extension_app_id,
41       bool select,
42       bool pin,
43       bool from_last_session,
44       SessionStorageNamespace* storage_namespace) OVERRIDE;
45   virtual void ReplaceRestoredTab(
46       const std::vector<TabNavigation>& navigations,
47       int selected_navigation,
48       bool from_last_session,
49       const std::string& extension_app_id,
50       SessionStorageNamespace* session_storage_namespace) OVERRIDE;
51   virtual void CloseTab() OVERRIDE;
52 
53  private:
54   Browser* browser_;
55 
56   DISALLOW_COPY_AND_ASSIGN(BrowserTabRestoreServiceDelegate);
57 };
58 
59 #endif  // CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_
60