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