| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ |
| 6 #define IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ |
| 7 |
| 8 #import "base/mac/scoped_nsobject.h" |
| 9 #import "ios/web/public/serializable_user_data_manager.h" |
| 10 |
| 11 namespace web { |
| 12 |
| 13 class SerializableUserDataImpl : public SerializableUserData { |
| 14 public: |
| 15 SerializableUserDataImpl(); |
| 16 ~SerializableUserDataImpl(); |
| 17 |
| 18 // Constructor taking the NSDictionary holding the serializable data. |
| 19 explicit SerializableUserDataImpl(NSDictionary* data); |
| 20 |
| 21 // SerializableUserData: |
| 22 void Encode(NSCoder* coder) override; |
| 23 void Decode(NSCoder* coder) override; |
| 24 |
| 25 // Returns the serializable data. |
| 26 NSDictionary* data() { return data_; }; |
| 27 |
| 28 private: |
| 29 // The dictionary passed on initialization. After calling Decode(), this will |
| 30 // contain the data that is decoded from the NSCoder. |
| 31 base::scoped_nsobject<NSDictionary> data_; |
| 32 }; |
| 33 |
| 34 class SerializableUserDataManagerImpl : public SerializableUserDataManager { |
| 35 public: |
| 36 SerializableUserDataManagerImpl(); |
| 37 ~SerializableUserDataManagerImpl(); |
| 38 |
| 39 // SerializableUserDataManager: |
| 40 void AddSerializableData(id<NSCoding> data, NSString* key) override; |
| 41 id<NSCoding> GetValueForSerializationKey(NSString* key) override; |
| 42 std::unique_ptr<SerializableUserData> CreateSerializableUserData() |
| 43 const override; |
| 44 void AddSerializableUserData(SerializableUserData* data) override; |
| 45 |
| 46 private: |
| 47 // The dictionary that stores serializable user data. |
| 48 base::scoped_nsobject<NSMutableDictionary> data_; |
| 49 }; |
| 50 |
| 51 } // namespace web |
| 52 |
| 53 #endif // IOS_WEB_NAVIGATION_SERIALIZABLE_USER_DATA_MANAGER_IMPL_H_ |
| OLD | NEW |