xref: /haiku/src/apps/haikudepot/process/ProcessCoordinatorFactory.h (revision 4a55cc230cf7566cadcbb23b1928eefff8aea9a2)
1 /*
2  * Copyright 2018-2022, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef PROCESS_COORDINATOR_FACTORY_H
6 #define PROCESS_COORDINATOR_FACTORY_H
7 
8 #include <SupportDefs.h>
9 
10 #include "PackageInfo.h"
11 
12 class Model;
13 class PackageInfoListener;
14 class ProcessCoordinator;
15 class ProcessCoordinatorListener;
16 class UserDetailVerifierListener;
17 
18 /*! This class is able to create ProcessCoordinators that are loaded-up with
19     Processes that together complete some larger job.
20 */
21 
22 class ProcessCoordinatorFactory {
23 public:
24 	static	ProcessCoordinator*	CreateIncrementViewCounter(Model* model,
25 									const PackageInfoRef package);
26 
27 	static	ProcessCoordinator*	CreateBulkLoadCoordinator(
28 									PackageInfoListenerRef packageInfoListener,
29 									Model* model, bool forceLocalUpdate);
30 
31 	static	ProcessCoordinator*	CreateUserDetailVerifierCoordinator(
32 									UserDetailVerifierListener*
33 										userDetailVerifierListener,
34 									Model* model);
35 
36 	static	ProcessCoordinator*	CreatePackageActionCoordinator(
37 									Model* model, BMessage* message);
38 
39 private:
40 	static	uint32				_CalculateServerProcessOptions();
41 
42 	static	PackageInfoRef		_ExtractPackageFromMessage(
43 									Model* model, BMessage* message);
44 
45 	static	ProcessCoordinator*	_CreateInstallPackageActionCoordinator(
46 									Model* model, BMessage* message);
47 
48 	static	ProcessCoordinator*	_CreateUninstallPackageActionCoordinator(
49 									Model* model, BMessage* message);
50 
51 	static	ProcessCoordinator*	_CreateOpenPackageActionCoordinator(
52 									Model* model, BMessage* message);
53 
54 };
55 
56 #endif // PROCESS_COORDINATOR_FACTORY_H
57