OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "sync/engine/syncer_proto_util.h" | 5 #include "sync/engine/syncer_proto_util.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "google_apis/google_api_keys.h" | 9 #include "google_apis/google_api_keys.h" |
10 #include "sync/engine/net/server_connection_manager.h" | 10 #include "sync/engine/net/server_connection_manager.h" |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 bool SyncerProtoUtil::ShouldMaintainPosition( | 527 bool SyncerProtoUtil::ShouldMaintainPosition( |
528 const sync_pb::SyncEntity& sync_entity) { | 528 const sync_pb::SyncEntity& sync_entity) { |
529 // Maintain positions for bookmarks that are not server-defined top-level | 529 // Maintain positions for bookmarks that are not server-defined top-level |
530 // folders. | 530 // folders. |
531 return GetModelType(sync_entity) == BOOKMARKS | 531 return GetModelType(sync_entity) == BOOKMARKS |
532 && !(sync_entity.folder() && | 532 && !(sync_entity.folder() && |
533 !sync_entity.server_defined_unique_tag().empty()); | 533 !sync_entity.server_defined_unique_tag().empty()); |
534 } | 534 } |
535 | 535 |
536 // static | 536 // static |
537 bool SyncerProtoUtil::ShouldMaintainHierarchy( | |
538 const sync_pb::SyncEntity& sync_entity) { | |
539 // Maintain hierarchy for bookmarks or top-level items. | |
540 return GetModelType(sync_entity) == BOOKMARKS || | |
541 sync_entity.parent_id_string() == "0"; | |
Nicolas Zea
2015/07/29 17:58:09
nit: why check parent id string rather than model
stanisc
2015/07/29 21:37:07
This is for compatibility with some tests that cre
| |
542 } | |
543 | |
544 // static | |
537 const std::string& SyncerProtoUtil::NameFromSyncEntity( | 545 const std::string& SyncerProtoUtil::NameFromSyncEntity( |
538 const sync_pb::SyncEntity& entry) { | 546 const sync_pb::SyncEntity& entry) { |
539 if (entry.has_non_unique_name()) | 547 if (entry.has_non_unique_name()) |
540 return entry.non_unique_name(); | 548 return entry.non_unique_name(); |
541 return entry.name(); | 549 return entry.name(); |
542 } | 550 } |
543 | 551 |
544 // static | 552 // static |
545 const std::string& SyncerProtoUtil::NameFromCommitEntryResponse( | 553 const std::string& SyncerProtoUtil::NameFromCommitEntryResponse( |
546 const sync_pb::CommitResponse_EntryResponse& entry) { | 554 const sync_pb::CommitResponse_EntryResponse& entry) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
597 std::string SyncerProtoUtil::ClientToServerResponseDebugString( | 605 std::string SyncerProtoUtil::ClientToServerResponseDebugString( |
598 const ClientToServerResponse& response) { | 606 const ClientToServerResponse& response) { |
599 // Add more handlers as needed. | 607 // Add more handlers as needed. |
600 std::string output; | 608 std::string output; |
601 if (response.has_get_updates()) | 609 if (response.has_get_updates()) |
602 output.append(GetUpdatesResponseString(response.get_updates())); | 610 output.append(GetUpdatesResponseString(response.get_updates())); |
603 return output; | 611 return output; |
604 } | 612 } |
605 | 613 |
606 } // namespace syncer | 614 } // namespace syncer |
OLD | NEW |