Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ | 5 #ifndef IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ |
| 6 #define IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ | 6 #define IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #import "ios/web/public/serializable_user_data_manager.h" | 9 #import "ios/web/public/serializable_user_data_manager.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 void Encode(NSCoder* coder) override; | 22 void Encode(NSCoder* coder) override; |
| 23 void Decode(NSCoder* coder) override; | 23 void Decode(NSCoder* coder) override; |
| 24 | 24 |
| 25 // Returns the serializable data. | 25 // Returns the serializable data. |
| 26 NSDictionary* data() { return data_; }; | 26 NSDictionary* data() { return data_; }; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // The dictionary passed on initialization. After calling Decode(), this will | 29 // The dictionary passed on initialization. After calling Decode(), this will |
| 30 // contain the data that is decoded from the NSCoder. | 30 // contain the data that is decoded from the NSCoder. |
| 31 base::scoped_nsobject<NSDictionary> data_; | 31 base::scoped_nsobject<NSDictionary> data_; |
| 32 // Some values that were previously persisted directly in CRWSessionStorage | |
| 33 // are now serialized using SerializableUserData, and this dictionary is used | |
| 34 // to decode these values. The keys are the legacy encoding keys, and the | |
| 35 // values are their corresponding serializable user data keys. | |
| 36 base::scoped_nsobject<NSDictionary> legacy_key_conversions_; | |
|
Eugene But (OOO till 7-30)
2017/02/13 17:37:57
Do we need to set a milestone when we drop support
kkhorimoto
2017/02/13 23:41:18
Done.
| |
| 37 | |
| 38 // Decodes the values that were previously encoded using CRWSessionStorage's | |
| 39 // NSCoding implementation and returns an NSDictionary using the new | |
| 40 // serialization keys. | |
| 41 NSDictionary* GetDecodedLegacyValues(NSCoder* coder); | |
|
Eugene But (OOO till 7-30)
2017/02/13 17:37:57
Do you want to move method higher (before ivars)?
kkhorimoto
2017/02/13 23:41:18
Done.
| |
| 32 }; | 42 }; |
| 33 | 43 |
| 34 class SerializableUserDataManagerImpl : public SerializableUserDataManager { | 44 class SerializableUserDataManagerImpl : public SerializableUserDataManager { |
| 35 public: | 45 public: |
| 36 SerializableUserDataManagerImpl(); | 46 SerializableUserDataManagerImpl(); |
| 37 ~SerializableUserDataManagerImpl(); | 47 ~SerializableUserDataManagerImpl(); |
| 38 | 48 |
| 39 // SerializableUserDataManager: | 49 // SerializableUserDataManager: |
| 40 void AddSerializableData(id<NSCoding> data, NSString* key) override; | 50 void AddSerializableData(id<NSCoding> data, NSString* key) override; |
| 41 id<NSCoding> GetValueForSerializationKey(NSString* key) override; | 51 id<NSCoding> GetValueForSerializationKey(NSString* key) override; |
| 42 std::unique_ptr<SerializableUserData> CreateSerializableUserData() | 52 std::unique_ptr<SerializableUserData> CreateSerializableUserData() |
| 43 const override; | 53 const override; |
| 44 void AddSerializableUserData(SerializableUserData* data) override; | 54 void AddSerializableUserData(SerializableUserData* data) override; |
| 45 | 55 |
| 46 private: | 56 private: |
| 47 // The dictionary that stores serializable user data. | 57 // The dictionary that stores serializable user data. |
| 48 base::scoped_nsobject<NSMutableDictionary> data_; | 58 base::scoped_nsobject<NSMutableDictionary> data_; |
| 49 }; | 59 }; |
| 50 | 60 |
| 51 } // namespace web | 61 } // namespace web |
| 52 | 62 |
| 53 #endif // IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ | 63 #endif // IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ |
| OLD | NEW |