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/notifier/invalidation_util.h"
9 #include "google/cacheinvalidation/include/types.h"
10 #include "google/cacheinvalidation/v2/types.pb.h"
12 namespace sync_notifier
{
14 void RunAndDeleteClosure(invalidation::Closure
* task
) {
19 bool RealModelTypeToObjectId(syncable::ModelType model_type
,
20 invalidation::ObjectId
* object_id
) {
21 std::string notification_type
;
22 if (!syncable::RealModelTypeToNotificationType(
23 model_type
, ¬ification_type
)) {
26 object_id
->Init(ipc::invalidation::ObjectSource::CHROME_SYNC
,
31 bool ObjectIdToRealModelType(const invalidation::ObjectId
& object_id
,
32 syncable::ModelType
* model_type
) {
34 syncable::NotificationTypeToRealModelType(
35 object_id
.name(), model_type
);
38 std::string
ObjectIdToString(
39 const invalidation::ObjectId
& object_id
) {
42 ss
<< "name: " << object_id
.name() << ", ";
43 ss
<< "source: " << object_id
.source();
48 std::string
InvalidationToString(
49 const invalidation::Invalidation
& invalidation
) {
52 ss
<< "object_id: " << ObjectIdToString(invalidation
.object_id()) << ", ";
53 ss
<< "version: " << invalidation
.version();
58 } // namespace sync_notifier