| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "sync/internal_api/public/syncable/model_type.h" | 13 #include "sync/internal_api/public/syncable/model_type.h" |
| 14 #include "sync/internal_api/public/util/syncer_error.h" | 14 #include "sync/internal_api/public/util/syncer_error.h" |
| 15 #include "sync/sessions/sync_session.h" | 15 #include "sync/sessions/sync_session.h" |
| 16 #include "sync/syncable/blob.h" | 16 #include "sync/syncable/blob.h" |
| 17 | 17 |
| 18 namespace syncable { | 18 namespace syncable { |
| 19 class Directory; | 19 class Directory; |
| 20 class Entry; | 20 class Entry; |
| 21 } // namespace syncable | 21 } // namespace syncable |
| 22 | 22 |
| 23 namespace sync_pb { | 23 namespace sync_pb { |
| 24 class ClientToServerResponse; | 24 class ClientToServerResponse; |
| 25 class EntitySpecifics; | 25 class EntitySpecifics; |
| 26 } // namespace sync_pb | 26 } // namespace sync_pb |
| 27 | 27 |
| 28 namespace csync { | 28 namespace syncer { |
| 29 | 29 |
| 30 namespace sessions { | 30 namespace sessions { |
| 31 class SyncProtocolError; | 31 class SyncProtocolError; |
| 32 class SyncSessionContext; | 32 class SyncSessionContext; |
| 33 } | 33 } |
| 34 | 34 |
| 35 class ClientToServerMessage; | 35 class ClientToServerMessage; |
| 36 class ThrottledDataTypeTracker; | 36 class ThrottledDataTypeTracker; |
| 37 class ServerConnectionManager; | 37 class ServerConnectionManager; |
| 38 class SyncEntity; | 38 class SyncEntity; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 const sync_pb::ClientToServerResponse* response); | 104 const sync_pb::ClientToServerResponse* response); |
| 105 | 105 |
| 106 // Builds and sends a SyncEngineEvent to begin migration for types (specified | 106 // Builds and sends a SyncEngineEvent to begin migration for types (specified |
| 107 // in notification). | 107 // in notification). |
| 108 static void HandleMigrationDoneResponse( | 108 static void HandleMigrationDoneResponse( |
| 109 const sync_pb::ClientToServerResponse* response, | 109 const sync_pb::ClientToServerResponse* response, |
| 110 sessions::SyncSession* session); | 110 sessions::SyncSession* session); |
| 111 | 111 |
| 112 // Post the message using the scm, and do some processing on the returned | 112 // Post the message using the scm, and do some processing on the returned |
| 113 // headers. Decode the server response. | 113 // headers. Decode the server response. |
| 114 static bool PostAndProcessHeaders(csync::ServerConnectionManager* scm, | 114 static bool PostAndProcessHeaders(syncer::ServerConnectionManager* scm, |
| 115 sessions::SyncSession* session, | 115 sessions::SyncSession* session, |
| 116 const ClientToServerMessage& msg, | 116 const ClientToServerMessage& msg, |
| 117 sync_pb::ClientToServerResponse* response); | 117 sync_pb::ClientToServerResponse* response); |
| 118 | 118 |
| 119 static base::TimeDelta GetThrottleDelay( | 119 static base::TimeDelta GetThrottleDelay( |
| 120 const sync_pb::ClientToServerResponse& response); | 120 const sync_pb::ClientToServerResponse& response); |
| 121 | 121 |
| 122 static void HandleThrottleError( | 122 static void HandleThrottleError( |
| 123 const SyncProtocolError& error, | 123 const SyncProtocolError& error, |
| 124 const base::TimeTicks& throttled_until, | 124 const base::TimeTicks& throttled_until, |
| 125 csync::ThrottledDataTypeTracker* tracker, | 125 syncer::ThrottledDataTypeTracker* tracker, |
| 126 sessions::SyncSession::Delegate* delegate); | 126 sessions::SyncSession::Delegate* delegate); |
| 127 | 127 |
| 128 friend class SyncerProtoUtilTest; | 128 friend class SyncerProtoUtilTest; |
| 129 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, AddRequestBirthday); | 129 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, AddRequestBirthday); |
| 130 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); | 130 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); |
| 131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); | 131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); |
| 132 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); | 132 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); |
| 133 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); | 133 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 135 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace csync | 138 } // namespace syncer |
| 139 | 139 |
| 140 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 140 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| OLD | NEW |