OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ENGINE_IMPL_COMMIT_UTIL_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_UTIL_H_ |
6 #define COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_UTIL_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_UTIL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "components/sync/base/extensions_activity.h" | 12 #include "components/sync/base/extensions_activity.h" |
13 #include "components/sync/base/model_type.h" | 13 #include "components/sync/base/model_type.h" |
14 #include "components/sync/base/sync_export.h" | |
15 #include "components/sync/protocol/sync.pb.h" | 14 #include "components/sync/protocol/sync.pb.h" |
16 | 15 |
17 namespace sync_pb { | 16 namespace sync_pb { |
18 class CommitMessage; | 17 class CommitMessage; |
19 class SyncEntity; | 18 class SyncEntity; |
20 } | 19 } |
21 | 20 |
22 namespace syncer { | 21 namespace syncer { |
23 | 22 |
24 namespace syncable { | 23 namespace syncable { |
25 class BaseTransaction; | 24 class BaseTransaction; |
26 class Entry; | 25 class Entry; |
27 class Id; | 26 class Id; |
28 class BaseWriteTransaction; | 27 class BaseWriteTransaction; |
29 } | 28 } |
30 | 29 |
31 namespace commit_util { | 30 namespace commit_util { |
32 | 31 |
33 // Adds bookmark extensions activity report to |message|. | 32 // Adds bookmark extensions activity report to |message|. |
34 SYNC_EXPORT void AddExtensionsActivityToMessage( | 33 void AddExtensionsActivityToMessage( |
35 ExtensionsActivity* activity, | 34 ExtensionsActivity* activity, |
36 ExtensionsActivity::Records* extensions_activity_buffer, | 35 ExtensionsActivity::Records* extensions_activity_buffer, |
37 sync_pb::CommitMessage* message); | 36 sync_pb::CommitMessage* message); |
38 | 37 |
39 // Fills the config_params field of |message|. | 38 // Fills the config_params field of |message|. |
40 SYNC_EXPORT void AddClientConfigParamsToMessage( | 39 void AddClientConfigParamsToMessage(ModelTypeSet enabled_types, |
41 ModelTypeSet enabled_types, | 40 bool cookie_jar_mismatch, |
42 bool cookie_jar_mismatch, | 41 sync_pb::CommitMessage* message); |
43 sync_pb::CommitMessage* message); | |
44 | 42 |
45 // Takes a snapshot of |meta_entry| and puts it into a protobuf suitable for use | 43 // Takes a snapshot of |meta_entry| and puts it into a protobuf suitable for use |
46 // in a commit request message. | 44 // in a commit request message. |
47 SYNC_EXPORT void BuildCommitItem(const syncable::Entry& meta_entry, | 45 void BuildCommitItem(const syncable::Entry& meta_entry, |
48 sync_pb::SyncEntity* sync_entry); | 46 sync_pb::SyncEntity* sync_entry); |
49 | 47 |
50 // Process a single commit response. Updates the entry's SERVER fields using | 48 // Process a single commit response. Updates the entry's SERVER fields using |
51 // |pb_commit_response| and |pb_committed_entry|. | 49 // |pb_commit_response| and |pb_committed_entry|. |
52 // | 50 // |
53 // The |deleted_folders| parameter is a set of IDs that represent deleted | 51 // The |deleted_folders| parameter is a set of IDs that represent deleted |
54 // folders. This function will add its entry's ID to this set if it finds | 52 // folders. This function will add its entry's ID to this set if it finds |
55 // itself processing a folder deletion. | 53 // itself processing a folder deletion. |
56 SYNC_EXPORT | |
57 sync_pb::CommitResponse::ResponseType ProcessSingleCommitResponse( | 54 sync_pb::CommitResponse::ResponseType ProcessSingleCommitResponse( |
58 syncable::BaseWriteTransaction* trans, | 55 syncable::BaseWriteTransaction* trans, |
59 const sync_pb::CommitResponse_EntryResponse& server_entry, | 56 const sync_pb::CommitResponse_EntryResponse& server_entry, |
60 const sync_pb::SyncEntity& commit_request_entry, | 57 const sync_pb::SyncEntity& commit_request_entry, |
61 int64_t metahandle, | 58 int64_t metahandle, |
62 std::set<syncable::Id>* deleted_folders); | 59 std::set<syncable::Id>* deleted_folders); |
63 | 60 |
64 } // namespace commit_util | 61 } // namespace commit_util |
65 | 62 |
66 } // namespace syncer | 63 } // namespace syncer |
67 | 64 |
68 #endif // COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_UTIL_H_ | 65 #endif // COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_UTIL_H_ |
OLD | NEW |