| 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 COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_PROTO_UTIL_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_PROTO_UTIL_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_PROTO_UTIL_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_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/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/sync/base/model_type.h" | 13 #include "components/sync/base/model_type.h" |
| 14 #include "components/sync/base/sync_export.h" | |
| 15 #include "components/sync/base/syncer_error.h" | 14 #include "components/sync/base/syncer_error.h" |
| 16 #include "components/sync/sessions_impl/sync_session.h" | 15 #include "components/sync/sessions_impl/sync_session.h" |
| 17 | 16 |
| 18 namespace sync_pb { | 17 namespace sync_pb { |
| 19 class ClientToServerMessage; | 18 class ClientToServerMessage; |
| 20 class ClientToServerResponse; | 19 class ClientToServerResponse; |
| 21 class ClientToServerResponse_Error; | 20 class ClientToServerResponse_Error; |
| 22 class CommitResponse_EntryResponse; | 21 class CommitResponse_EntryResponse; |
| 23 class EntitySpecifics; | 22 class EntitySpecifics; |
| 24 class SyncEntity; | 23 class SyncEntity; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace syncer { | 26 namespace syncer { |
| 28 | 27 |
| 29 class ServerConnectionManager; | 28 class ServerConnectionManager; |
| 30 | 29 |
| 31 namespace sessions { | 30 namespace sessions { |
| 32 class SyncProtocolError; | 31 class SyncProtocolError; |
| 33 class SyncSessionContext; | 32 class SyncSessionContext; |
| 34 } | 33 } |
| 35 | 34 |
| 36 namespace syncable { | 35 namespace syncable { |
| 37 class Directory; | 36 class Directory; |
| 38 class Entry; | 37 class Entry; |
| 39 } | 38 } |
| 40 | 39 |
| 41 // Returns the types to migrate from the data in |response|. | 40 // Returns the types to migrate from the data in |response|. |
| 42 SYNC_EXPORT ModelTypeSet | 41 ModelTypeSet GetTypesToMigrate(const sync_pb::ClientToServerResponse& response); |
| 43 GetTypesToMigrate(const sync_pb::ClientToServerResponse& response); | |
| 44 | 42 |
| 45 // Builds a SyncProtocolError from the data in |error|. | 43 // Builds a SyncProtocolError from the data in |error|. |
| 46 SYNC_EXPORT SyncProtocolError ConvertErrorPBToSyncProtocolError( | 44 SyncProtocolError ConvertErrorPBToSyncProtocolError( |
| 47 const sync_pb::ClientToServerResponse_Error& error); | 45 const sync_pb::ClientToServerResponse_Error& error); |
| 48 | 46 |
| 49 class SYNC_EXPORT SyncerProtoUtil { | 47 class SyncerProtoUtil { |
| 50 public: | 48 public: |
| 51 // Posts the given message and fills the buffer with the returned value. | 49 // Posts the given message and fills the buffer with the returned value. |
| 52 // Returns true on success. Also handles store birthday verification: will | 50 // Returns true on success. Also handles store birthday verification: will |
| 53 // produce a SyncError if the birthday is incorrect. | 51 // produce a SyncError if the birthday is incorrect. |
| 54 // NOTE: This will add all fields that must be sent on every request, which | 52 // NOTE: This will add all fields that must be sent on every request, which |
| 55 // includes store birthday, protocol version, client chips, api keys, etc. | 53 // includes store birthday, protocol version, client chips, api keys, etc. |
| 56 static SyncerError PostClientToServerMessage( | 54 static SyncerError PostClientToServerMessage( |
| 57 sync_pb::ClientToServerMessage* msg, | 55 sync_pb::ClientToServerMessage* msg, |
| 58 sync_pb::ClientToServerResponse* response, | 56 sync_pb::ClientToServerResponse* response, |
| 59 sessions::SyncSession* session, | 57 sessions::SyncSession* session, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); | 142 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); |
| 145 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); | 143 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); |
| 146 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); | 144 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); |
| 147 | 145 |
| 148 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 146 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
| 149 }; | 147 }; |
| 150 | 148 |
| 151 } // namespace syncer | 149 } // namespace syncer |
| 152 | 150 |
| 153 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_PROTO_UTIL_H_ | 151 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_PROTO_UTIL_H_ |
| OLD | NEW |