Roll src/third_party/WebKit 96fb88b:6bbd108 (svn 201045:201047)
[chromium-blink-merge.git] / sync / internal_api / public / change_record.h
blob9f51737308283707e647aa325c2004a87fa9a2b7
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.
5 #ifndef SYNC_INTERNAL_PUBLIC_API_CHANGE_RECORD_H_
6 #define SYNC_INTERNAL_PUBLIC_API_CHANGE_RECORD_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "sync/base/sync_export.h"
14 #include "sync/internal_api/public/util/immutable.h"
15 #include "sync/protocol/password_specifics.pb.h"
16 #include "sync/protocol/sync.pb.h"
18 namespace base {
19 class DictionaryValue;
20 } // namespace base
22 namespace syncer {
24 // TODO(zea): One day get passwords playing nicely with the rest of encryption
25 // and get rid of this.
26 class SYNC_EXPORT ExtraPasswordChangeRecordData {
27 public:
28 ExtraPasswordChangeRecordData();
29 explicit ExtraPasswordChangeRecordData(
30 const sync_pb::PasswordSpecificsData& data);
31 virtual ~ExtraPasswordChangeRecordData();
33 virtual scoped_ptr<base::DictionaryValue> ToValue() const;
35 const sync_pb::PasswordSpecificsData& unencrypted() const;
36 private:
37 sync_pb::PasswordSpecificsData unencrypted_;
40 // ChangeRecord indicates a single item that changed as a result of a sync
41 // operation. This gives the sync id of the node that changed, and the type
42 // of change. To get the actual property values after an ADD or UPDATE, the
43 // client should get the node with InitByIdLookup(), using the provided id.
44 struct SYNC_EXPORT_PRIVATE ChangeRecord {
45 enum Action {
46 ACTION_ADD,
47 ACTION_DELETE,
48 ACTION_UPDATE,
50 ChangeRecord();
51 ~ChangeRecord();
53 scoped_ptr<base::DictionaryValue> ToValue() const;
55 int64 id;
56 Action action;
57 sync_pb::EntitySpecifics specifics;
58 linked_ptr<ExtraPasswordChangeRecordData> extra;
61 typedef std::vector<ChangeRecord> ChangeRecordList;
63 typedef Immutable<ChangeRecordList> ImmutableChangeRecordList;
65 } // namespace syncer
67 #endif // SYNC_INTERNAL_API_PUBLIC_CHANGE_RECORD_H_