| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| 6 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 6 #define CHROME_BROWSER_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 "chrome/browser/sync/sessions/sync_session.h" | 13 #include "chrome/browser/sync/sessions/sync_session.h" |
| 14 #include "chrome/browser/sync/engine/syncer_error.h" |
| 14 #include "chrome/browser/sync/syncable/blob.h" | 15 #include "chrome/browser/sync/syncable/blob.h" |
| 15 #include "chrome/browser/sync/syncable/model_type.h" | 16 #include "chrome/browser/sync/syncable/model_type.h" |
| 16 | 17 |
| 17 namespace syncable { | 18 namespace syncable { |
| 18 class Directory; | 19 class Directory; |
| 19 class Entry; | 20 class Entry; |
| 20 } // namespace syncable | 21 } // namespace syncable |
| 21 | 22 |
| 22 namespace sync_pb { | 23 namespace sync_pb { |
| 23 class ClientToServerResponse; | 24 class ClientToServerResponse; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 class ServerConnectionManager; | 36 class ServerConnectionManager; |
| 36 class SyncEntity; | 37 class SyncEntity; |
| 37 class CommitResponse_EntryResponse; | 38 class CommitResponse_EntryResponse; |
| 38 | 39 |
| 39 class SyncerProtoUtil { | 40 class SyncerProtoUtil { |
| 40 public: | 41 public: |
| 41 // 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. |
| 42 // Returns true on success. Also handles store birthday verification: | 43 // Returns true on success. Also handles store birthday verification: |
| 43 // session->status()->syncer_stuck_ is set true if the birthday is | 44 // session->status()->syncer_stuck_ is set true if the birthday is |
| 44 // incorrect. A false value will always be returned if birthday is bad. | 45 // incorrect. A false value will always be returned if birthday is bad. |
| 45 static bool PostClientToServerMessage( | 46 static SyncerError PostClientToServerMessage( |
| 46 const ClientToServerMessage& msg, | 47 const ClientToServerMessage& msg, |
| 47 sync_pb::ClientToServerResponse* response, | 48 sync_pb::ClientToServerResponse* response, |
| 48 sessions::SyncSession* session); | 49 sessions::SyncSession* session); |
| 49 | 50 |
| 50 // Compares a syncable Entry to SyncEntity, returns true iff the data is | 51 // Compares a syncable Entry to SyncEntity, returns true iff the data is |
| 51 // identical. | 52 // identical. |
| 52 // | 53 // |
| 53 // TODO(sync): The places where this function is used are arguable big causes | 54 // 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 | 55 // of the fragility, because there's a tendency to freak out the moment the |
| 55 // local and server values diverge. However, this almost always indicates a | 56 // local and server values diverge. However, this almost always indicates a |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); | 130 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); |
| 130 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); | 131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); |
| 131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); | 132 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); |
| 132 | 133 |
| 133 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 134 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 } // namespace browser_sync | 137 } // namespace browser_sync |
| 137 | 138 |
| 138 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 139 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| OLD | NEW |