2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #ifndef TIZENAPIS_PLATFORM_APPLICATION_APP_MANAGER_WRAPPER_H_
19 #define TIZENAPIS_PLATFORM_APPLICATION_APP_MANAGER_WRAPPER_H_
24 #include <dpl/shared_ptr.h>
25 #include <dpl/singleton.h>
27 #include <app_manager.h>
28 #include <package-manager.h>
29 #include "ApplicationInformation.h"
31 // To get app size and installed time
32 #include <pkgmgr-info.h>
35 namespace Application {
38 class IAppManagerAppListChangedCallbacks
41 friend class AppManagerWrapper;
43 IAppManagerAppListChangedCallbacks() {}
44 ~IAppManagerAppListChangedCallbacks() {}
47 virtual void onAppManagerEventInstalled(const char *appId) = 0;
48 virtual void onAppManagerEventUninstalled(const char *appId) = 0;
49 virtual void onAppManagerEventUpdated(const char *appId) = 0;
52 class AppManagerWrapper
56 virtual ~AppManagerWrapper();
58 // Can throw InvalidArgumentException or PlatformException
59 void registerAppListChangedCallbacks(IAppManagerAppListChangedCallbacks *callbacks);
62 void unregisterAppListChangedCallbacks(IAppManagerAppListChangedCallbacks *callbacks);
64 long getWatchIdAndInc();
66 bool initializeAppInfo(ApplicationInformationPtr &appInfo);
69 // callback for app_manager_set_app_list_changed_cb
70 static void appListChangedCallback(app_manger_event_type_e event_type,
74 void appListChangedCallback(app_manger_event_type_e event_type,
77 void appListAppInstalled(const char *appId);
78 void appListAppUninstalled(const char *appId);
79 void appListAppUpdated(const char *appId);
81 void registerAppListChangedCallbacks();
82 void unregisterAppListChangedCallbacks();
84 typedef std::set<IAppManagerAppListChangedCallbacks *> AppListChangedCallbacksSet;
85 AppListChangedCallbacksSet m_callbacks;
86 bool m_registeredCallback;
91 friend class DPL::Singleton<AppManagerWrapper>;
94 typedef DPL::Singleton<AppManagerWrapper> AppManagerWrapperSingleton;
99 #endif // TIZENAPIS_PLATFORM_APPLICATION_APP_MANAGER_WRAPPER_H_