| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/browser/ui/host_desktop.h" | 12 #include "chrome/browser/ui/host_desktop.h" |
| 13 #include "components/sessions/core/tab_restore_service_delegate.h" | 13 #include "components/sessions/core/tab_restore_service_delegate.h" |
| 14 | 14 |
| 15 class Browser; | 15 class Browser; |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class WebContents; | 19 class WebContents; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // Implementation of TabRestoreServiceDelegate which uses an instance of | 22 // Implementation of TabRestoreServiceDelegate which uses an instance of |
| 23 // Browser in order to fulfil its duties. | 23 // Browser in order to fulfil its duties. |
| 24 class BrowserTabRestoreServiceDelegate : public TabRestoreServiceDelegate { | 24 class BrowserTabRestoreServiceDelegate |
| 25 : public sessions::TabRestoreServiceDelegate { |
| 25 public: | 26 public: |
| 26 explicit BrowserTabRestoreServiceDelegate(Browser* browser) | 27 explicit BrowserTabRestoreServiceDelegate(Browser* browser) |
| 27 : browser_(browser) {} | 28 : browser_(browser) {} |
| 28 ~BrowserTabRestoreServiceDelegate() override {} | 29 ~BrowserTabRestoreServiceDelegate() override {} |
| 29 | 30 |
| 30 // Overridden from TabRestoreServiceDelegate: | 31 // Overridden from TabRestoreServiceDelegate: |
| 31 void ShowBrowserWindow() override; | 32 void ShowBrowserWindow() override; |
| 32 const SessionID& GetSessionID() const override; | 33 const SessionID& GetSessionID() const override; |
| 33 int GetTabCount() const override; | 34 int GetTabCount() const override; |
| 34 int GetSelectedIndex() const override; | 35 int GetSelectedIndex() const override; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 49 sessions::LiveTab* ReplaceRestoredTab( | 50 sessions::LiveTab* ReplaceRestoredTab( |
| 50 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 51 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 51 int selected_navigation, | 52 int selected_navigation, |
| 52 bool from_last_session, | 53 bool from_last_session, |
| 53 const std::string& extension_app_id, | 54 const std::string& extension_app_id, |
| 54 const sessions::TabClientData* tab_client_data, | 55 const sessions::TabClientData* tab_client_data, |
| 55 const std::string& user_agent_override) override; | 56 const std::string& user_agent_override) override; |
| 56 void CloseTab() override; | 57 void CloseTab() override; |
| 57 | 58 |
| 58 // see Browser::Create | 59 // see Browser::Create |
| 59 static TabRestoreServiceDelegate* Create( | 60 static sessions::TabRestoreServiceDelegate* Create( |
| 60 Profile* profile, | 61 Profile* profile, |
| 61 chrome::HostDesktopType host_desktop_type, | 62 chrome::HostDesktopType host_desktop_type, |
| 62 const std::string& app_name); | 63 const std::string& app_name); |
| 63 | 64 |
| 64 // see browser::FindBrowserForWebContents | 65 // see browser::FindBrowserForWebContents |
| 65 static TabRestoreServiceDelegate* FindDelegateForWebContents( | 66 static sessions::TabRestoreServiceDelegate* FindDelegateForWebContents( |
| 66 const content::WebContents* contents); | 67 const content::WebContents* contents); |
| 67 | 68 |
| 68 // see chrome::FindBrowserWithID | 69 // see chrome::FindBrowserWithID |
| 69 // Returns the TabRestoreServiceDelegate of the Browser with |desired_id| if | 70 // Returns the TabRestoreServiceDelegate of the Browser with |desired_id| if |
| 70 // such a Browser exists and is on the desktop defined by |host_desktop_type|. | 71 // such a Browser exists and is on the desktop defined by |host_desktop_type|. |
| 71 static TabRestoreServiceDelegate* FindDelegateWithID( | 72 static sessions::TabRestoreServiceDelegate* FindDelegateWithID( |
| 72 SessionID::id_type desired_id, | 73 SessionID::id_type desired_id, |
| 73 chrome::HostDesktopType host_desktop_type); | 74 chrome::HostDesktopType host_desktop_type); |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 Browser* browser_; | 77 Browser* browser_; |
| 77 | 78 |
| 78 DISALLOW_COPY_AND_ASSIGN(BrowserTabRestoreServiceDelegate); | 79 DISALLOW_COPY_AND_ASSIGN(BrowserTabRestoreServiceDelegate); |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 #endif // CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_ | 82 #endif // CHROME_BROWSER_UI_BROWSER_TAB_RESTORE_SERVICE_DELEGATE_H_ |
| OLD | NEW |