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 #include "sync/engine/commit_util.h" | 5 #include "sync/engine/commit_util.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const syncable::Entry& meta_entry, | 98 const syncable::Entry& meta_entry, |
99 sync_pb::SyncEntity* sync_entry) { | 99 sync_pb::SyncEntity* sync_entry) { |
100 syncable::Id id = meta_entry.GetId(); | 100 syncable::Id id = meta_entry.GetId(); |
101 sync_entry->set_id_string(SyncableIdToProto(id)); | 101 sync_entry->set_id_string(SyncableIdToProto(id)); |
102 | 102 |
103 string name = meta_entry.GetNonUniqueName(); | 103 string name = meta_entry.GetNonUniqueName(); |
104 CHECK(!name.empty()); // Make sure this isn't an update. | 104 CHECK(!name.empty()); // Make sure this isn't an update. |
105 // Note: Truncation is also performed in WriteNode::SetTitle(..). But this | 105 // Note: Truncation is also performed in WriteNode::SetTitle(..). But this |
106 // call is still necessary to handle any title changes that might originate | 106 // call is still necessary to handle any title changes that might originate |
107 // elsewhere, or already be persisted in the directory. | 107 // elsewhere, or already be persisted in the directory. |
108 TruncateUTF8ToByteSize(name, 255, &name); | 108 base::TruncateUTF8ToByteSize(name, 255, &name); |
109 sync_entry->set_name(name); | 109 sync_entry->set_name(name); |
110 | 110 |
111 // Set the non_unique_name. If we do, the server ignores | 111 // Set the non_unique_name. If we do, the server ignores |
112 // the |name| value (using |non_unique_name| instead), and will return | 112 // the |name| value (using |non_unique_name| instead), and will return |
113 // in the CommitResponse a unique name if one is generated. | 113 // in the CommitResponse a unique name if one is generated. |
114 // We send both because it may aid in logging. | 114 // We send both because it may aid in logging. |
115 sync_entry->set_non_unique_name(name); | 115 sync_entry->set_non_unique_name(name); |
116 | 116 |
117 if (!meta_entry.GetUniqueClientTag().empty()) { | 117 if (!meta_entry.GetUniqueClientTag().empty()) { |
118 sync_entry->set_client_defined_unique_tag( | 118 sync_entry->set_client_defined_unique_tag( |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 | 432 |
433 ProcessSuccessfulCommitResponse(commit_request_entry, server_entry, | 433 ProcessSuccessfulCommitResponse(commit_request_entry, server_entry, |
434 local_entry.GetId(), &local_entry, syncing_was_set, deleted_folders); | 434 local_entry.GetId(), &local_entry, syncing_was_set, deleted_folders); |
435 return response; | 435 return response; |
436 } | 436 } |
437 | 437 |
438 } // namespace commit_util | 438 } // namespace commit_util |
439 | 439 |
440 } // namespace syncer | 440 } // namespace syncer |
OLD | NEW |