apply dynamic singleton pattern to internal classes and add retry code to AppWidgetMa...
[platform/framework/native/shell.git] / src / inc / FShell_LockManagerImpl.h
1 //
2 // Copyright (c) 2013 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                FShell_LockManagerImpl.h
19  * @brief               This is the header file for the _LockManagerImpl class.
20  *
21  * This header file contains the declarations of the %_LockManagerImpl class.
22  */
23
24 #ifndef _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_
25 #define _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_
26
27 #include <FBaseObject.h>
28
29 namespace Tizen { namespace Shell {
30
31 class _LockManagerProxy;
32 /**
33  * @class               _LockManagerImpl
34  * @brief               Manages state of lock screen.
35  *
36  * @since       2.1
37  *
38  * @final               This class is not intended for extension.
39  *
40  * The %_LockManagerImpl class manages information of lock screen.
41  */
42 class _OSP_EXPORT_ _LockManagerImpl
43         : public Tizen::Base::Object
44 {
45 public:
46         /**
47          * Gets the %_LockManagerImpl instance.
48          *
49          * @since       2.1
50          *
51          * @return      A pointer to the %_LockManagerImpl instance, @n
52          *                      else @c null if it fails
53          *
54          * @exception   E_SUCCESS       The method is successful.
55          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
56          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
57          * @remarks     The specific error code can be accessed using the GetLastResult() method.
58          */
59         static _LockManagerImpl* GetInstance(void);
60
61         /**
62          * Checks whether the screen is locked.
63          *
64          * @since       2.1
65          *
66          * @return      @c true if the screen is locked,
67          *           else @c false
68          */
69         bool IsLocked(void) const;
70
71         /**
72          * Checks whether password lock screen is enabled by Settings.
73          *
74          * @since       2.1
75          *
76          * @return      @c true if password lock screen is enabled,
77          *           else @c false
78          */
79         bool IsSecureMode(void) const;
80
81         /**
82          * Unlocks current lock screen.
83
84          * @privlevel   partner
85          * @privilege   http://tizen.org/privilege/lockmanager
86          *
87          * @since       2.1
88          *
89          * @exception   E_SUCCESS                       The method is successful.
90          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
91          * @exception   E_INVALID_OPERATION     Can't unlock, because secure mode is enabled.
92          * @exception   E_SYSTEM                The method cannot proceed due to a severe system error.
93          *
94          * @remark              This API call has no effect while secure mode is enabled. 
95          */
96         result Unlock(void);
97
98 private:
99         //
100         // This default constructor is intentionally declared as private to implement the %Singleton semantic.
101         //
102         // @since       2.1
103         //
104         _LockManagerImpl(void);
105
106         //
107         // This destructor is intentionally declared as private to implement the %Singleton semantic.
108         //
109         // @since       2.1
110         //
111         virtual ~_LockManagerImpl(void);
112
113         //
114         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
115         //
116         // @since       2.1
117         //
118         _LockManagerImpl(const _LockManagerImpl& rhs);
119
120         //
121         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
122         //
123         // @since       2.1
124         //
125         _LockManagerImpl& operator =(const _LockManagerImpl& rhs);
126
127         //
128         // Constructs the instance of this class.
129         //
130         // @since       2.1
131         //
132         // @return          An error code
133         // @exception   E_SUCCESS       The method is successful.
134         // @exception   E_SYSTEM        The method cannot proceed due to a severe system error.
135         //
136         result Construct(void);
137
138         static void InitSingleton(void);
139         static void DestroySingleton(void);
140
141 private:
142
143         static _LockManagerImpl* __pTheInstance;
144         friend struct std::default_delete< _LockManagerImpl >;
145
146 };
147
148 }} // Tizen::Shell
149
150 #endif /* _FSHELL_INTERNAL_LOCK_MANAGER_IMPL_H_ */