9a8e6437002fabe75fc858ff591b34da5fa4b407
[platform/framework/native/appfw.git] / src / app / inc / FApp_AppManagerProxy.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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 /**
18  * @file        FApp_AppManagerProxy.h
19  * @brief       This is the header file for the _AppManagerProxy class.
20  */
21
22 #ifndef _FAPP_INTERNAL_APP_MANAGER_PROXY_H_
23 #define _FAPP_INTERNAL_APP_MANAGER_PROXY_H_
24
25 #include <FBaseObject.h>
26 #include <FBaseColArrayList.h>
27 #include <FAppTypes.h>
28 #include <FOspConfig.h>
29 #include <FIo_IIpcClientEventListener.h>
30 #include "FApp_Types.h"
31 #include "FApp_IAppManager.h"
32 #include "FApp_AppManagerEvent.h"
33
34 namespace Tizen { namespace Io { class _IpcClient; } }
35
36 namespace Tizen { namespace App
37 {
38
39 class _IAppManagerEventListener;
40 class _IAppManagerServiceEventListener;
41 class _AppManagerEventArg;
42
43 class _IAppLifecycleEventListener;
44
45
46 class _OSP_EXPORT_ _AppManagerProxy
47         : public _IAppManager
48         , public Tizen::Io::_IIpcClientEventListener
49         , public Tizen::Base::Object
50 {
51 public:
52         virtual ~_AppManagerProxy(void);
53
54         virtual result TerminateApplication(const AppId& appId);
55
56         // for platform
57         virtual result InitEventListener(_IAppManagerServiceEventListener* pListener);
58
59         virtual result AddEventListener(int clientId);
60
61         virtual result RemoveEventListener(int clientId);
62
63         virtual result RegisterApplication(const AppId& appId, _AppType appType, int pid);
64
65         virtual result UnregisterApplication(int pid);
66
67         virtual bool IsUserPreferredAppForAppControlResolution(const AppId& appId);
68         
69         virtual result ClearUserPreferenceForAppControlResolution(const AppId& appId);
70
71         virtual result RegisterAppForAppLifecycleEvent(const AppId& appId, int clientId);
72         
73         virtual result UnregisterAppForAppLifecycleEvent(const AppId& appId, int clientId);
74
75         static _IAppManager* GetService(void);
76
77         static void SetService(_IAppManager* pAppManager);
78
79         static void DeleteService(void);
80
81 private:
82         _AppManagerProxy(void);
83
84         _AppManagerProxy(const _AppManagerProxy& value);
85
86         _AppManagerProxy& operator =(const _AppManagerProxy& source);
87
88         result Construct(void);
89
90         virtual void OnIpcResponseReceived(Tizen::Io::_IpcClient& client, const IPC::Message& message);
91
92         bool OnEventReceived(const Tizen::App::_AppManagerEventArg& arg);
93         void OnTerminateApplicationRequested(void);
94         void OnAppLifecycleEventReceived(const AppId& appId, int appLifecycleEventType);
95
96 private:
97         static bool __isDeletable;
98         static _IAppManager* __pSelf;
99         Tizen::Io::_IpcClient* __pIpcClient;
100         static _IAppManagerServiceEventListener* __pServiceEventListener;
101 }; // _AppManagerProxy
102
103 } } // Tizen::App
104
105 #endif // _FAPP_INTERNAL_APP_MANAGER_PROXY_H_