OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "sync/base/sync_export.h" | 14 #include "sync/base/sync_export.h" |
15 #include "sync/internal_api/public/util/immutable.h" | 15 #include "sync/internal_api/public/util/immutable.h" |
16 #include "sync/protocol/password_specifics.pb.h" | 16 #include "sync/protocol/password_specifics.pb.h" |
17 #include "sync/protocol/sync.pb.h" | 17 #include "sync/protocol/sync.pb.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class DictionaryValue; | 20 class DictionaryValue; |
21 } // namespace base | 21 } // namespace base |
22 | 22 |
23 namespace syncer { | 23 namespace syncer { |
24 | 24 |
25 // TODO(zea): One day get passwords playing nicely with the rest of encryption | 25 // TODO(zea): One day get passwords playing nicely with the rest of encryption |
26 // and get rid of this. | 26 // and get rid of this. |
27 class SYNC_EXPORT ExtraPasswordChangeRecordData { | 27 class SYNC_EXPORT ExtraPasswordChangeRecordData { |
28 public: | 28 public: |
29 ExtraPasswordChangeRecordData(); | 29 ExtraPasswordChangeRecordData(); |
30 explicit ExtraPasswordChangeRecordData( | 30 explicit ExtraPasswordChangeRecordData( |
31 const sync_pb::PasswordSpecificsData& data); | 31 const sync_pb::PasswordSpecificsData& data); |
32 virtual ~ExtraPasswordChangeRecordData(); | 32 virtual ~ExtraPasswordChangeRecordData(); |
33 | 33 |
34 virtual scoped_ptr<base::DictionaryValue> ToValue() const; | 34 virtual std::unique_ptr<base::DictionaryValue> ToValue() const; |
35 | 35 |
36 const sync_pb::PasswordSpecificsData& unencrypted() const; | 36 const sync_pb::PasswordSpecificsData& unencrypted() const; |
37 private: | 37 private: |
38 sync_pb::PasswordSpecificsData unencrypted_; | 38 sync_pb::PasswordSpecificsData unencrypted_; |
39 }; | 39 }; |
40 | 40 |
41 // ChangeRecord indicates a single item that changed as a result of a sync | 41 // ChangeRecord indicates a single item that changed as a result of a sync |
42 // operation. This gives the sync id of the node that changed, and the type | 42 // operation. This gives the sync id of the node that changed, and the type |
43 // of change. To get the actual property values after an ADD or UPDATE, the | 43 // of change. To get the actual property values after an ADD or UPDATE, the |
44 // client should get the node with InitByIdLookup(), using the provided id. | 44 // client should get the node with InitByIdLookup(), using the provided id. |
45 struct SYNC_EXPORT ChangeRecord { | 45 struct SYNC_EXPORT ChangeRecord { |
46 enum Action { | 46 enum Action { |
47 ACTION_ADD, | 47 ACTION_ADD, |
48 ACTION_DELETE, | 48 ACTION_DELETE, |
49 ACTION_UPDATE, | 49 ACTION_UPDATE, |
50 }; | 50 }; |
51 ChangeRecord(); | 51 ChangeRecord(); |
52 ChangeRecord(const ChangeRecord& other); | 52 ChangeRecord(const ChangeRecord& other); |
53 ~ChangeRecord(); | 53 ~ChangeRecord(); |
54 | 54 |
55 scoped_ptr<base::DictionaryValue> ToValue() const; | 55 std::unique_ptr<base::DictionaryValue> ToValue() const; |
56 | 56 |
57 int64_t id; | 57 int64_t id; |
58 Action action; | 58 Action action; |
59 sync_pb::EntitySpecifics specifics; | 59 sync_pb::EntitySpecifics specifics; |
60 linked_ptr<ExtraPasswordChangeRecordData> extra; | 60 linked_ptr<ExtraPasswordChangeRecordData> extra; |
61 }; | 61 }; |
62 | 62 |
63 typedef std::vector<ChangeRecord> ChangeRecordList; | 63 typedef std::vector<ChangeRecord> ChangeRecordList; |
64 | 64 |
65 typedef Immutable<ChangeRecordList> ImmutableChangeRecordList; | 65 typedef Immutable<ChangeRecordList> ImmutableChangeRecordList; |
66 | 66 |
67 } // namespace syncer | 67 } // namespace syncer |
68 | 68 |
69 #endif // SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_ | 69 #endif // SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_ |
OLD | NEW |