Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Side by Side Diff: components/sync/syncable/syncable_proto_util.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/syncable/syncable_proto_util.h" 5 #include "components/sync/syncable/syncable_proto_util.h"
6 6
7 #include "sync/protocol/sync.pb.h" 7 #include "components/sync/protocol/sync.pb.h"
8 8
9 namespace syncer { 9 namespace syncer {
10 10
11 syncable::Id SyncableIdFromProto(const std::string& proto_string) { 11 syncable::Id SyncableIdFromProto(const std::string& proto_string) {
12 return syncable::Id::CreateFromServerId(proto_string); 12 return syncable::Id::CreateFromServerId(proto_string);
13 } 13 }
14 14
15 std::string SyncableIdToProto(const syncable::Id& syncable_id) { 15 std::string SyncableIdToProto(const syncable::Id& syncable_id) {
16 return syncable_id.GetServerId(); 16 return syncable_id.GetServerId();
17 } 17 }
18 18
19 bool IsFolder(const sync_pb::SyncEntity& entity) { 19 bool IsFolder(const sync_pb::SyncEntity& entity) {
20 // TODO(sync): The checks for has_folder() and has_bookmarkdata() are likely 20 // TODO(sync): The checks for has_folder() and has_bookmarkdata() are likely
21 // no longer necessary. We should remove them if we can convince ourselves 21 // no longer necessary. We should remove them if we can convince ourselves
22 // that doing so won't break anything. 22 // that doing so won't break anything.
23 return ((entity.has_folder() && entity.folder()) || 23 return (
24 (entity.has_bookmarkdata() && 24 (entity.has_folder() && entity.folder()) ||
25 entity.bookmarkdata().bookmark_folder())); 25 (entity.has_bookmarkdata() && entity.bookmarkdata().bookmark_folder()));
26 } 26 }
27 27
28 bool IsRoot(const sync_pb::SyncEntity& entity) { 28 bool IsRoot(const sync_pb::SyncEntity& entity) {
29 return SyncableIdFromProto(entity.id_string()).IsRoot(); 29 return SyncableIdFromProto(entity.id_string()).IsRoot();
30 } 30 }
31 31
32 } // namespace syncer 32 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/syncable/syncable_proto_util.h ('k') | components/sync/syncable/syncable_read_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698