76e98d332058fdba60acef5efcc4e32487651d39
[platform/framework/native/appfw.git] / inc / FAppPkgIPackageInstallationEventListener.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        FAppPkgIPackageInstallationEventListener.h
19  * @brief       This is the header file for the %IPackageInstallationEventListener interface.
20  *
21  * This header file contains the declarations of the %IPackageInstallationEventListener interface.
22  */
23
24 #ifndef _FAPP_PKG_IPACKAGE_INSTALLATION_EVENT_LISTENER_H_
25 #define _FAPP_PKG_IPACKAGE_INSTALLATION_EVENT_LISTENER_H_
26
27 #include <FAppPkgPackageManager.h>
28 #include <FBaseRtIEventListener.h>
29
30 namespace Tizen { namespace App { namespace Package
31 {
32 /**
33  * @enum                PackageInstallationResult
34  *
35  * Defines the result of package installation.
36  *
37  * @since       2.0
38  */
39 enum PackageInstallationResult
40 {
41         PACKAGE_INSTALLATION_RESULT_SUCCESS = 0,                                /**< Success */
42         PACKAGE_INSTALLATION_RESULT_INVALID_PACKAGE,                    /**< An invalid package */
43         PACKAGE_INSTALLATION_RESULT_STORAGE_FULL,                               /**< The installation target storage is full. */
44 };
45
46 /**
47 * @interface    IPackageInstallationEventListener
48 * @brief                This interface defines a listener for a package installation and uninstallation.
49 *
50 * @since        2.0
51 *
52 * The %IPackageInstallationEventListener interface defines a listener for a package installation and uninstallation.
53 */
54 class _OSP_EXPORT_ IPackageInstallationEventListener
55         : virtual public Tizen::Base::Runtime::IEventListener
56 {
57 public:
58         /**
59          * This polymorphic destructor should be overridden if required.
60          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
61          *
62          * @since       2.0
63          */
64         virtual ~IPackageInstallationEventListener(void) {}
65
66         /**
67          * Called when a package installation is completed. @n
68          * The value of @c installationResult is @c PACKAGE_INSTALLATION_RESULT_SUCCESS if the installation is successful.
69          *
70          * @since       2.0
71          *
72          * @param[in]   packageId                               The package ID
73          * @param[in]   installationResult              The installation result
74          */
75         virtual void OnPackageInstallationCompleted(const PackageId& packageId, PackageInstallationResult installationResult) = 0;
76
77         /**
78          * Called when a package uninstallation is completed. @n
79          * The value of @c uninstallationResult is @c true if the uninstallation is successful, else @c false.
80          *
81          * @since       2.0
82          *
83          * @param[in]   packageId                       The package ID
84          * @param[in]   uninstallationResult            Set to @c true if the uninstallation is successful, @n
85          *                                                                                      else @c false
86          */
87         virtual void OnPackageUninstallationCompleted(const PackageId& packageId, bool uninstallationResult) = 0;
88
89         /**
90          * Called when a package installation is in progress.
91          *
92          * @since       2.0
93          *
94          * @param[in]   packageId                       The package ID
95          * @param[in]   progress                The progress of an installation in percentage
96          */
97         virtual void OnPackageInstallationInProgress(const PackageId& packageId, int progress) = 0;
98
99
100 protected:
101         //
102         // This method is for internal use only.
103         // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
104         //
105         // This method is reserved and may change its name at any time without prior notice.
106         //
107         // @since       2.0
108         //
109         virtual void IPackageInstallationEventListener_Reserved1(void) {}
110
111         //
112         // This method is for internal use only.
113         // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
114         //
115         // This method is reserved and may change its name at any time without prior notice.
116         //
117         // @since       2.0
118         //
119         virtual void IPackageInstallationEventListener_Reserved2(void) {}
120
121         //
122         // This method is for internal use only.
123         // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
124         //
125         // This method is reserved and may change its name at any time without prior notice.
126         //
127         // @since       2.0
128         //
129         virtual void IPackageInstallationEventListener_Reserved3(void) {}
130
131 }; // IPackageInstallationEventListener
132
133 } } } // Tizen::App::Package
134
135 #endif // _FAPP_PKG_IPACKAGE_INSTALLATION_EVENT_LISTENER_H_