Merge branch 'tizen_3.0' into tizen_4.0
[platform/core/api/webapi-plugins.git] / src / application / application_manager.h
old mode 100755 (executable)
new mode 100644 (file)
index 0609659..6bb4ecc
 #define SRC_APPLICATION_APPLICATION_MANAGER_H__
 
 #include <app_event.h>
+#include <app_manager.h>
 #include <bundle.h>
+#include <package-manager.h>
+#include <pkgmgr-info.h>
+#include <functional>
 #include <functional>
 #include <memory>
-#include <package-manager.h>
 #include <string>
+#ifdef TIZEN_MOBILE
+#include <context-service/context_history.h>
+#endif
 
 #include "common/picojson.h"
 #include "common/platform_result.h"
@@ -51,6 +57,8 @@ class ApplicationManager {
   void GetAppCerts(const std::string& app_id, picojson::object* out);
   void GetAppSharedUri(const std::string& app_id, picojson::object* out);
   void GetAppMetaData(const std::string& app_id, picojson::object* out);
+  void GetBatteryUsageInfo(const picojson::value& args, picojson::object* out);
+  void GetAppsUsageInfo(const picojson::value& args, picojson::object* out);
   void StartAppInfoEventListener(picojson::object* out);
   void StopAppInfoEventListener();
   void GetApplicationInformationSize(const picojson::value& args, picojson::object* out);
@@ -60,21 +68,48 @@ class ApplicationManager {
   common::PlatformResult StartEventListener(const std::string& event_name,
                                             const JsonCallback& callback);
   void StopEventListener(const std::string& event_name);
+  common::PlatformResult StartStatusListener(const JsonCallback& callback);
+  common::PlatformResult StopStatusChangeListener();
 
  private:
   char* GetPackageId(const std::string& app_id);
 
   pkgmgr_client* pkgmgr_client_handle_;
+  pkgmgr_client* pkgmgr_client_uninstall_handle_;
   ApplicationInstance& instance_;
+  app_manager_event_h app_status_handle_;
 
   JsonCallback event_callback_;
+  JsonCallback status_callback_;
   std::map<std::string, event_handler_h> event_handler_map_;
-  static void OnEvent(const char* event_name,
-                      bundle* event_data,
-                      void* user_data);
+  static void OnEvent(const char* event_name, bundle* event_data, void* user_data);
+  static void OnStatusEvent(const char* type, const char* app_id,
+                            app_manager_event_type_e event_type,
+                            app_manager_event_state_e event_state, app_manager_event_h handle,
+                            void* user_data);
+
+#ifdef TIZEN_MOBILE
+  static common::PlatformResult GetContextHistory(
+      const picojson::value& args, picojson::object* out,
+      common::PlatformResult (*)(const picojson::value&, const context_history_filter_h,
+                                 context_history_data_e* data_type),
+      common::PlatformResult (*)(const context_history_record_h, picojson::object*));
+
+  static common::PlatformResult BatteryUsageFilter(const picojson::value&,
+                                                   const context_history_filter_h,
+                                                   context_history_data_e* data_type);
+  static common::PlatformResult BatteryUsageAttributes(const context_history_record_h,
+                                                       picojson::object*);
+
+  static common::PlatformResult AppsUsageFilter(const picojson::value&,
+                                                const context_history_filter_h,
+                                                context_history_data_e* data_type);
+  static common::PlatformResult AppsUsageAttributes(const context_history_record_h,
+                                                    picojson::object*);
+#endif
 };
 
-} // namespace application
-} // namespace extension
+}  // namespace application
+}  // namespace extension
 
-#endif // SRC_APPLICATION_APPLICATION_MANAGER_H__
+#endif  // SRC_APPLICATION_APPLICATION_MANAGER_H__