OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 SYNC_API_SYNC_DATA_H_ | 5 #ifndef SYNC_API_SYNC_DATA_H_ |
6 #define SYNC_API_SYNC_DATA_H_ | 6 #define SYNC_API_SYNC_DATA_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/memory/ref_counted.h" |
14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "sync/api/attachments/attachment.h" | 17 #include "sync/api/attachments/attachment.h" |
17 #include "sync/api/attachments/attachment_service_proxy.h" | 18 #include "sync/api/attachments/attachment_service_proxy.h" |
18 #include "sync/base/sync_export.h" | 19 #include "sync/base/sync_export.h" |
19 #include "sync/internal_api/public/base/model_type.h" | 20 #include "sync/internal_api/public/base/model_type.h" |
20 #include "sync/internal_api/public/util/immutable.h" | 21 #include "sync/internal_api/public/util/immutable.h" |
21 #include "sync/internal_api/public/util/weak_handle.h" | 22 #include "sync/internal_api/public/util/weak_handle.h" |
22 | 23 |
23 namespace sync_pb { | 24 namespace sync_pb { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const std::string& sync_tag, | 58 const std::string& sync_tag, |
58 const std::string& non_unique_title, | 59 const std::string& non_unique_title, |
59 const sync_pb::EntitySpecifics& specifics); | 60 const sync_pb::EntitySpecifics& specifics); |
60 static SyncData CreateLocalDataWithAttachments( | 61 static SyncData CreateLocalDataWithAttachments( |
61 const std::string& sync_tag, | 62 const std::string& sync_tag, |
62 const std::string& non_unique_title, | 63 const std::string& non_unique_title, |
63 const sync_pb::EntitySpecifics& specifics, | 64 const sync_pb::EntitySpecifics& specifics, |
64 const AttachmentList& attachments); | 65 const AttachmentList& attachments); |
65 | 66 |
66 // Helper method for creating SyncData objects originating from the syncer. | 67 // Helper method for creating SyncData objects originating from the syncer. |
67 // | |
68 // TODO(maniscalco): Replace all calls to 3-arg CreateRemoteData with calls to | |
69 // the 5-arg version (bug 353296). | |
70 static SyncData CreateRemoteData( | 68 static SyncData CreateRemoteData( |
71 int64 id, | 69 int64 id, |
72 const sync_pb::EntitySpecifics& specifics, | 70 const sync_pb::EntitySpecifics& specifics, |
73 const base::Time& last_modified_time, | 71 const base::Time& last_modified_time, |
74 const AttachmentIdList& attachment_ids, | 72 const AttachmentIdList& attachment_ids, |
75 const syncer::AttachmentServiceProxy& attachment_service); | 73 const syncer::AttachmentServiceProxy& attachment_service); |
76 static SyncData CreateRemoteData(int64 id, | |
77 const sync_pb::EntitySpecifics& specifics, | |
78 const base::Time& last_modified_time); | |
79 | 74 |
80 // Whether this SyncData holds valid data. The only way to have a SyncData | 75 // Whether this SyncData holds valid data. The only way to have a SyncData |
81 // without valid data is to use the default constructor. | 76 // without valid data is to use the default constructor. |
82 bool IsValid() const; | 77 bool IsValid() const; |
83 | 78 |
84 // Return the datatype we're holding information about. Derived from the sync | 79 // Return the datatype we're holding information about. Derived from the sync |
85 // datatype specifics. | 80 // datatype specifics. |
86 ModelType GetDataType() const; | 81 ModelType GetDataType() const; |
87 | 82 |
88 // Return the current sync datatype specifics. | 83 // Return the current sync datatype specifics. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 }; | 203 }; |
209 | 204 |
210 // gmock printer helper. | 205 // gmock printer helper. |
211 void PrintTo(const SyncData& sync_data, std::ostream* os); | 206 void PrintTo(const SyncData& sync_data, std::ostream* os); |
212 | 207 |
213 typedef std::vector<SyncData> SyncDataList; | 208 typedef std::vector<SyncData> SyncDataList; |
214 | 209 |
215 } // namespace syncer | 210 } // namespace syncer |
216 | 211 |
217 #endif // SYNC_API_SYNC_DATA_H_ | 212 #endif // SYNC_API_SYNC_DATA_H_ |
OLD | NEW |