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

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

Issue 2310363002: Persist offline page info in a navigation entry if needed (Closed)
Patch Set: Add extended info support Created 4 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/serialized_navigation_driver.h
diff --git a/components/sessions/core/serialized_navigation_driver.h b/components/sessions/core/serialized_navigation_driver.h
index 5fc261e4a95c5915f0c3dc2fef55beb33ad14352..4af08fb75f1d083424a940f475dfc326de0a2656 100644
--- a/components/sessions/core/serialized_navigation_driver.h
+++ b/components/sessions/core/serialized_navigation_driver.h
@@ -5,10 +5,15 @@
#ifndef COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_
#define COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_
+#include <map>
#include <string>
#include "components/sessions/core/sessions_export.h"
+namespace content {
+class NavigationEntry;
+}
+
namespace sessions {
class SerializedNavigationEntry;
@@ -18,6 +23,24 @@ class SerializedNavigationEntry;
// must be provided by the driver on each platform.
class SESSIONS_EXPORT SerializedNavigationDriver {
sky 2016/09/27 22:30:27 This code can't depend upon content. Your changes
jianli 2016/09/27 23:30:32 Done.
public:
+ // The interface that handles how the extended info is converted betweened the
sky 2016/09/27 22:30:27 How about: This interface is used to store and ret
jianli 2016/09/27 23:30:32 Done.
+ // one stored in SerializedNavigationEntry and the one used in
+ // NavigationEntry.
+ class SESSIONS_EXPORT ExtendedInfoHandler {
sky 2016/09/27 22:30:27 Move this into it's own header.
jianli 2016/09/27 23:30:32 Done.
+ public:
+ virtual ~ExtendedInfoHandler() {}
+
+ // Returns the extended info from NavigationEntry for
+ // SerializedNavigationEntry to save it.
+ virtual std::string GetExtendedInfo(
+ const content::NavigationEntry& entry) const = 0;
+
+ // Puts the extended info, extracted from SerializedNavigationEntry, into
+ // NavigationEntry.
+ virtual void RestoreExtendedInfo(
+ const std::string& info, content::NavigationEntry* entry) = 0;
+ };
+
virtual ~SerializedNavigationDriver() {}
// Returns the singleton SerializedNavigationDriver.
@@ -50,6 +73,18 @@ class SESSIONS_EXPORT SerializedNavigationDriver {
// Removes the referrer from the encoded page state.
virtual std::string StripReferrerFromPageState(
const std::string& page_state) const = 0;
+
+ // Registers a handler that could be used to read and write the extended
sky 2016/09/27 22:30:27 'could be' -> is
jianli 2016/09/27 23:30:32 Done.
+ // info stored in SerializedNavigationEntry.
+ virtual void RegisterExtendedInfoHandler(
+ const std::string& key,
+ std::unique_ptr<ExtendedInfoHandler> handler) = 0;
+
+ typedef std::map<std::string, std::unique_ptr<ExtendedInfoHandler>>
sky 2016/09/27 22:30:27 using.
jianli 2016/09/27 23:30:32 Done.
+ ExtendedInfoHandlerMap;
+
+ // Returns all the registered handlers to deal with the extended info.
+ virtual const ExtendedInfoHandlerMap& GetAllExtendedInfoHandlers() const = 0;
};
} // namespace sessions

Powered by Google App Engine
This is Rietveld 408576698