| 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_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 
| 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
| 11 #include "components/sessions/session_id.h" | 11 #include "components/sessions/session_id.h" | 
| 12 | 12 | 
| 13 namespace content { | 13 namespace content { | 
| 14 class NavigationController; | 14 class NavigationController; | 
| 15 class SessionStorageNamespace; |  | 
| 16 class WebContents; | 15 class WebContents; | 
| 17 } | 16 } | 
| 18 | 17 | 
| 19 namespace sessions { | 18 namespace sessions { | 
| 20 class SerializedNavigationEntry; | 19 class SerializedNavigationEntry; | 
|  | 20 class TabClientData; | 
| 21 } | 21 } | 
| 22 | 22 | 
| 23 // Objects implement this interface to provide necessary functionality for | 23 // Objects implement this interface to provide necessary functionality for | 
| 24 // TabRestoreService to operate. These methods are mostly copies of existing | 24 // TabRestoreService to operate. These methods are mostly copies of existing | 
| 25 // Browser methods. | 25 // Browser methods. | 
| 26 class TabRestoreServiceDelegate { | 26 class TabRestoreServiceDelegate { | 
| 27  public: | 27  public: | 
| 28   // see BrowserWindow::Show() | 28   // see BrowserWindow::Show() | 
| 29   virtual void ShowBrowserWindow() = 0; | 29   virtual void ShowBrowserWindow() = 0; | 
| 30 | 30 | 
| 31   // see Browser::session_id() | 31   // see Browser::session_id() | 
| 32   virtual const SessionID& GetSessionID() const = 0; | 32   virtual const SessionID& GetSessionID() const = 0; | 
| 33 | 33 | 
| 34   // see Browser::tab_count() | 34   // see Browser::tab_count() | 
| 35   virtual int GetTabCount() const = 0; | 35   virtual int GetTabCount() const = 0; | 
| 36 | 36 | 
| 37   // see Browser::active_index() | 37   // see Browser::active_index() | 
| 38   virtual int GetSelectedIndex() const = 0; | 38   virtual int GetSelectedIndex() const = 0; | 
| 39 | 39 | 
| 40   // see Browser::app_name() | 40   // see Browser::app_name() | 
| 41   virtual std::string GetAppName() const = 0; | 41   virtual std::string GetAppName() const = 0; | 
| 42 | 42 | 
| 43   // see Browser methods with the same names | 43   // see Browser methods with the same names | 
| 44   virtual content::WebContents* GetWebContentsAt(int index) const = 0; | 44   virtual content::WebContents* GetWebContentsAt(int index) const = 0; | 
| 45   virtual content::WebContents* GetActiveWebContents() const = 0; | 45   virtual content::WebContents* GetActiveWebContents() const = 0; | 
| 46   virtual bool IsTabPinned(int index) const = 0; | 46   virtual bool IsTabPinned(int index) const = 0; | 
|  | 47 | 
|  | 48   // Note: |tab_client_data| will be null if |from_last_session| is true, | 
|  | 49   // as the tab client data is not persisted. | 
| 47   virtual content::WebContents* AddRestoredTab( | 50   virtual content::WebContents* AddRestoredTab( | 
| 48       const std::vector<sessions::SerializedNavigationEntry>& navigations, | 51       const std::vector<sessions::SerializedNavigationEntry>& navigations, | 
| 49       int tab_index, | 52       int tab_index, | 
| 50       int selected_navigation, | 53       int selected_navigation, | 
| 51       const std::string& extension_app_id, | 54       const std::string& extension_app_id, | 
| 52       bool select, | 55       bool select, | 
| 53       bool pin, | 56       bool pin, | 
| 54       bool from_last_session, | 57       bool from_last_session, | 
| 55       content::SessionStorageNamespace* storage_namespace, | 58       const sessions::TabClientData* tab_client_data, | 
| 56       const std::string& user_agent_override) = 0; | 59       const std::string& user_agent_override) = 0; | 
|  | 60 | 
|  | 61   // Note: |tab_client_data| will be null if |from_last_session| is true, | 
|  | 62   // as the tab client data is not persisted. | 
| 57   virtual content::WebContents* ReplaceRestoredTab( | 63   virtual content::WebContents* ReplaceRestoredTab( | 
| 58       const std::vector<sessions::SerializedNavigationEntry>& navigations, | 64       const std::vector<sessions::SerializedNavigationEntry>& navigations, | 
| 59       int selected_navigation, | 65       int selected_navigation, | 
| 60       bool from_last_session, | 66       bool from_last_session, | 
| 61       const std::string& extension_app_id, | 67       const std::string& extension_app_id, | 
| 62       content::SessionStorageNamespace* session_storage_namespace, | 68       const sessions::TabClientData* tab_client_data, | 
| 63       const std::string& user_agent_override) = 0; | 69       const std::string& user_agent_override) = 0; | 
| 64   virtual void CloseTab() = 0; | 70   virtual void CloseTab() = 0; | 
| 65 | 71 | 
| 66  protected: | 72  protected: | 
| 67   virtual ~TabRestoreServiceDelegate() {} | 73   virtual ~TabRestoreServiceDelegate() {} | 
| 68 }; | 74 }; | 
| 69 | 75 | 
| 70 #endif  // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 76 #endif  // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 
| OLD | NEW | 
|---|