OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_SYNC_API_SYNC_DATA_H_ | 5 #ifndef CHROME_BROWSER_SYNC_API_SYNC_DATA_H_ |
6 #define CHROME_BROWSER_SYNC_API_SYNC_DATA_H_ | 6 #define CHROME_BROWSER_SYNC_API_SYNC_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <iosfwd> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "chrome/browser/sync/syncable/model_type.h" | 14 #include "chrome/browser/sync/syncable/model_type.h" |
14 #include "chrome/browser/sync/util/immutable.h" | 15 #include "chrome/browser/sync/util/immutable.h" |
15 | 16 |
16 namespace sync_pb { | 17 namespace sync_pb { |
17 class EntitySpecifics; | 18 class EntitySpecifics; |
18 class SyncEntity; | 19 class SyncEntity; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Returns the non unique title (for debugging). Currently only set for data | 69 // Returns the non unique title (for debugging). Currently only set for data |
69 // going TO the syncer, not from. | 70 // going TO the syncer, not from. |
70 const std::string& GetTitle() const; | 71 const std::string& GetTitle() const; |
71 | 72 |
72 // Should only be called by sync code when IsLocal() is false. | 73 // Should only be called by sync code when IsLocal() is false. |
73 int64 GetRemoteId() const; | 74 int64 GetRemoteId() const; |
74 | 75 |
75 // Whether this sync data is for local data or data coming from the syncer. | 76 // Whether this sync data is for local data or data coming from the syncer. |
76 bool IsLocal() const; | 77 bool IsLocal() const; |
77 | 78 |
| 79 std::string ToString() const; |
| 80 |
78 // TODO(zea): Query methods for other sync properties: parent, successor, etc. | 81 // TODO(zea): Query methods for other sync properties: parent, successor, etc. |
79 | 82 |
80 private: | 83 private: |
81 // Necessary since we forward-declare sync_pb::SyncEntity; see | 84 // Necessary since we forward-declare sync_pb::SyncEntity; see |
82 // comments in immutable.h. | 85 // comments in immutable.h. |
83 struct ImmutableSyncEntityTraits { | 86 struct ImmutableSyncEntityTraits { |
84 typedef sync_pb::SyncEntity* Wrapper; | 87 typedef sync_pb::SyncEntity* Wrapper; |
85 | 88 |
86 static void InitializeWrapper(Wrapper* wrapper); | 89 static void InitializeWrapper(Wrapper* wrapper); |
87 | 90 |
(...skipping 16 matching lines...) Expand all Loading... |
104 // Whether this SyncData holds valid data. | 107 // Whether this SyncData holds valid data. |
105 bool is_valid_; | 108 bool is_valid_; |
106 | 109 |
107 // Equal to sync_api::kInvalidId iff this is local. | 110 // Equal to sync_api::kInvalidId iff this is local. |
108 int64 id_; | 111 int64 id_; |
109 | 112 |
110 // The actual shared sync entity being held. | 113 // The actual shared sync entity being held. |
111 ImmutableSyncEntity immutable_entity_; | 114 ImmutableSyncEntity immutable_entity_; |
112 }; | 115 }; |
113 | 116 |
| 117 // gmock printer helper. |
| 118 void PrintTo(const SyncData& sync_data, std::ostream* os); |
| 119 |
114 #endif // CHROME_BROWSER_SYNC_API_SYNC_DATA_H_ | 120 #endif // CHROME_BROWSER_SYNC_API_SYNC_DATA_H_ |
OLD | NEW |