| 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 "chrome/browser/sync/protocol/sync_protocol_error.h" |
| 12 #include "chrome/browser/sync/syncable/blob.h" | 13 #include "chrome/browser/sync/syncable/blob.h" |
| 13 #include "chrome/browser/sync/syncable/model_type.h" | 14 #include "chrome/browser/sync/syncable/model_type.h" |
| 14 | 15 |
| 15 namespace syncable { | 16 namespace syncable { |
| 16 class Directory; | 17 class Directory; |
| 17 class Entry; | 18 class Entry; |
| 18 class ScopedDirLookup; | 19 class ScopedDirLookup; |
| 19 class SyncName; | 20 class SyncName; |
| 20 } // namespace syncable | 21 } // namespace syncable |
| 21 | 22 |
| (...skipping 13 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 SyncOperationResult 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, AddRequestBirthday); | 123 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, AddRequestBirthday); |
| 123 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); | 124 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, PostAndProcessHeaders); |
| 124 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); | 125 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); |
| 125 | 126 |
| 126 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 127 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 } // namespace browser_sync | 130 } // namespace browser_sync |
| 130 | 131 |
| 131 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 132 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
| OLD | NEW |