| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // The second parameter is the id of the window that was last active. | 29 // The second parameter is the id of the window that was last active. |
| 30 typedef base::Callback<void(ScopedVector<SessionWindow>, SessionID::id_type)> | 30 typedef base::Callback<void(ScopedVector<SessionWindow>, SessionID::id_type)> |
| 31 GetLastSessionCallback; | 31 GetLastSessionCallback; |
| 32 | 32 |
| 33 // A client interface that needs to be supplied to the tab restore service by | 33 // A client interface that needs to be supplied to the tab restore service by |
| 34 // the embedder. | 34 // the embedder. |
| 35 class SESSIONS_EXPORT TabRestoreServiceClient { | 35 class SESSIONS_EXPORT TabRestoreServiceClient { |
| 36 public: | 36 public: |
| 37 virtual ~TabRestoreServiceClient(); | 37 virtual ~TabRestoreServiceClient(); |
| 38 | 38 |
| 39 // Creates a LiveTabContext instance that is associated with | 39 // Creates a LiveTabContext instance that is associated with |app_name|. May |
| 40 // |host_desktop_type| and |app_name|. May return nullptr (e.g., if the | 40 // return nullptr (e.g., if the embedder does not support LiveTabContext |
| 41 // embedder does not support LiveTabContext functionality). | 41 // functionality). |
| 42 // Note that |host_desktop_type| is opaque to the component; the only values | 42 virtual LiveTabContext* CreateLiveTabContext(const std::string& app_name) = 0; |
| 43 // that will be passed here are those that have been passed *in* to the | |
| 44 // component from the embedder via TabRestoreService. | |
| 45 virtual LiveTabContext* CreateLiveTabContext(int host_desktop_type, | |
| 46 const std::string& app_name) = 0; | |
| 47 | 43 |
| 48 // Returns the LiveTabContext instance that is associated with | 44 // Returns the LiveTabContext instance that is associated with |
| 49 // |tab|, or null if there is no such instance. | 45 // |tab|, or null if there is no such instance. |
| 50 virtual LiveTabContext* FindLiveTabContextForTab(const LiveTab* tab) = 0; | 46 virtual LiveTabContext* FindLiveTabContextForTab(const LiveTab* tab) = 0; |
| 51 | 47 |
| 52 // Returns the LiveTabContext instance that is associated with | 48 // Returns the LiveTabContext instance that is associated with |desired_id|, |
| 53 // |desired_id| and |host_desktop_type|, or null if there is no such instance. | 49 // or null if there is no such instance. |
| 54 // Note that |host_desktop_type| is opaque to the component; the only values | |
| 55 // that will be passed here are those that have been passed *in* to the | |
| 56 // component from the embedder via TabRestoreService. | |
| 57 virtual LiveTabContext* FindLiveTabContextWithID( | 50 virtual LiveTabContext* FindLiveTabContextWithID( |
| 58 SessionID::id_type desired_id, | 51 SessionID::id_type desired_id) = 0; |
| 59 int host_desktop_type) = 0; | |
| 60 | 52 |
| 61 // Returns whether a given URL should be tracked for restoring. | 53 // Returns whether a given URL should be tracked for restoring. |
| 62 virtual bool ShouldTrackURLForRestore(const GURL& url) = 0; | 54 virtual bool ShouldTrackURLForRestore(const GURL& url) = 0; |
| 63 | 55 |
| 64 // Returns the extension app ID for the given LiveTab, or the empty string | 56 // Returns the extension app ID for the given LiveTab, or the empty string |
| 65 // if there is no such ID (e.g., if extensions are not supported by the | 57 // if there is no such ID (e.g., if extensions are not supported by the |
| 66 // embedder). | 58 // embedder). |
| 67 virtual std::string GetExtensionAppIDForTab(LiveTab* tab) = 0; | 59 virtual std::string GetExtensionAppIDForTab(LiveTab* tab) = 0; |
| 68 | 60 |
| 69 // Get the sequenced worker pool for running tasks on the backend thread as | 61 // Get the sequenced worker pool for running tasks on the backend thread as |
| (...skipping 16 matching lines...) Expand all Loading... |
| 86 base::CancelableTaskTracker* tracker) = 0; | 78 base::CancelableTaskTracker* tracker) = 0; |
| 87 | 79 |
| 88 // Called when a tab is restored. |url| is the URL that the tab is currently | 80 // Called when a tab is restored. |url| is the URL that the tab is currently |
| 89 // visiting. | 81 // visiting. |
| 90 virtual void OnTabRestored(const GURL& url); | 82 virtual void OnTabRestored(const GURL& url); |
| 91 }; | 83 }; |
| 92 | 84 |
| 93 } // namespace sessions | 85 } // namespace sessions |
| 94 | 86 |
| 95 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ | 87 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ |
| OLD | NEW |