| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_SYNC_CORE_CHANGE_RECORD_H_ | |
| 6 #define COMPONENTS_SYNC_CORE_CHANGE_RECORD_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/memory/linked_ptr.h" | |
| 14 #include "components/sync/base/immutable.h" | |
| 15 #include "components/sync/protocol/password_specifics.pb.h" | |
| 16 #include "components/sync/protocol/sync.pb.h" | |
| 17 | |
| 18 namespace base { | |
| 19 class DictionaryValue; | |
| 20 } // namespace base | |
| 21 | |
| 22 namespace syncer { | |
| 23 | |
| 24 // TODO(zea): One day get passwords playing nicely with the rest of encryption | |
| 25 // and get rid of this. | |
| 26 class ExtraPasswordChangeRecordData { | |
| 27 public: | |
| 28 ExtraPasswordChangeRecordData(); | |
| 29 explicit ExtraPasswordChangeRecordData( | |
| 30 const sync_pb::PasswordSpecificsData& data); | |
| 31 virtual ~ExtraPasswordChangeRecordData(); | |
| 32 | |
| 33 virtual std::unique_ptr<base::DictionaryValue> ToValue() const; | |
| 34 | |
| 35 const sync_pb::PasswordSpecificsData& unencrypted() const; | |
| 36 | |
| 37 private: | |
| 38 sync_pb::PasswordSpecificsData unencrypted_; | |
| 39 }; | |
| 40 | |
| 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 | |
| 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. | |
| 45 struct ChangeRecord { | |
| 46 enum Action { | |
| 47 ACTION_ADD, | |
| 48 ACTION_DELETE, | |
| 49 ACTION_UPDATE, | |
| 50 }; | |
| 51 ChangeRecord(); | |
| 52 ChangeRecord(const ChangeRecord& other); | |
| 53 ~ChangeRecord(); | |
| 54 | |
| 55 std::unique_ptr<base::DictionaryValue> ToValue() const; | |
| 56 | |
| 57 int64_t id; | |
| 58 Action action; | |
| 59 sync_pb::EntitySpecifics specifics; | |
| 60 linked_ptr<ExtraPasswordChangeRecordData> extra; | |
| 61 }; | |
| 62 | |
| 63 typedef std::vector<ChangeRecord> ChangeRecordList; | |
| 64 | |
| 65 typedef Immutable<ChangeRecordList> ImmutableChangeRecordList; | |
| 66 | |
| 67 } // namespace syncer | |
| 68 | |
| 69 #endif // COMPONENTS_SYNC_CORE_CHANGE_RECORD_H_ | |
| OLD | NEW |