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 | |
90 virtual ~InternalComponentsFactory() {} | 75 virtual ~InternalComponentsFactory() {} |
91 | 76 |
92 virtual scoped_ptr<SyncScheduler> BuildScheduler( | 77 virtual scoped_ptr<SyncScheduler> BuildScheduler( |
93 const std::string& name, | 78 const std::string& name, |
94 sessions::SyncSessionContext* context, | 79 sessions::SyncSessionContext* context, |
95 CancelationSignal* cancelation_signal) = 0; | 80 CancelationSignal* cancelation_signal) = 0; |
96 | 81 |
97 virtual scoped_ptr<sessions::SyncSessionContext> BuildContext( | 82 virtual scoped_ptr<sessions::SyncSessionContext> BuildContext( |
98 ServerConnectionManager* connection_manager, | 83 ServerConnectionManager* connection_manager, |
99 syncable::Directory* directory, | 84 syncable::Directory* directory, |
100 ExtensionsActivity* extensions_activity, | 85 ExtensionsActivity* extensions_activity, |
101 const std::vector<SyncEngineEventListener*>& listeners, | 86 const std::vector<SyncEngineEventListener*>& listeners, |
102 sessions::DebugInfoGetter* debug_info_getter, | 87 sessions::DebugInfoGetter* debug_info_getter, |
103 ModelTypeRegistry* model_type_registry, | 88 ModelTypeRegistry* model_type_registry, |
104 const std::string& invalidator_client_id) = 0; | 89 const std::string& invalidator_client_id) = 0; |
105 | 90 |
106 virtual scoped_ptr<syncable::DirectoryBackingStore> | 91 virtual scoped_ptr<syncable::DirectoryBackingStore> |
107 BuildDirectoryBackingStore( | 92 BuildDirectoryBackingStore( |
108 StorageOption storage, | |
109 const std::string& dir_name, | 93 const std::string& dir_name, |
110 const base::FilePath& backing_filepath) = 0; | 94 const base::FilePath& backing_filepath) = 0; |
111 | 95 |
112 // Returns the Switches struct that this object is using as configuration, if | 96 // Returns the Switches struct that this object is using as configuration, if |
113 // the implementation is making use of one. | 97 // the implementation is making use of one. |
114 virtual Switches GetSwitches() const = 0; | 98 virtual Switches GetSwitches() const = 0; |
115 }; | 99 }; |
116 | 100 |
117 } // namespace syncer | 101 } // namespace syncer |
118 | 102 |
119 #endif // SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ | 103 #endif // SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ |
OLD | NEW |