1 // Copyright (c) 2010 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. 4 // 5 // Various utilities for dealing with invalidation data types. 6 7 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_INVALIDATION_UTIL_H_ 8 #define CHROME_BROWSER_SYNC_NOTIFIER_INVALIDATION_UTIL_H_ 9 #pragma once 10 11 #include <string> 12 13 #include "chrome/browser/sync/syncable/model_type.h" 14 #include "google/cacheinvalidation/invalidation-client.h" 15 16 namespace sync_notifier { 17 18 void RunAndDeleteClosure(invalidation::Closure* task); 19 20 bool RealModelTypeToObjectId(syncable::ModelType model_type, 21 invalidation::ObjectId* object_id); 22 23 bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, 24 syncable::ModelType* model_type); 25 26 // We need to write our own protobuf-to-string functions because we 27 // use LITE_RUNTIME, which doesn't support DebugString(). 28 29 std::string ObjectIdToString(const invalidation::ObjectId& object_id); 30 31 std::string ObjectIdPToString(const invalidation::ObjectIdP& object_id); 32 33 std::string StatusToString(const invalidation::Status& status); 34 35 std::string InvalidationToString( 36 const invalidation::Invalidation& invalidation); 37 38 std::string RegistrationUpdateToString( 39 const invalidation::RegistrationUpdate& update); 40 41 std::string RegistrationUpdateResultToString( 42 const invalidation::RegistrationUpdateResult& update_result); 43 44 } // namespace sync_notifier 45 46 #endif // CHROME_BROWSER_SYNC_NOTIFIER_INVALIDATION_UTIL_H_ 47