Add privilege check code.
[platform/framework/native/appfw.git] / src / server / inc / FApp_AppLaunchConditionHandlerBase.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_AppLaunchConditionHandlerBase.h
19  * @brief       This is the header file of the _AppLaunchConditionHandlerBase class.
20  *
21  * This header file contains the declarations of the _AppLaunchConditionHandlerBase class.
22  */
23 #ifndef _FAPP_INTERNAL_APP_LAUNCH_CONDITION_HANDLER_BASE_H_
24 #define _FAPP_INTERNAL_APP_LAUNCH_CONDITION_HANDLER_BASE_H_
25
26 #include <FBaseObject.h>
27 #include <FAppTypes.h>
28
29 #include <FBaseSysLog.h>
30 #include "FApp_IAppLaunchConditionEventListener.h"
31 #include "FApp_AppLaunchCondition.h"
32
33 namespace Tizen { namespace App {
34
35
36 /**
37  * @class               _AppLaunchConditionHandlerBase
38  * @brief               This class is the abstract base class of all conditional app launch handlers(plugin).
39  * @since 2.1
40  *
41  * All conditional app launch handlers(plugin) should inherit this abstract class.
42  * and all plugins must provide both a creation and a destruction function like following.
43  *
44  * @code
45  *      extern "C" _AppLaunchConditionHandlerBase* CreatePlugin()
46  *      {
47  *              return new (std::nothrow) _AlarmConditionHandler;// create and return your own class instance.
48  *      }
49  *
50  *      extern "C" void DestroyPlugin(_AppLaunchConditionHandlerBase* p)
51  *      {
52  *              delete p;
53  *      }
54  * @endcode
55  */
56 class _OSP_EXPORT_ _AppLaunchConditionHandlerBase
57         : public Tizen::Base::Object
58 {
59 public:
60         /**
61          * This is the constructor for this class.
62          *
63          * @since 2.1
64          */
65         _AppLaunchConditionHandlerBase(void);
66
67         /**
68          * This is the destructor for this class.
69          *
70          * @since 2.1
71          */
72         virtual ~_AppLaunchConditionHandlerBase(void);
73
74         /**
75          * Sets event listener instance. @n
76          * The listener can listen to OnAppLaunchConditionMet event.
77          *
78          * @since 2.1
79          * @param[in]   The operation   registered conditional operation with current condition.
80          * @remark              _ConditionManagerService uses this function to sets itself as listener.
81          */
82         result SetEventListener(_IAppLaunchConditionEventListener& eventListener);
83
84         /**
85          * Register app launch condition for the plug-in.
86          *
87          * @since 2.1
88          * @return              An error code
89          * @param[in]   operation               The conditional operation to register
90          * @exception   E_SUCCESS                       The method is successful.
91          * @exception   E_INVALID_FORMAT                The specified condition format is invalid.
92          * @exception   E_INVALID_CONDITION  The specified condition format is valid but the condition has at least one or more invalid values.
93          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
94          * @exception   E_SYSTEM                                A system error has occurred.
95          * @remark              Plugin should implement this register condition code
96          *                              _ConditionManagerService calls this method when RegisterAppLaunch method invoked.
97          * @see Unregister()
98          */
99         virtual result Register( _AppLaunchCondition& condition) = 0;//, const Tizen::Base::Object*& pHandle) = 0;
100
101         /**
102          * Unregister app launch condition for the plug-in.
103          *
104          * @since 2.1
105          * @param[in]   operation               The conditional operation to register
106          * @remark              Plugin should implement this unregister condition code
107          *                              _ConditionManagerService calls this method when UnregisterAppLaunch method invoked.
108          * @see Register()
109          */
110         virtual result Unregister( _AppLaunchCondition& condition) = 0;//, const Tizen::Base::Object* pHandle) = 0;
111
112
113 protected:
114         /**
115          * Fires the OnAppLaunchConditionMet event.
116          *
117          * @since 2.1
118          * @return      An error code
119          * @exception   E_SUCCESS                       The method is successful.
120          * @exception   E_INVALID_STATE         The event handler isn't initialized yet.
121          * @param[in]   operation               The conditional operation registered.
122          * @param[in]   pExtraData              The extra data being delivered in which elements are a pair of key and value of Tizen::Base::String.
123          * @see _IAppLaunchConditionEventListener::OnAppLaunchConditionMet
124          */
125         result Fire(const _AppLaunchCondition& condition, Tizen::Base::Collection::IMap* pExtraData = null);
126
127 private:
128         _IAppLaunchConditionEventListener* __pEventListener;
129 };              //_AppLaunchConditionHandlerBase
130
131 }}//Tizen::App
132
133 #endif // _FAPP_INTERNAL_APP_LAUNCH_CONDITION_HANDLER_BASE_H_