xref: /haiku/src/apps/haikudepot/process/ProcessCoordinatorFactory.h (revision dd2a1e350b303b855a50fd64e6cb55618be1ae6a)
1 /*
2  * Copyright 2018-2023, 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 #include "PackageScreenshotRepository.h"
12 
13 class Model;
14 class PackageInfoListener;
15 class ProcessCoordinator;
16 class ProcessCoordinatorListener;
17 class UserDetailVerifierListener;
18 
19 /*! This class is able to create ProcessCoordinators that are loaded-up with
20     Processes that together complete some larger job.
21 */
22 
23 class ProcessCoordinatorFactory {
24 public:
25 	static	ProcessCoordinator*	CreateIncrementViewCounter(Model* model,
26 									const PackageInfoRef package);
27 
28 	static	ProcessCoordinator*	CreateBulkLoadCoordinator(
29 									PackageInfoListenerRef packageInfoListener,
30 									Model* model, bool forceLocalUpdate);
31 
32 	static	ProcessCoordinator*	CreateUserDetailVerifierCoordinator(
33 									UserDetailVerifierListener*
34 										userDetailVerifierListener,
35 									Model* model);
36 
37 	static	ProcessCoordinator*	CreatePackageActionCoordinator(
38 									Model* model, BMessage* message);
39 
40 	static	ProcessCoordinator*	CacheScreenshotCoordinator(
41 									Model* model, ScreenshotCoordinate& screenshotCoordinate);
42 
43 private:
44 	static	uint32				_CalculateServerProcessOptions();
45 
46 	static	PackageInfoRef		_ExtractPackageFromMessage(
47 									Model* model, BMessage* message);
48 
49 	static	ProcessCoordinator*	_CreateInstallPackageActionCoordinator(
50 									Model* model, BMessage* message);
51 
52 	static	ProcessCoordinator*	_CreateUninstallPackageActionCoordinator(
53 									Model* model, BMessage* message);
54 
55 	static	ProcessCoordinator*	_CreateOpenPackageActionCoordinator(
56 									Model* model, BMessage* message);
57 
58 };
59 
60 #endif // PROCESS_COORDINATOR_FACTORY_H
61