| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ | 5 #ifndef COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ |
| 6 #define COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ | 6 #define COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "components/sessions/core/session_id.h" | 12 #include "components/sessions/core/session_id.h" |
| 13 #include "components/sessions/core/sessions_export.h" | 13 #include "components/sessions/core/sessions_export.h" |
| 14 #include "ui/base/ui_base_types.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class CancelableTaskTracker; | 19 class CancelableTaskTracker; |
| 19 } | 20 } |
| 20 | 21 |
| 22 namespace gfx { |
| 23 class Rect; |
| 24 } |
| 25 |
| 21 namespace sessions { | 26 namespace sessions { |
| 22 | 27 |
| 23 class LiveTab; | 28 class LiveTab; |
| 24 class LiveTabContext; | 29 class LiveTabContext; |
| 25 struct SessionWindow; | 30 struct SessionWindow; |
| 26 | 31 |
| 27 // Callback from TabRestoreServiceClient::GetLastSession. | 32 // Callback from TabRestoreServiceClient::GetLastSession. |
| 28 // The second parameter is the id of the window that was last active. | 33 // The second parameter is the id of the window that was last active. |
| 29 using GetLastSessionCallback = | 34 using GetLastSessionCallback = |
| 30 base::Callback<void(std::vector<std::unique_ptr<SessionWindow>>, | 35 base::Callback<void(std::vector<std::unique_ptr<SessionWindow>>, |
| 31 SessionID::id_type)>; | 36 SessionID::id_type)>; |
| 32 | 37 |
| 33 // A client interface that needs to be supplied to the tab restore service by | 38 // A client interface that needs to be supplied to the tab restore service by |
| 34 // the embedder. | 39 // the embedder. |
| 35 class SESSIONS_EXPORT TabRestoreServiceClient { | 40 class SESSIONS_EXPORT TabRestoreServiceClient { |
| 36 public: | 41 public: |
| 37 virtual ~TabRestoreServiceClient(); | 42 virtual ~TabRestoreServiceClient(); |
| 38 | 43 |
| 39 // Creates a LiveTabContext instance that is associated with |app_name|. May | 44 // Creates a LiveTabContext instance that is associated with |app_name|. May |
| 40 // return nullptr (e.g., if the embedder does not support LiveTabContext | 45 // return nullptr (e.g., if the embedder does not support LiveTabContext |
| 41 // functionality). | 46 // functionality). |
| 42 virtual LiveTabContext* CreateLiveTabContext(const std::string& app_name) = 0; | 47 virtual LiveTabContext* CreateLiveTabContext( |
| 48 const std::string& app_name, |
| 49 const gfx::Rect& bounds, |
| 50 ui::WindowShowState show_state, |
| 51 const std::string& workspace) = 0; |
| 43 | 52 |
| 44 // Returns the LiveTabContext instance that is associated with | 53 // Returns the LiveTabContext instance that is associated with |
| 45 // |tab|, or null if there is no such instance. | 54 // |tab|, or null if there is no such instance. |
| 46 virtual LiveTabContext* FindLiveTabContextForTab(const LiveTab* tab) = 0; | 55 virtual LiveTabContext* FindLiveTabContextForTab(const LiveTab* tab) = 0; |
| 47 | 56 |
| 48 // Returns the LiveTabContext instance that is associated with |desired_id|, | 57 // Returns the LiveTabContext instance that is associated with |desired_id|, |
| 49 // or null if there is no such instance. | 58 // or null if there is no such instance. |
| 50 virtual LiveTabContext* FindLiveTabContextWithID( | 59 virtual LiveTabContext* FindLiveTabContextWithID( |
| 51 SessionID::id_type desired_id) = 0; | 60 SessionID::id_type desired_id) = 0; |
| 52 | 61 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 74 base::CancelableTaskTracker* tracker) = 0; | 83 base::CancelableTaskTracker* tracker) = 0; |
| 75 | 84 |
| 76 // Called when a tab is restored. |url| is the URL that the tab is currently | 85 // Called when a tab is restored. |url| is the URL that the tab is currently |
| 77 // visiting. | 86 // visiting. |
| 78 virtual void OnTabRestored(const GURL& url); | 87 virtual void OnTabRestored(const GURL& url); |
| 79 }; | 88 }; |
| 80 | 89 |
| 81 } // namespace sessions | 90 } // namespace sessions |
| 82 | 91 |
| 83 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ | 92 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ |
| OLD | NEW |