| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file defines the "sync API", an interface to the syncer | 5 // This file defines the "sync API", an interface to the syncer |
| 6 // backend that exposes (1) the core functionality of maintaining a consistent | 6 // backend that exposes (1) the core functionality of maintaining a consistent |
| 7 // local snapshot of a hierarchical object set; (2) a means to transactionally | 7 // local snapshot of a hierarchical object set; (2) a means to transactionally |
| 8 // access and modify those objects; (3) a means to control client/server | 8 // access and modify those objects; (3) a means to control client/server |
| 9 // synchronization tasks, namely: pushing local object modifications to a | 9 // synchronization tasks, namely: pushing local object modifications to a |
| 10 // server, pulling nonlocal object modifications from a server to this client, | 10 // server, pulling nonlocal object modifications from a server to this client, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // children of a node can be enumerated in the order of their position. | 36 // children of a node can be enumerated in the order of their position. |
| 37 | 37 |
| 38 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 38 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
| 39 #define CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 39 #define CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
| 40 | 40 |
| 41 #include <string> | 41 #include <string> |
| 42 #include <vector> | 42 #include <vector> |
| 43 | 43 |
| 44 #include "base/basictypes.h" | 44 #include "base/basictypes.h" |
| 45 #include "base/file_path.h" | 45 #include "base/file_path.h" |
| 46 #include "base/gtest_prod_util.h" |
| 46 #include "base/scoped_ptr.h" | 47 #include "base/scoped_ptr.h" |
| 47 #include "build/build_config.h" | 48 #include "build/build_config.h" |
| 48 #include "chrome/browser/google_service_auth_error.h" | 49 #include "chrome/browser/google_service_auth_error.h" |
| 49 #include "chrome/browser/sync/notification_method.h" | 50 #include "chrome/browser/sync/notification_method.h" |
| 50 #include "chrome/browser/sync/syncable/model_type.h" | 51 #include "chrome/browser/sync/syncable/model_type.h" |
| 51 #include "googleurl/src/gurl.h" | 52 #include "googleurl/src/gurl.h" |
| 52 #include "testing/gtest/include/gtest/gtest_prod.h" // for FRIEND_TEST | |
| 53 | 53 |
| 54 namespace browser_sync { | 54 namespace browser_sync { |
| 55 class ModelSafeWorkerRegistrar; | 55 class ModelSafeWorkerRegistrar; |
| 56 | 56 |
| 57 namespace sessions { | 57 namespace sessions { |
| 58 struct SyncSessionSnapshot; | 58 struct SyncSessionSnapshot; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 namespace chrome_common_net { | 62 namespace chrome_common_net { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // The server has a size limit on client tags, so we generate a fixed length | 220 // The server has a size limit on client tags, so we generate a fixed length |
| 221 // hash locally. This also ensures that ModelTypes have unique namespaces. | 221 // hash locally. This also ensures that ModelTypes have unique namespaces. |
| 222 static std::string GenerateSyncableHash(syncable::ModelType model_type, | 222 static std::string GenerateSyncableHash(syncable::ModelType model_type, |
| 223 const std::string& client_tag); | 223 const std::string& client_tag); |
| 224 | 224 |
| 225 private: | 225 private: |
| 226 // Node is meant for stack use only. | 226 // Node is meant for stack use only. |
| 227 void* operator new(size_t size); | 227 void* operator new(size_t size); |
| 228 | 228 |
| 229 friend class SyncApiTest; | 229 friend class SyncApiTest; |
| 230 FRIEND_TEST(SyncApiTest, GenerateSyncableHash); | 230 FRIEND_TEST_ALL_PREFIXES(SyncApiTest, GenerateSyncableHash); |
| 231 | 231 |
| 232 DISALLOW_COPY_AND_ASSIGN(BaseNode); | 232 DISALLOW_COPY_AND_ASSIGN(BaseNode); |
| 233 }; | 233 }; |
| 234 | 234 |
| 235 // WriteNode extends BaseNode to add mutation, and wraps | 235 // WriteNode extends BaseNode to add mutation, and wraps |
| 236 // syncable::MutableEntry. A WriteTransaction is needed to create a WriteNode. | 236 // syncable::MutableEntry. A WriteTransaction is needed to create a WriteNode. |
| 237 class WriteNode : public BaseNode { | 237 class WriteNode : public BaseNode { |
| 238 public: | 238 public: |
| 239 // Create a WriteNode using the given transaction. | 239 // Create a WriteNode using the given transaction. |
| 240 explicit WriteNode(WriteTransaction* transaction); | 240 explicit WriteNode(WriteTransaction* transaction); |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 // This allows actual HttpPostProvider subclass implementations to be | 843 // This allows actual HttpPostProvider subclass implementations to be |
| 844 // reference counted, which is useful if a particular implementation uses | 844 // reference counted, which is useful if a particular implementation uses |
| 845 // multiple threads to serve network requests. | 845 // multiple threads to serve network requests. |
| 846 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 846 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
| 847 virtual ~HttpPostProviderFactory() { } | 847 virtual ~HttpPostProviderFactory() { } |
| 848 }; | 848 }; |
| 849 | 849 |
| 850 } // namespace sync_api | 850 } // namespace sync_api |
| 851 | 851 |
| 852 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 852 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
| OLD | NEW |