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
3 // found in the LICENSE file.
5 #ifndef SYNC_ENGINE_BUILD_COMMIT_UTIL_H_
6 #define SYNC_ENGINE_BUILD_COMMIT_UTIL_H_
8 #include "sync/base/sync_export.h"
9 #include "sync/internal_api/public/base/model_type.h"
10 #include "sync/protocol/sync.pb.h"
11 #include "sync/util/extensions_activity.h"
21 class BaseTransaction
;
24 class BaseWriteTransaction
;
27 namespace commit_util
{
29 // Adds bookmark extensions activity report to |message|.
30 SYNC_EXPORT_PRIVATE
void AddExtensionsActivityToMessage(
31 ExtensionsActivity
* activity
,
32 ExtensionsActivity::Records
* extensions_activity_buffer
,
33 sync_pb::CommitMessage
* message
);
35 // Fills the config_params field of |message|.
36 SYNC_EXPORT_PRIVATE
void AddClientConfigParamsToMessage(
37 ModelTypeSet enabled_types
,
38 sync_pb::CommitMessage
* message
);
40 // Takes a snapshot of |meta_entry| and puts it into a protobuf suitable for use
41 // in a commit request message.
42 SYNC_EXPORT_PRIVATE
void BuildCommitItem(
43 const syncable::Entry
& meta_entry
,
44 sync_pb::SyncEntity
* sync_entry
);
46 // Process a single commit response. Updates the entry's SERVER fields using
47 // |pb_commit_response| and |pb_committed_entry|.
49 // The |deleted_folders| parameter is a set of IDs that represent deleted
50 // folders. This function will add its entry's ID to this set if it finds
51 // itself processing a folder deletion.
53 sync_pb::CommitResponse::ResponseType
ProcessSingleCommitResponse(
54 syncable::BaseWriteTransaction
* trans
,
55 const sync_pb::CommitResponse_EntryResponse
& server_entry
,
56 const sync_pb::SyncEntity
& commit_request_entry
,
58 std::set
<syncable::Id
>* deleted_folders
);
60 } // namespace commit_util
64 #endif // SYNC_ENGINE_BUILD_COMMIT_UTIL_H_