Add privilege check code.
[platform/framework/native/appfw.git] / src / server / inc / FApp_AppLaunchCondition.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_IConditionalOperation.h
19  * @brief       This is the header file of the _AppLaunchCondition class.
20  *
21  * This header file contains the declarations of the _AppLaunchCondition class
22  */
23
24 #ifndef _FAPP_INTERNAL_CONDITIONAL_OPERATION_H_
25 #define _FAPP_INTERNAL_CONDITIONAL_OPERATION_H_
26
27
28 #include <FOspConfig.h>
29 #include <FBaseObject.h>
30 #include <FBaseColIList.h>
31 #include <FBaseColArrayList.h>
32 #include <FAppTypes.h>
33 #include <FAppAppManager.h>
34
35 #include <FBaseSysLog.h>
36
37 namespace Tizen { namespace System {
38         class _AlarmConditionHandler;
39 }
40 }
41
42 namespace Tizen { namespace App {
43
44
45 /**
46  * @class       _AppLaunchCondition
47  * @brief       This class abstracts information for conditional app launch
48  * @since 2.1
49  */
50 class _OSP_EXPORT_ _AppLaunchCondition
51         : public Tizen::Base::Object
52 {
53 public:
54         /**
55          * Gets the application ID of the target application.
56          *
57          * @return              application ID
58          * @since 2.1
59          */
60         AppId GetAppId(void) const;
61
62         /**
63          * Gets registered condition string.
64          * @return              condition string
65          *
66          * @since 2.1
67          */
68         Tizen::Base::String GetConditionString(void) const;
69
70         /**
71          * Sets userdata
72          *
73          * @param[in]   pUserData       The pointer to userdata of this instance
74          *                                                      Userdata can be context or handle. (ex, Alarm instance, Timer handle, etc)
75          * @since 2.1
76          * @see         GetUserData
77          */
78         result SetUserData(const Object* pUserData);
79
80         /**
81          * Gets userdata
82          *
83          * @return      The pointer to userdata of this instance.
84          *                      You can cancel or delete plugin dependent information using this pointer in overridden function _AppLaunchConditionBase::Unregister.
85          * @since 2.1
86          * @see         SetUserData
87          */
88         Object* GetUserData(void) const;
89
90
91 private:
92         /**
93          * This is the constructor for this class.
94          *
95          * @since 2.1
96          */
97         _AppLaunchCondition(void);
98
99         /**
100          * This is the destructor for this class.
101          *
102          * @since 2.1
103          */
104         virtual ~_AppLaunchCondition(void);
105
106         /**
107          * Initializes this instance of _AppLaunchCondition with the specified parameter
108          *
109          * @since 2.1
110          * @return              An error code
111          * @param[in]   appId                           The application's ID to be executed conditionally
112          * @param[in]   condition                       The launch condition for the application
113          * @param[in]   pArguments                      A pointer to the list of string arguments that has a maximum size of @c 1024 bytes @n
114          *                                                                      The default value is @c null.
115          * @param[in]   option                          The launch option (currently only AppManager::LAUNCH_OPTION_DEFAULT is available)
116          * @param[in]   pRegSectionName         The section name in the registry.
117                                                                                 This value is used to find a registry section by condition string and remove it easily.
118          * @exception   E_SUCCESS                       The method is successful.
119          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
120
121          * @see Tizen::App::AppManager::RegisterAppLaunch()
122          */
123         result Construct(const AppId& appId, const Tizen::Base::String& conditionString, const Base::Collection::IList* pArgs, AppManager::LaunchOption option , const Tizen::Base::String* pRegSectionName = null);
124
125 private:
126         _AppLaunchCondition(const _AppLaunchCondition& operation);
127         _AppLaunchCondition& operator =(const _AppLaunchCondition& operation);
128
129 private:
130         // app launch info
131         AppId __appId;
132         Tizen::Base::Collection::ArrayList *__pArguments;
133         AppManager::LaunchOption __option;
134
135         // condition info
136         Tizen::Base::String __conditionString;
137         const Object* __pUserData;///<<  pointer to plugin's context or handle. (ex, Alarm instance, Timer handle, etc). You can cancel or delete registered operation using this value, when _AppLaunchConditionBase::Unregister implemented function is invoked.
138
139         result CopyArgumentsDeeply(const Tizen::Base::Collection::IList *pArgs);
140         Tizen::Base::String __regSectionName;
141
142         friend class _ConditionHandler;
143         friend class _ConditionManagerService;
144         friend class Tizen::System::_AlarmConditionHandler;
145 };      //_AppLaunchCondition
146
147
148 }}
149
150 #endif // _FAPP_INTERNAL_CONDITIONAL_OPERATION_H_