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

Side by Side Diff: ios/web/navigation/serializable_user_data_manager_impl.mm

Issue 2722013002: Use custom user data to serialize Tab last visited timestamp. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_(@{}), legacy_key_conversions_(@{ 62 : data_(@{}), legacy_key_conversions_(@{
63 @"tabId" : @"TabID", 63 @"tabId" : @"TabID",
64 @"openerId" : @"OpenerID", 64 @"openerId" : @"OpenerID",
65 @"openerNavigationIndex" : @"OpenerNavigationIndex" 65 @"openerNavigationIndex" : @"OpenerNavigationIndex",
66 @"lastVisitedTimestamp" : @"LastVisitedTimestamp",
66 }) {} 67 }) {}
67 68
68 SerializableUserDataImpl::~SerializableUserDataImpl() {} 69 SerializableUserDataImpl::~SerializableUserDataImpl() {}
69 70
70 SerializableUserDataImpl::SerializableUserDataImpl(NSDictionary* data) 71 SerializableUserDataImpl::SerializableUserDataImpl(NSDictionary* data)
71 : data_([data copy]) {} 72 : data_([data copy]) {}
72 73
73 void SerializableUserDataImpl::Encode(NSCoder* coder) { 74 void SerializableUserDataImpl::Encode(NSCoder* coder) {
74 [coder encodeObject:data_ forKey:kSerializedUserDataKey]; 75 [coder encodeObject:data_ forKey:kSerializedUserDataKey];
75 } 76 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 124
124 void SerializableUserDataManagerImpl::AddSerializableUserData( 125 void SerializableUserDataManagerImpl::AddSerializableUserData(
125 SerializableUserData* data) { 126 SerializableUserData* data) {
126 DCHECK(data); 127 DCHECK(data);
127 SerializableUserDataImpl* data_impl = 128 SerializableUserDataImpl* data_impl =
128 static_cast<SerializableUserDataImpl*>(data); 129 static_cast<SerializableUserDataImpl*>(data);
129 data_.reset([data_impl->data() mutableCopy]); 130 data_.reset([data_impl->data() mutableCopy]);
130 } 131 }
131 132
132 } // namespace web 133 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/navigation/crw_session_storage_unittest.mm ('k') | ios/web/navigation/session_storage_builder.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698