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 #import "ios/web/navigation/serializable_user_data_manager_impl.h" | 5 #import "ios/web/navigation/serializable_user_data_manager_impl.h" |
6 | 6 |
7 #import "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.h" |
8 #import "ios/web/public/web_state/web_state.h" | 8 #import "ios/web/public/web_state/web_state.h" |
9 | 9 |
10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 }; | 53 }; |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 // static | 56 // static |
57 std::unique_ptr<SerializableUserData> SerializableUserData::Create() { | 57 std::unique_ptr<SerializableUserData> SerializableUserData::Create() { |
58 return std::unique_ptr<SerializableUserData>(new SerializableUserDataImpl()); | 58 return std::unique_ptr<SerializableUserData>(new SerializableUserDataImpl()); |
59 } | 59 } |
60 | 60 |
61 SerializableUserDataImpl::SerializableUserDataImpl() | 61 SerializableUserDataImpl::SerializableUserDataImpl() |
62 : data_([[NSDictionary alloc] init]), | 62 : data_(@{}), legacy_key_conversions_(@{ |
63 legacy_key_conversions_(@{@"tabId" : @"TabID"}) {} | 63 @"tabId" : @"TabID", |
| 64 @"openerId" : @"OpenerID", |
| 65 @"openerNavigationIndex" : @"OpenerNavigationIndex" |
| 66 }) {} |
64 | 67 |
65 SerializableUserDataImpl::~SerializableUserDataImpl() {} | 68 SerializableUserDataImpl::~SerializableUserDataImpl() {} |
66 | 69 |
67 SerializableUserDataImpl::SerializableUserDataImpl(NSDictionary* data) | 70 SerializableUserDataImpl::SerializableUserDataImpl(NSDictionary* data) |
68 : data_([data copy]) {} | 71 : data_([data copy]) {} |
69 | 72 |
70 void SerializableUserDataImpl::Encode(NSCoder* coder) { | 73 void SerializableUserDataImpl::Encode(NSCoder* coder) { |
71 [coder encodeObject:data_ forKey:kSerializedUserDataKey]; | 74 [coder encodeObject:data_ forKey:kSerializedUserDataKey]; |
72 } | 75 } |
73 | 76 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 123 |
121 void SerializableUserDataManagerImpl::AddSerializableUserData( | 124 void SerializableUserDataManagerImpl::AddSerializableUserData( |
122 SerializableUserData* data) { | 125 SerializableUserData* data) { |
123 DCHECK(data); | 126 DCHECK(data); |
124 SerializableUserDataImpl* data_impl = | 127 SerializableUserDataImpl* data_impl = |
125 static_cast<SerializableUserDataImpl*>(data); | 128 static_cast<SerializableUserDataImpl*>(data); |
126 data_.reset([data_impl->data() mutableCopy]); | 129 data_.reset([data_impl->data() mutableCopy]); |
127 } | 130 } |
128 | 131 |
129 } // namespace web | 132 } // namespace web |
OLD | NEW |