Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / sync_driver / generic_change_processor_factory.h
blob5ed06a5d9b10e427b6eb655e2f49c03f4d0d08ca
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"
10 namespace syncer {
11 class AttachmentService;
12 class SyncableService;
13 class SyncMergeResult;
14 struct UserShare;
17 namespace sync_driver {
19 class DataTypeErrorHandler;
20 class GenericChangeProcessor;
21 class SyncApiComponentFactory;
23 // Because GenericChangeProcessors are created and used only from the model
24 // thread, their lifetime is strictly shorter than other components like
25 // DataTypeController, which live before / after communication with model
26 // threads begins and ends.
27 // The GCP is created "on the fly" at just the right time, on just the right
28 // thread. Given that, we use a factory to instantiate GenericChangeProcessors
29 // so that tests can choose to use a fake processor (i.e instead of injection).
30 // |sync_factory| is used to create AttachmentServicefor GenericChangeProcessor.
31 // It is not retained after CreateGenericChangeProcessor exits.
32 class GenericChangeProcessorFactory {
33 public:
34 GenericChangeProcessorFactory();
35 virtual ~GenericChangeProcessorFactory();
36 virtual scoped_ptr<GenericChangeProcessor> CreateGenericChangeProcessor(
37 syncer::UserShare* user_share,
38 DataTypeErrorHandler* error_handler,
39 const base::WeakPtr<syncer::SyncableService>& local_service,
40 const base::WeakPtr<syncer::SyncMergeResult>& merge_result,
41 SyncApiComponentFactory* sync_factory);
43 private:
44 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessorFactory);
47 } // namespace sync_driver
49 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_