Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / src / server / appfw / 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          * Gets agruments.
92          * @return      arguments
93          *
94          * @since 2.1
95          */
96         Tizen::Base::Collection::IList* GetLaunchArgs(void) const;
97
98 private:
99         /**
100          * This is the constructor for this class.
101          *
102          * @since 2.1
103          */
104         _AppLaunchCondition(void);
105
106         /**
107          * This is the destructor for this class.
108          *
109          * @since 2.1
110          */
111         virtual ~_AppLaunchCondition(void);
112
113         /**
114          * Initializes this instance of _AppLaunchCondition with the specified parameter
115          *
116          * @since 2.1
117          * @return              An error code
118          * @param[in]   appId                           The application's ID to be executed conditionally
119          * @param[in]   condition                       The launch condition for the application
120          * @param[in]   pArguments                      A pointer to the list of string arguments that has a maximum size of @c 1024 bytes @n
121          *                                                                      The default value is @c null.
122          * @param[in]   option                          The launch option (currently only AppManager::LAUNCH_OPTION_DEFAULT is available)
123          * @param[in]   pRegSectionName         The section name in the registry.
124                                                                                 This value is used to find a registry section by condition string and remove it easily.
125          * @exception   E_SUCCESS                       The method is successful.
126          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
127
128          * @see Tizen::App::AppManager::RegisterAppLaunch()
129          */
130         result Construct(const AppId& appId, const Tizen::Base::String& conditionString, const Base::Collection::IList* pArgs, AppManager::LaunchOption option , const Tizen::Base::String* pRegSectionName = null);
131
132 private:
133         _AppLaunchCondition(const _AppLaunchCondition& operation);
134         _AppLaunchCondition& operator =(const _AppLaunchCondition& operation);
135
136 private:
137         // app launch info
138         AppId __appId;
139         Tizen::Base::Collection::ArrayList *__pArguments;
140         AppManager::LaunchOption __option;
141
142         // condition info
143         Tizen::Base::String __conditionString;
144         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.
145
146         result CopyArgumentsDeeply(const Tizen::Base::Collection::IList *pArgs);
147         Tizen::Base::String __regSectionName;
148
149         friend class _ConditionHandler;
150         friend class _ConditionManagerService;
151         friend class Tizen::System::_AlarmConditionHandler;
152 };      //_AppLaunchCondition
153
154
155 }}
156
157 #endif // _FAPP_INTERNAL_CONDITIONAL_OPERATION_H_