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" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "components/sessions/session_id.h" | 12 #include "components/sessions/session_id.h" |
13 #include "components/sessions/sessions_export.h" | 13 #include "components/sessions/sessions_export.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class CancelableTaskTracker; | 16 class CancelableTaskTracker; |
17 class SequencedWorkerPool; | 17 class SequencedWorkerPool; |
18 } | 18 } |
19 | 19 |
20 // TODO(blundell): Remove all references to WebContents from | |
21 // TabRestoreServiceClient and get rid of this. crbug.com/530174 | |
22 namespace content { | |
23 class WebContents; | |
24 } | |
25 | |
26 class GURL; | 20 class GURL; |
27 class TabRestoreServiceDelegate; | |
28 | 21 |
29 namespace sessions { | 22 namespace sessions { |
30 | 23 |
31 class LiveTab; | 24 class LiveTab; |
32 struct SessionWindow; | 25 struct SessionWindow; |
| 26 class TabRestoreServiceDelegate; |
33 | 27 |
34 // Callback from TabRestoreServiceClient::GetLastSession. | 28 // Callback from TabRestoreServiceClient::GetLastSession. |
35 // 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. |
36 typedef base::Callback<void(ScopedVector<SessionWindow>, SessionID::id_type)> | 30 typedef base::Callback<void(ScopedVector<SessionWindow>, SessionID::id_type)> |
37 GetLastSessionCallback; | 31 GetLastSessionCallback; |
38 | 32 |
39 // A class that is used to associate embedder-specific data with | 33 // A class that is used to associate embedder-specific data with |
40 // TabRestoreService::Tab. See TabRestoreServiceClient::GetClientData(). | 34 // TabRestoreService::Tab. See TabRestoreServiceClient::GetClientData(). |
41 // Subclasses of this class must be copyable by implementing the Clone() method | 35 // Subclasses of this class must be copyable by implementing the Clone() method |
42 // for usage by the Tab struct, which is itself copyable and assignable. | 36 // for usage by the Tab struct, which is itself copyable and assignable. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // Note that |host_desktop_type| is opaque to the component; the only values | 68 // Note that |host_desktop_type| is opaque to the component; the only values |
75 // that will be passed here are those that have been passed *in* to the | 69 // that will be passed here are those that have been passed *in* to the |
76 // component from the embedder via TabRestoreService. | 70 // component from the embedder via TabRestoreService. |
77 virtual TabRestoreServiceDelegate* FindTabRestoreServiceDelegateWithID( | 71 virtual TabRestoreServiceDelegate* FindTabRestoreServiceDelegateWithID( |
78 SessionID::id_type desired_id, | 72 SessionID::id_type desired_id, |
79 int host_desktop_type) = 0; | 73 int host_desktop_type) = 0; |
80 | 74 |
81 // Returns whether a given URL should be tracked for restoring. | 75 // Returns whether a given URL should be tracked for restoring. |
82 virtual bool ShouldTrackURLForRestore(const GURL& url) = 0; | 76 virtual bool ShouldTrackURLForRestore(const GURL& url) = 0; |
83 | 77 |
84 // Returns the extension app ID for the given WebContents, or the empty string | 78 // Returns the extension app ID for the given LiveTab, or the empty string |
85 // if there is no such ID (e.g., if extensions are not supported by the | 79 // if there is no such ID (e.g., if extensions are not supported by the |
86 // embedder). | 80 // embedder). |
87 virtual std::string GetExtensionAppIDForTab(LiveTab* tab) = 0; | 81 virtual std::string GetExtensionAppIDForTab(LiveTab* tab) = 0; |
88 | 82 |
89 // Returns any client data that should be associated with the | 83 // Returns any client data that should be associated with the |
90 // TabRestoreService::Tab corresponding to |tab|. That tab will own | 84 // TabRestoreService::Tab corresponding to |tab|. That tab will own |
91 // this TabClientData instance. The default implementation returns null. | 85 // this TabClientData instance. The default implementation returns null. |
92 virtual scoped_ptr<TabClientData> GetTabClientDataForTab(LiveTab* tab); | 86 virtual scoped_ptr<TabClientData> GetTabClientDataForTab(LiveTab* tab); |
93 | 87 |
94 // Get the sequenced worker pool for running tasks on the backend thread as | 88 // Get the sequenced worker pool for running tasks on the backend thread as |
(...skipping 16 matching lines...) Expand all Loading... |
111 base::CancelableTaskTracker* tracker) = 0; | 105 base::CancelableTaskTracker* tracker) = 0; |
112 | 106 |
113 // Called when a tab is restored. |url| is the URL that the tab is currently | 107 // Called when a tab is restored. |url| is the URL that the tab is currently |
114 // visiting. | 108 // visiting. |
115 virtual void OnTabRestored(const GURL& url); | 109 virtual void OnTabRestored(const GURL& url); |
116 }; | 110 }; |
117 | 111 |
118 } // namespace sessions | 112 } // namespace sessions |
119 | 113 |
120 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ | 114 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_CLIENT_H_ |
OLD | NEW |