Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_WEB_PUBLIC_SERIALIZED_USER_DATA_MANAGER_H_ | |
| 6 #define IOS_WEB_PUBLIC_SERIALIZED_USER_DATA_MANAGER_H_ | |
| 7 | |
| 8 #include "base/supports_user_data.h" | |
| 9 | |
| 10 #if defined(__OBJC__) | |
| 11 @protocol NSCoding; | |
| 12 @class NSDictionary; | |
| 13 @class NSString; | |
| 14 typedef id<NSCoding> SerializedUserDataType; | |
| 15 #else | |
| 16 class NSDictionary; | |
| 17 class NSString; | |
| 18 typedef void* SerializedUserDataType; | |
| 19 #endif // defined(__OBJC__) | |
| 20 | |
| 21 namespace web { | |
| 22 | |
| 23 class NavigationManager; | |
| 24 | |
| 25 // Class that manages arbitrary persistent data that can be added to a | |
| 26 // NavigationManager. | |
| 27 class SerializedUserDataManager { | |
| 28 public: | |
| 29 virtual ~SerializedUserDataManager() {} | |
| 30 | |
| 31 // Returns a SerializedUserDataManager for |manager|, lazily instantiating one | |
| 32 // if necessary. |manager| must be non-null. | |
| 33 static SerializedUserDataManager* FromNavigationManager( | |
| 34 NavigationManager* manager); | |
| 35 | |
| 36 // Associates |data| with the NavigationManager under |serialization_key|. | |
| 37 // |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.
| |
| 38 virtual void SetValueForSerializationKey(SerializedUserDataType data, | |
| 39 NSString* serialization_key) = 0; | |
| 40 | |
| 41 // Returns the value associated with |serialization_key|. | |
| 42 virtual SerializedUserDataType GetValueForSerializationKey( | |
| 43 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.
| |
| 44 | |
| 45 // Returns an NSDictionary containing the serializable key value pairs. | |
| 46 virtual NSDictionary* GetSerializationDictionary() const = 0; | |
| 47 | |
| 48 // 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.
| |
| 49 virtual void AddValuesFromDictionary(NSDictionary* dictionary) = 0; | |
| 50 }; | |
| 51 } | |
| 52 | |
| 53 #endif // IOS_WEB_PUBLIC_SERIALIZED_USER_DATA_MANAGER_H_ | |
| OLD | NEW |