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

Unified Diff: ios/web/public/serialized_user_data_manager.h

Issue 1361173005: Created SerializedUserDataManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@serialized_navigation_manager
Patch Set: 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
« ios/web/public/navigation_manager.h ('K') | « ios/web/public/navigation_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/serialized_user_data_manager.h
diff --git a/ios/web/public/serialized_user_data_manager.h b/ios/web/public/serialized_user_data_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..639fac470c7c8fd2c538070241204c465277d95d
--- /dev/null
+++ b/ios/web/public/serialized_user_data_manager.h
@@ -0,0 +1,53 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_PUBLIC_SERIALIZED_USER_DATA_MANAGER_H_
+#define IOS_WEB_PUBLIC_SERIALIZED_USER_DATA_MANAGER_H_
+
+#include "base/supports_user_data.h"
+
+#if defined(__OBJC__)
+@protocol NSCoding;
+@class NSDictionary;
+@class NSString;
+typedef id<NSCoding> SerializedUserDataType;
+#else
+class NSDictionary;
+class NSString;
+typedef void* SerializedUserDataType;
+#endif // defined(__OBJC__)
+
+namespace web {
+
+class NavigationManager;
+
+// Class that manages arbitrary persistent data that can be added to a
+// NavigationManager.
+class SerializedUserDataManager {
+ public:
+ virtual ~SerializedUserDataManager() {}
+
+ // Returns a SerializedUserDataManager for |manager|, lazily instantiating one
+ // if necessary. |manager| must be non-null.
+ static SerializedUserDataManager* FromNavigationManager(
+ NavigationManager* manager);
+
+ // Associates |data| with the NavigationManager under |serialization_key|.
+ // |data| is retained by the manager, and |serialization_key| is copied.
Eugene But (OOO till 7-30) 2015/09/24 17:05:07 |serialization_key| can not be empty?
kkhorimoto 2015/09/24 21:24:29 Done.
+ virtual void SetValueForSerializationKey(SerializedUserDataType data,
+ NSString* serialization_key) = 0;
+
+ // Returns the value associated with |serialization_key|.
+ virtual SerializedUserDataType GetValueForSerializationKey(
+ NSString* serialization_key) const = 0;
Eugene But (OOO till 7-30) 2015/09/24 17:05:07 ditto
kkhorimoto 2015/09/24 21:24:29 Done.
+
+ // Returns an NSDictionary containing the serializable key value pairs.
+ virtual NSDictionary* GetSerializationDictionary() const = 0;
+
+ // Adds values and serialization keys from |dictionary| to the manager.
Eugene But (OOO till 7-30) 2015/09/24 17:05:07 |dictionary| can not be null?
kkhorimoto 2015/09/24 21:24:29 Done.
+ virtual void AddValuesFromDictionary(NSDictionary* dictionary) = 0;
+};
+}
+
+#endif // IOS_WEB_PUBLIC_SERIALIZED_USER_DATA_MANAGER_H_
« ios/web/public/navigation_manager.h ('K') | « ios/web/public/navigation_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698