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

Unified Diff: ios/web/navigation/serializable_user_data_manager_impl.h

Issue 2687353003: Created SerializableUserDataManager. (Closed)
Patch Set: Eugene's comments Created 3 years, 10 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: ios/web/navigation/serializable_user_data_manager_impl.h
diff --git a/ios/web/navigation/serializable_user_data_manager_impl.h b/ios/web/navigation/serializable_user_data_manager_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..38fa1fb1c6402eef9bf6ef2602fc7d75256912b6
--- /dev/null
+++ b/ios/web/navigation/serializable_user_data_manager_impl.h
@@ -0,0 +1,53 @@
+// Copyright 2017 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_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_
+#define IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_
+
+#import "base/mac/scoped_nsobject.h"
+#import "ios/web/public/serializable_user_data_manager.h"
+
+namespace web {
+
+class SerializableUserDataImpl : public SerializableUserData {
+ public:
+ SerializableUserDataImpl();
+ ~SerializableUserDataImpl();
+
+ // Constructor taking the NSDictionary holding the serializable data.
+ explicit SerializableUserDataImpl(NSDictionary* data);
+
+ // SerializableUserData:
+ void Encode(NSCoder* coder) override;
+ void Decode(NSCoder* coder) override;
+
+ // Returns the serializable data.
+ NSDictionary* data() { return data_; };
+
+ private:
+ // The dictionary passed on initialization. After calling Decode(), this will
+ // contain the data that is decoded from the NSCoder.
+ base::scoped_nsobject<NSDictionary> data_;
+};
+
+class SerializableUserDataManagerImpl : public SerializableUserDataManager {
+ public:
+ SerializableUserDataManagerImpl();
+ ~SerializableUserDataManagerImpl();
+
+ // SerializableUserDataManager:
+ void AddSerializableData(id<NSCoding> data, NSString* key) override;
+ id<NSCoding> GetValueForSerializationKey(NSString* key) override;
+ std::unique_ptr<SerializableUserData> CreateSerializableUserData()
+ const override;
+ void AddSerializableUserData(SerializableUserData* data) override;
+
+ private:
+ // The dictionary that stores serializable user data.
+ base::scoped_nsobject<NSMutableDictionary> data_;
+};
+
+} // namespace web
+
+#endif // IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_
« no previous file with comments | « ios/web/navigation/navigation_manager_storage_builder.mm ('k') | ios/web/navigation/serializable_user_data_manager_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698