6229c73b779b3ad3fd11fbe530ab8a42f4515a45
[platform/core/api/webapi-plugins.git] / src / application / application_manager.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16
17 #ifndef SRC_APPLICATION_APPLICATION_MANAGER_H__
18 #define SRC_APPLICATION_APPLICATION_MANAGER_H__
19
20 #include <string>
21 #include <memory>
22
23 #include <package-manager.h>
24 #include <string>
25 #include <pkgmgr-info.h>
26
27 #include "common/picojson.h"
28 #include "common/platform_result.h"
29
30 namespace extension {
31 namespace application {
32
33 class ApplicationInstance;
34
35 class ApplicationManager {
36  public:
37   explicit ApplicationManager(ApplicationInstance& instance);
38   ~ApplicationManager();
39
40   void GetCurrentApplication(const std::string& app_id, picojson::object* out);
41   void Kill(const picojson::value& args);
42   void Launch(const picojson::value& args);
43   void LaunchAppControl(const picojson::value& args);
44   void FindAppControl(const picojson::value& args);
45   void GetAppsContext(const picojson::value& args);
46   void GetAppContext(const picojson::value& args, picojson::object* out);
47   void GetAppsInfo(const picojson::value& args);
48   void GetAppInfo(const std::string& app_id, picojson::object* out);
49   void GetAppCerts(const std::string& app_id, picojson::object* out);
50   void GetAppSharedUri(const std::string& app_id, picojson::object* out);
51   void GetAppMetaData(const std::string& app_id, picojson::object* out);
52   void StartAppInfoEventListener(picojson::object* out);
53   void StopAppInfoEventListener();
54   void GetApplicationInformationSize(const picojson::value& args, picojson::object* out);
55   void AsyncResponse(common::PlatformResult& result, std::shared_ptr<picojson::value>* response);
56
57  private:
58   char* GetPackageId(const std::string& app_id);
59
60   pkgmgr_client* pkgmgr_client_handle_;
61   pkgmgrinfo_client* pkgmgrinfo_client_handle_;
62   ApplicationInstance& instance_;
63 };
64
65 } // namespace application
66 } // namespace extension
67
68 #endif // SRC_APPLICATION_APPLICATION_MANAGER_H__