2 * Copyright 2001-2007, Ingo Weinhold, bonefish@users.sf.net.
3 * Distributed under the terms of the MIT License.
9 #include "AppInfoList.h"
10 #include "RecentApps.h"
11 #include "RecentEntries.h"
12 #include "WatchingService.h"
15 #include <MessageQueue.h>
18 #include <SupportDefs.h>
25 using __gnu_cxx::hash_set
;
31 class WatchingService
;
33 typedef map
<int32
, BMessageQueue
*> IARRequestMap
;
40 void HandleAddApplication(BMessage
* request
);
41 void HandleCompleteRegistration(BMessage
* request
);
42 void HandleIsAppRegistered(BMessage
* request
);
43 void HandleRemovePreRegApp(BMessage
* request
);
44 void HandleRemoveApp(BMessage
* request
);
45 void HandleSetThreadAndTeam(BMessage
* request
);
46 void HandleSetSignature(BMessage
* request
);
47 void HandleGetAppInfo(BMessage
* request
);
48 void HandleGetAppList(BMessage
* request
);
49 void HandleUpdateActiveApp(BMessage
* request
);
50 void HandleBroadcast(BMessage
* request
);
51 void HandleStartWatching(BMessage
* request
);
52 void HandleStopWatching(BMessage
* request
);
53 void HandleGetRecentDocuments(BMessage
* request
);
54 void HandleGetRecentFolders(BMessage
* request
);
55 void HandleGetRecentApps(BMessage
* request
);
56 void HandleAddToRecentDocuments(BMessage
* request
);
57 void HandleAddToRecentFolders(BMessage
* request
);
58 void HandleAddToRecentApps(BMessage
* request
);
59 void HandleLoadRecentLists(BMessage
* request
);
60 void HandleSaveRecentLists(BMessage
* request
);
62 void HandleRestartAppServer(BMessage
* request
);
64 void ClearRecentDocuments();
65 void ClearRecentFolders();
66 void ClearRecentApps();
70 status_t
AddApp(RosterAppInfo
* info
);
71 void RemoveApp(RosterAppInfo
* info
);
72 void UpdateActiveApp(RosterAppInfo
* info
);
76 void SetShuttingDown(bool shuttingDown
);
77 status_t
GetShutdownApps(AppInfoList
& userApps
,
78 AppInfoList
& systemApps
,
79 AppInfoList
& backgroundApps
,
80 hash_set
<team_id
>& vitalSystemApps
);
82 status_t
AddWatcher(Watcher
* watcher
);
83 void RemoveWatcher(Watcher
* watcher
);
87 void _AppAdded(RosterAppInfo
* info
);
88 void _AppRemoved(RosterAppInfo
* info
);
89 void _AppActivated(RosterAppInfo
* info
);
90 void _AppDeactivated(RosterAppInfo
* info
);
93 static status_t
_AddMessageAppInfo(BMessage
* message
,
94 const app_info
* info
);
95 static status_t
_AddMessageWatchingInfo(BMessage
* message
,
96 const app_info
* info
);
99 void _AddIARRequest(IARRequestMap
& map
, int32 key
,
101 void _ReplyToIARRequests(BMessageQueue
* requests
,
102 const RosterAppInfo
* info
);
103 void _ReplyToIARRequest(BMessage
* request
,
104 const RosterAppInfo
* info
);
106 void _HandleGetRecentEntries(BMessage
* request
);
108 void _ValidateRunning(const entry_ref
& ref
,
109 const char* signature
);
110 bool _IsSystemApp(RosterAppInfo
* info
) const;
112 status_t
_LoadRosterSettings(const char* path
= NULL
);
113 status_t
_SaveRosterSettings(const char* path
= NULL
);
114 static const char* kDefaultRosterSettingsFile
;
118 AppInfoList fRegisteredApps
;
119 AppInfoList fEarlyPreRegisteredApps
;
120 IARRequestMap fIARRequestsByID
;
121 IARRequestMap fIARRequestsByToken
;
122 RosterAppInfo
* fActiveApp
;
123 WatchingService fWatchingService
;
124 RecentApps fRecentApps
;
125 RecentEntries fRecentDocuments
;
126 RecentEntries fRecentFolders
;
129 BPath fSystemAppPath
;
130 BPath fSystemServerPath
;