OLD | NEW |
1 // Copyright (c) 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_ENGINE_SYNCER_PROTO_UTIL_H_ | 5 #ifndef SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
6 #define SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 6 #define SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
(...skipping 28 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 // Returns the types to migrate from the data in |response|. | 42 // Returns the types to migrate from the data in |response|. |
43 SYNC_EXPORT_PRIVATE ModelTypeSet GetTypesToMigrate( | 43 SYNC_EXPORT_PRIVATE ModelTypeSet GetTypesToMigrate( |
44 const sync_pb::ClientToServerResponse& response); | 44 const sync_pb::ClientToServerResponse& response); |
45 | 45 |
46 // Builds a SyncProtocolError from the data in |error|. | 46 // Builds a SyncProtocolError from the data in |error|. |
47 SYNC_EXPORT_PRIVATE SyncProtocolError ConvertErrorPBToLocalType( | 47 SYNC_EXPORT_PRIVATE SyncProtocolError ConvertErrorPBToLocalType( |
48 const sync_pb::ClientToServerResponse_Error& error); | 48 const sync_pb::ClientToServerResponse_Error& error); |
49 | 49 |
50 class SyncerProtoUtil { | 50 class SYNC_EXPORT_PRIVATE SyncerProtoUtil { |
51 public: | 51 public: |
52 // Posts the given message and fills the buffer with the returned value. | 52 // Posts the given message and fills the buffer with the returned value. |
53 // Returns true on success. Also handles store birthday verification: will | 53 // Returns true on success. Also handles store birthday verification: will |
54 // produce a SyncError if the birthday is incorrect. | 54 // produce a SyncError if the birthday is incorrect. |
55 // NOTE: This will add all fields that must be sent on every request, which | 55 // NOTE: This will add all fields that must be sent on every request, which |
56 // includes store birthday, protocol version, client chips, api keys, etc. | 56 // includes store birthday, protocol version, client chips, api keys, etc. |
57 static SyncerError PostClientToServerMessage( | 57 static SyncerError PostClientToServerMessage( |
58 sync_pb::ClientToServerMessage* msg, | 58 sync_pb::ClientToServerMessage* msg, |
59 sync_pb::ClientToServerResponse* response, | 59 sync_pb::ClientToServerResponse* response, |
60 sessions::SyncSession* session); | 60 sessions::SyncSession* session); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); | 150 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); |
151 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); | 151 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); |
152 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); | 152 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); |
153 | 153 |
154 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 154 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
155 }; | 155 }; |
156 | 156 |
157 } // namespace syncer | 157 } // namespace syncer |
158 | 158 |
159 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 159 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
OLD | NEW |