| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 namespace syncable { | 35 namespace syncable { |
| 36 class Directory; | 36 class Directory; |
| 37 class Entry; | 37 class Entry; |
| 38 } | 38 } |
| 39 | 39 |
| 40 class SyncerProtoUtil { | 40 class SyncerProtoUtil { |
| 41 public: | 41 public: |
| 42 // Posts the given message and fills the buffer with the returned value. | 42 // Posts the given message and fills the buffer with the returned value. |
| 43 // Returns true on success. Also handles store birthday verification: will | 43 // Returns true on success. Also handles store birthday verification: will |
| 44 // produce a SyncError if the birthday is incorrect. | 44 // produce a SyncError if the birthday is incorrect. |
| 45 // NOTE: This will add all fields that must be sent on every request, which |
| 46 // includes store birthday, protocol version, client chips, api keys, etc. |
| 45 static SyncerError PostClientToServerMessage( | 47 static SyncerError PostClientToServerMessage( |
| 46 sync_pb::ClientToServerMessage* msg, | 48 sync_pb::ClientToServerMessage* msg, |
| 47 sync_pb::ClientToServerResponse* response, | 49 sync_pb::ClientToServerResponse* response, |
| 48 sessions::SyncSession* session); | 50 sessions::SyncSession* session); |
| 49 | 51 |
| 50 // Compares a syncable Entry to SyncEntity, returns true iff the data is | 52 // Compares a syncable Entry to SyncEntity, returns true iff the data is |
| 51 // identical. | 53 // identical. |
| 52 // | 54 // |
| 53 // TODO(sync): The places where this function is used are arguable big causes | 55 // TODO(sync): The places where this function is used are arguable big causes |
| 54 // of the fragility, because there's a tendency to freak out the moment the | 56 // of the fragility, because there's a tendency to freak out the moment the |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); | 145 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); |
| 144 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); | 146 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); |
| 145 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); | 147 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); |
| 146 | 148 |
| 147 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 149 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
| 148 }; | 150 }; |
| 149 | 151 |
| 150 } // namespace syncer | 152 } // namespace syncer |
| 151 | 153 |
| 152 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 154 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| OLD | NEW |