Eliminate OMNIBOX_OPENED_URL notification and its last usage
[chromium-blink-merge.git] / sync / syncable / syncable_proto_util.cc
blob4f35b1930e57ac1e03bc7d84efe0e063d19e7fe1
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
3 // found in the LICENSE file.
5 #include "sync/syncable/syncable_proto_util.h"
7 #include "sync/protocol/sync.pb.h"
9 namespace syncer {
11 syncable::Id SyncableIdFromProto(const std::string& proto_string) {
12 return syncable::Id::CreateFromServerId(proto_string);
15 std::string SyncableIdToProto(const syncable::Id& syncable_id) {
16 return syncable_id.GetServerId();
19 bool IsFolder(const sync_pb::SyncEntity& entity) {
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
22 // that doing so won't break anything.
23 return ((entity.has_folder() && entity.folder()) ||
24 (entity.has_bookmarkdata() &&
25 entity.bookmarkdata().bookmark_folder()));
28 bool IsRoot(const sync_pb::SyncEntity& entity) {
29 return SyncableIdFromProto(entity.id_string()).IsRoot();
32 } // namespace syncer