| 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 "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/sessions/session_id.h" | 12 #include "chrome/browser/sessions/session_id.h" |
| 13 #include "chrome/browser/ui/host_desktop.h" | 13 #include "chrome/browser/ui/host_desktop.h" |
| 14 | 14 |
| 15 class Profile; | 15 class Profile; |
| 16 class TabNavigation; | 16 |
| 17 namespace components { |
| 18 class SerializedNavigationEntry; |
| 19 } |
| 17 | 20 |
| 18 namespace content { | 21 namespace content { |
| 19 class NavigationController; | 22 class NavigationController; |
| 20 class SessionStorageNamespace; | 23 class SessionStorageNamespace; |
| 21 class WebContents; | 24 class WebContents; |
| 22 } | 25 } |
| 23 | 26 |
| 24 // Objects implement this interface to provide necessary functionality for | 27 // Objects implement this interface to provide necessary functionality for |
| 25 // TabRestoreService to operate. These methods are mostly copies of existing | 28 // TabRestoreService to operate. These methods are mostly copies of existing |
| 26 // Browser methods. | 29 // Browser methods. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 virtual int GetSelectedIndex() const = 0; | 42 virtual int GetSelectedIndex() const = 0; |
| 40 | 43 |
| 41 // see Browser::app_name() | 44 // see Browser::app_name() |
| 42 virtual std::string GetAppName() const = 0; | 45 virtual std::string GetAppName() const = 0; |
| 43 | 46 |
| 44 // see Browser methods with the same names | 47 // see Browser methods with the same names |
| 45 virtual content::WebContents* GetWebContentsAt(int index) const = 0; | 48 virtual content::WebContents* GetWebContentsAt(int index) const = 0; |
| 46 virtual content::WebContents* GetActiveWebContents() const = 0; | 49 virtual content::WebContents* GetActiveWebContents() const = 0; |
| 47 virtual bool IsTabPinned(int index) const = 0; | 50 virtual bool IsTabPinned(int index) const = 0; |
| 48 virtual content::WebContents* AddRestoredTab( | 51 virtual content::WebContents* AddRestoredTab( |
| 49 const std::vector<TabNavigation>& navigations, | 52 const std::vector<components::SerializedNavigationEntry>& navigations, |
| 50 int tab_index, | 53 int tab_index, |
| 51 int selected_navigation, | 54 int selected_navigation, |
| 52 const std::string& extension_app_id, | 55 const std::string& extension_app_id, |
| 53 bool select, | 56 bool select, |
| 54 bool pin, | 57 bool pin, |
| 55 bool from_last_session, | 58 bool from_last_session, |
| 56 content::SessionStorageNamespace* storage_namespace, | 59 content::SessionStorageNamespace* storage_namespace, |
| 57 const std::string& user_agent_override) = 0; | 60 const std::string& user_agent_override) = 0; |
| 58 virtual void ReplaceRestoredTab( | 61 virtual void ReplaceRestoredTab( |
| 59 const std::vector<TabNavigation>& navigations, | 62 const std::vector<components::SerializedNavigationEntry>& navigations, |
| 60 int selected_navigation, | 63 int selected_navigation, |
| 61 bool from_last_session, | 64 bool from_last_session, |
| 62 const std::string& extension_app_id, | 65 const std::string& extension_app_id, |
| 63 content::SessionStorageNamespace* session_storage_namespace, | 66 content::SessionStorageNamespace* session_storage_namespace, |
| 64 const std::string& user_agent_override) = 0; | 67 const std::string& user_agent_override) = 0; |
| 65 virtual void CloseTab() = 0; | 68 virtual void CloseTab() = 0; |
| 66 | 69 |
| 67 // see Browser::Create | 70 // see Browser::Create |
| 68 static TabRestoreServiceDelegate* Create( | 71 static TabRestoreServiceDelegate* Create( |
| 69 Profile* profile, | 72 Profile* profile, |
| 70 chrome::HostDesktopType host_desktop_type, | 73 chrome::HostDesktopType host_desktop_type, |
| 71 const std::string& app_name); | 74 const std::string& app_name); |
| 72 | 75 |
| 73 // see browser::FindBrowserForWebContents | 76 // see browser::FindBrowserForWebContents |
| 74 static TabRestoreServiceDelegate* FindDelegateForWebContents( | 77 static TabRestoreServiceDelegate* FindDelegateForWebContents( |
| 75 const content::WebContents* contents); | 78 const content::WebContents* contents); |
| 76 | 79 |
| 77 // see chrome::FindBrowserWithID | 80 // see chrome::FindBrowserWithID |
| 78 // Returns the TabRestoreServiceDelegate of the Browser with |desired_id| if | 81 // Returns the TabRestoreServiceDelegate of the Browser with |desired_id| if |
| 79 // such a Browser exists and is on the desktop defined by |host_desktop_type|. | 82 // such a Browser exists and is on the desktop defined by |host_desktop_type|. |
| 80 static TabRestoreServiceDelegate* FindDelegateWithID( | 83 static TabRestoreServiceDelegate* FindDelegateWithID( |
| 81 SessionID::id_type desired_id, | 84 SessionID::id_type desired_id, |
| 82 chrome::HostDesktopType host_desktop_type); | 85 chrome::HostDesktopType host_desktop_type); |
| 83 | 86 |
| 84 protected: | 87 protected: |
| 85 virtual ~TabRestoreServiceDelegate() {} | 88 virtual ~TabRestoreServiceDelegate() {} |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 91 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ |
| OLD | NEW |