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 // InternalComponentsFactory exists so that tests can override creation of | 5 // InternalComponentsFactory exists so that tests can override creation of |
6 // components used by the SyncManager that are not exposed across the sync | 6 // components used by the SyncManager that are not exposed across the sync |
7 // API boundary. | 7 // API boundary. |
8 | 8 |
9 #ifndef SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ | 9 #ifndef SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ |
10 #define SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ | 10 #define SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // to grow and shrink over time with transient features / experiments, | 65 // to grow and shrink over time with transient features / experiments, |
66 // roughly following command line flags in chrome. Implementations of | 66 // roughly following command line flags in chrome. Implementations of |
67 // InternalComponentsFactory can use this information to build components | 67 // InternalComponentsFactory can use this information to build components |
68 // with appropriate bells and whistles. | 68 // with appropriate bells and whistles. |
69 struct Switches { | 69 struct Switches { |
70 EncryptionMethod encryption_method; | 70 EncryptionMethod encryption_method; |
71 BackoffOverride backoff_override; | 71 BackoffOverride backoff_override; |
72 PreCommitUpdatesPolicy pre_commit_updates_policy; | 72 PreCommitUpdatesPolicy pre_commit_updates_policy; |
73 }; | 73 }; |
74 | 74 |
| 75 // For selecting the types of storage to use to persist sync data when |
| 76 // BuildDirectoryBackingStore() is called. |
| 77 enum StorageOption { |
| 78 // BuildDirectoryBackingStore should not use persistent on-disk storage. |
| 79 STORAGE_IN_MEMORY, |
| 80 // Use this if you want BuildDirectoryBackingStore to create/use a real |
| 81 // on disk store. |
| 82 STORAGE_ON_DISK, |
| 83 // Use this to defer creating on-disk database until |
| 84 // DirectoryBackingStore::SaveChanges() is called. |
| 85 STORAGE_ON_DISK_DEFERRED, |
| 86 // Use this to test the case where a directory fails to load. |
| 87 STORAGE_INVALID |
| 88 }; |
| 89 |
75 virtual ~InternalComponentsFactory() {} | 90 virtual ~InternalComponentsFactory() {} |
76 | 91 |
77 virtual scoped_ptr<SyncScheduler> BuildScheduler( | 92 virtual scoped_ptr<SyncScheduler> BuildScheduler( |
78 const std::string& name, | 93 const std::string& name, |
79 sessions::SyncSessionContext* context, | 94 sessions::SyncSessionContext* context, |
80 CancelationSignal* cancelation_signal) = 0; | 95 CancelationSignal* cancelation_signal) = 0; |
81 | 96 |
82 virtual scoped_ptr<sessions::SyncSessionContext> BuildContext( | 97 virtual scoped_ptr<sessions::SyncSessionContext> BuildContext( |
83 ServerConnectionManager* connection_manager, | 98 ServerConnectionManager* connection_manager, |
84 syncable::Directory* directory, | 99 syncable::Directory* directory, |
85 ExtensionsActivity* extensions_activity, | 100 ExtensionsActivity* extensions_activity, |
86 const std::vector<SyncEngineEventListener*>& listeners, | 101 const std::vector<SyncEngineEventListener*>& listeners, |
87 sessions::DebugInfoGetter* debug_info_getter, | 102 sessions::DebugInfoGetter* debug_info_getter, |
88 ModelTypeRegistry* model_type_registry, | 103 ModelTypeRegistry* model_type_registry, |
89 const std::string& invalidator_client_id) = 0; | 104 const std::string& invalidator_client_id) = 0; |
90 | 105 |
91 virtual scoped_ptr<syncable::DirectoryBackingStore> | 106 virtual scoped_ptr<syncable::DirectoryBackingStore> |
92 BuildDirectoryBackingStore( | 107 BuildDirectoryBackingStore( |
| 108 StorageOption storage, |
93 const std::string& dir_name, | 109 const std::string& dir_name, |
94 const base::FilePath& backing_filepath) = 0; | 110 const base::FilePath& backing_filepath) = 0; |
95 | 111 |
96 // Returns the Switches struct that this object is using as configuration, if | 112 // Returns the Switches struct that this object is using as configuration, if |
97 // the implementation is making use of one. | 113 // the implementation is making use of one. |
98 virtual Switches GetSwitches() const = 0; | 114 virtual Switches GetSwitches() const = 0; |
99 }; | 115 }; |
100 | 116 |
101 } // namespace syncer | 117 } // namespace syncer |
102 | 118 |
103 #endif // SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ | 119 #endif // SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ |
OLD | NEW |