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

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

Issue 2687353003: Created SerializableUserDataManager. (Closed)
Patch Set: self review, added unittest Created 3 years, 10 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
(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 SerializableUserDataImpl(NSDictionary* data);
Eugene But (OOO till 7-30) 2017/02/11 02:46:48 explicit
kkhorimoto 2017/02/11 03:19:48 Done.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698