Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: components/sessions/core/tab_restore_service_client.h

Issue 1343833002: Abstract content::SessionStorageNamespace from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extension_tab_helper
Patch Set: Response to review Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sessions/core/tab_restore_service_client.h
diff --git a/components/sessions/core/tab_restore_service_client.h b/components/sessions/core/tab_restore_service_client.h
index 99f1089c08adb12aa109f7944f18e23b8bdd2424..daea0320db1c18c7922c3addc39642ee45bd1ddd 100644
--- a/components/sessions/core/tab_restore_service_client.h
+++ b/components/sessions/core/tab_restore_service_client.h
@@ -7,8 +7,10 @@
#include "base/callback.h"
#include "base/files/file_path.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "components/sessions/session_id.h"
+#include "components/sessions/sessions_export.h"
namespace base {
class CancelableTaskTracker;
@@ -37,11 +39,23 @@ struct SessionWindow;
typedef base::Callback<void(ScopedVector<SessionWindow>, SessionID::id_type)>
GetLastSessionCallback;
+// A class that is used to associate embedder-specific data with
+// TabRestoreService::Tab. See TabRestoreServiceClient::GetClientData().
+// Subclasses of this class must be copyable by implementing the Clone() method
+// for usage by the Tab struct, which is itself copyable and assignable.
+class SESSIONS_EXPORT TabClientData {
+ public:
+ // TODO(blundell): Make this private once tab_restore_service.h is in the
+ // component and declare TabRestoreService::Tab a friend of this class.
+ virtual scoped_ptr<TabClientData> Clone() = 0;
+ virtual ~TabClientData();
+};
+
// A client interface that needs to be supplied to the tab restore service by
// the embedder.
-class TabRestoreServiceClient {
+class SESSIONS_EXPORT TabRestoreServiceClient {
public:
- virtual ~TabRestoreServiceClient() {}
+ virtual ~TabRestoreServiceClient();
// Creates a TabRestoreServiceDelegate instance that is associated with
// |host_desktop_type| and |app_name|. May return nullptr (e.g., if the
@@ -81,6 +95,12 @@ class TabRestoreServiceClient {
virtual std::string GetExtensionAppIDForWebContents(
content::WebContents* web_contents) = 0;
+ // Returns any client data that should be associated with the
+ // TabRestoreService::Tab corresponding to |web_contents|. That tab will own
+ // this TabClientData instance. The default implementation returns null.
+ virtual scoped_ptr<TabClientData> GetTabClientDataForWebContents(
+ content::WebContents* web_contents);
+
// Get the sequenced worker pool for running tasks on the backend thread as
// long as the system is not shutting down.
virtual base::SequencedWorkerPool* GetBlockingPool() = 0;
@@ -102,7 +122,7 @@ class TabRestoreServiceClient {
// Called when a tab is restored. |url| is the URL that the tab is currently
// visiting.
- virtual void OnTabRestored(const GURL& url) {}
+ virtual void OnTabRestored(const GURL& url);
};
} // namespace sessions
« no previous file with comments | « components/sessions/content/content_tab_client_data.cc ('k') | components/sessions/core/tab_restore_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698