| 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 SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_ | |
| 6 #define SYNC_INTERNAL_API_PUBLIC_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 "sync/base/sync_export.h" | |
| 15 #include "sync/internal_api/public/util/immutable.h" | |
| 16 #include "sync/protocol/password_specifics.pb.h" | |
| 17 #include "sync/protocol/sync.pb.h" | |
| 18 | |
| 19 namespace base { | |
| 20 class DictionaryValue; | |
| 21 } // namespace base | |
| 22 | |
| 23 namespace syncer { | |
| 24 | |
| 25 // TODO(zea): One day get passwords playing nicely with the rest of encryption | |
| 26 // and get rid of this. | |
| 27 class SYNC_EXPORT ExtraPasswordChangeRecordData { | |
| 28 public: | |
| 29 ExtraPasswordChangeRecordData(); | |
| 30 explicit ExtraPasswordChangeRecordData( | |
| 31 const sync_pb::PasswordSpecificsData& data); | |
| 32 virtual ~ExtraPasswordChangeRecordData(); | |
| 33 | |
| 34 virtual std::unique_ptr<base::DictionaryValue> ToValue() const; | |
| 35 | |
| 36 const sync_pb::PasswordSpecificsData& unencrypted() const; | |
| 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 SYNC_EXPORT 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 // SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_ | |
| OLD | NEW |