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