ExtensionSyncService: Properly differentiate between "pending install" and "pending...
[chromium-blink-merge.git] / components / invalidation / public / invalidation_util.h
blob857bad6e12ee71a75b54895ae2b292460a5aac9a
1 // Copyright 2014 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.
7 #ifndef COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_
8 #define COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_
10 #include <map>
11 #include <set>
12 #include <string>
14 #include "base/memory/scoped_ptr.h"
15 #include "components/invalidation/public/invalidation_export.h"
17 namespace base {
18 class DictionaryValue;
19 } // namespace
21 namespace invalidation {
22 class Invalidation;
23 class ObjectId;
24 } // namespace invalidation
26 namespace syncer {
28 class Invalidation;
30 struct INVALIDATION_EXPORT ObjectIdLessThan {
31 bool operator()(const invalidation::ObjectId& lhs,
32 const invalidation::ObjectId& rhs) const;
35 struct INVALIDATION_EXPORT InvalidationVersionLessThan {
36 bool operator()(const syncer::Invalidation& a,
37 const syncer::Invalidation& b) const;
40 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet;
42 typedef std::map<invalidation::ObjectId, int, ObjectIdLessThan>
43 ObjectIdCountMap;
45 // Caller owns the returned DictionaryValue.
46 scoped_ptr<base::DictionaryValue> ObjectIdToValue(
47 const invalidation::ObjectId& object_id);
49 bool ObjectIdFromValue(const base::DictionaryValue& value,
50 invalidation::ObjectId* out);
52 INVALIDATION_EXPORT std::string ObjectIdToString(
53 const invalidation::ObjectId& object_id);
55 } // namespace syncer
57 #endif // COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_