OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 19 matching lines...) Expand all Loading... | |
30 class SyncSessionContext; | 30 class SyncSessionContext; |
31 } | 31 } |
32 | 32 |
33 namespace syncable { | 33 namespace syncable { |
34 class Directory; | 34 class Directory; |
35 class DirectoryBackingStore; | 35 class DirectoryBackingStore; |
36 } | 36 } |
37 | 37 |
38 class InternalComponentsFactory { | 38 class InternalComponentsFactory { |
39 public: | 39 public: |
40 enum EncryptionMethod { | |
41 ENCRYPTION_LEGACY, | |
42 // Option to enable support for keystore key based encryption. | |
43 ENCRYPTION_KEYSTORE | |
44 }; | |
45 | |
46 enum BackoffOverride { | |
47 BACKOFF_NORMAL, | |
48 // Use this value for integration testing to avoid long delays / | |
49 // timing out tests. Uses kInitialBackoffShortRetrySeconds (see | |
50 // polling_constants.h) for all initial retries. | |
51 BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE | |
52 }; | |
53 | |
54 // Configuration options for internal components. This struct is expected | |
55 // to grow and shrink over time with transient features / experiments, | |
56 // roughly following command line flags in chrome. Implementations of | |
57 // InternalComponentsFactory can use this information to build components | |
58 // with appropriate bells and whistles. | |
59 struct Switches { | |
rlarocque
2012/08/14 19:54:07
I'd prefer to see this struct's members embedded d
tim (not reviewing)
2012/08/14 20:20:51
That's exactly what I wanted to avoid. In the pas
rlarocque
2012/08/14 21:13:04
I could write a long rant about why this is wrong.
| |
60 EncryptionMethod encryption_method; | |
61 BackoffOverride backoff_override; | |
62 }; | |
63 | |
40 virtual ~InternalComponentsFactory() {} | 64 virtual ~InternalComponentsFactory() {} |
41 | 65 |
42 virtual scoped_ptr<SyncScheduler> BuildScheduler( | 66 virtual scoped_ptr<SyncScheduler> BuildScheduler( |
43 const std::string& name, | 67 const std::string& name, |
44 sessions::SyncSessionContext* context) = 0; | 68 sessions::SyncSessionContext* context) = 0; |
45 | 69 |
46 virtual scoped_ptr<sessions::SyncSessionContext> BuildContext( | 70 virtual scoped_ptr<sessions::SyncSessionContext> BuildContext( |
47 ServerConnectionManager* connection_manager, | 71 ServerConnectionManager* connection_manager, |
48 syncable::Directory* directory, | 72 syncable::Directory* directory, |
49 const std::vector<ModelSafeWorker*> workers, | 73 const std::vector<ModelSafeWorker*> workers, |
50 ExtensionsActivityMonitor* monitor, | 74 ExtensionsActivityMonitor* monitor, |
51 ThrottledDataTypeTracker* throttled_data_type_tracker, | 75 ThrottledDataTypeTracker* throttled_data_type_tracker, |
52 const std::vector<SyncEngineEventListener*>& listeners, | 76 const std::vector<SyncEngineEventListener*>& listeners, |
53 sessions::DebugInfoGetter* debug_info_getter, | 77 sessions::DebugInfoGetter* debug_info_getter, |
54 TrafficRecorder* traffic_recorder, | 78 TrafficRecorder* traffic_recorder) = 0; |
55 bool keystore_encryption_enabled) = 0; | |
56 | 79 |
57 virtual scoped_ptr<syncable::DirectoryBackingStore> | 80 virtual scoped_ptr<syncable::DirectoryBackingStore> |
58 BuildDirectoryBackingStore( | 81 BuildDirectoryBackingStore( |
59 const std::string& dir_name, | 82 const std::string& dir_name, |
60 const FilePath& backing_filepath) = 0; | 83 const FilePath& backing_filepath) = 0; |
84 | |
85 // Returns the Switches struct that this object is using as configuration, if | |
86 // the implementation is making use of one. | |
87 virtual Switches GetSwitches() const = 0; | |
61 }; | 88 }; |
62 | 89 |
63 } // namespace syncer | 90 } // namespace syncer |
64 | 91 |
65 #endif // SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ | 92 #endif // SYNC_INTERNAL_API_PUBLIC_INTERNAL_COMPONENTS_FACTORY_H_ |
OLD | NEW |