cr: Add 'gn' command
[chromium-blink-merge.git] / components / sync_driver / generic_change_processor_factory.h
blob0407eb00e37b55d57991724ae238336979572237
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_
6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_
8 #include "base/memory/weak_ptr.h"
9 #include "sync/internal_api/public/base/model_type.h"
11 namespace syncer {
12 class AttachmentService;
13 class SyncableService;
14 class SyncMergeResult;
15 struct UserShare;
18 namespace sync_driver {
20 class DataTypeErrorHandler;
21 class GenericChangeProcessor;
22 class SyncApiComponentFactory;
24 // Because GenericChangeProcessors are created and used only from the model
25 // thread, their lifetime is strictly shorter than other components like
26 // DataTypeController, which live before / after communication with model
27 // threads begins and ends.
28 // The GCP is created "on the fly" at just the right time, on just the right
29 // thread. Given that, we use a factory to instantiate GenericChangeProcessors
30 // so that tests can choose to use a fake processor (i.e instead of injection).
31 // |sync_factory| is used to create AttachmentServicefor GenericChangeProcessor.
32 // It is not retained after CreateGenericChangeProcessor exits.
33 class GenericChangeProcessorFactory {
34 public:
35 GenericChangeProcessorFactory();
36 virtual ~GenericChangeProcessorFactory();
37 virtual scoped_ptr<GenericChangeProcessor> CreateGenericChangeProcessor(
38 syncer::ModelType type,
39 syncer::UserShare* user_share,
40 DataTypeErrorHandler* error_handler,
41 const base::WeakPtr<syncer::SyncableService>& local_service,
42 const base::WeakPtr<syncer::SyncMergeResult>& merge_result,
43 SyncApiComponentFactory* sync_factory);
45 private:
46 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessorFactory);
49 } // namespace sync_driver
51 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_