[Tizen] Add DALi Autofill implementation
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / common / autofill-manager-impl.h
1 #ifndef DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_H
2 #define DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/autofill-manager.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace Adaptor
34 {
35
36 class AutofillManager : public Dali::BaseObject
37 {
38
39 public:
40
41   /**
42    * @brief Gets the AutofillManager instance
43    *
44    * It creates the instance if it has not already been created.
45    * Internally, a check should be made using IsAvailable() before this is called as we do not want
46    * to create an instance if not needed by applications.
47    * @see IsAvailable()
48    */
49   static Dali::AutofillManager Get();
50
51   /**
52    * @brief Connects Callbacks required for Autofill daemon.
53    */
54   virtual void ConnectCallbacks() = 0;
55
56   /**
57    * @copydoc Dali::AutofillManager::CreateAutofillItem()
58    */
59   virtual Dali::AutofillItem CreateAutofillItem( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive ) = 0;
60
61   /**
62    * @copydoc Dali::AutofillManager::CreateAutofillGroup()
63    */
64   virtual Dali::AutofillGroup CreateAutofillGroup( const std::string& groupId ) = 0;
65
66   /**
67    * @copydoc Dali::AutofillManager::IsAutofillDataPresent()
68    */
69   virtual bool IsAutofillDataPresent() const = 0;
70
71   /**
72    * @copydoc Dali::AutofillManager::IsAuthenticationNeeded()
73    */
74   virtual bool IsAuthenticationNeeded() const = 0;
75
76   /**
77    * @copydoc Dali::AutofillManager::GetAuthenticationServiceName()
78    */
79   virtual const std::string& GetAuthenticationServiceName() const = 0;
80
81   /**
82    * @copydoc Dali::AutofillManager::GetAuthenticationServiceMessage()
83    */
84   virtual const std::string& GetAuthenticationServiceMessage() const = 0;
85
86   /**
87    * @copydoc Dali::AutofillManager::GetAuthenticationServiceImagePath()
88    */
89   virtual const std::string& GetAuthenticationServiceImagePath() const = 0;
90
91   /**
92    * @copydoc Dali::AutofillManager::GetFillItemId()
93    */
94   virtual const std::string& GetFillItemId() const = 0;
95
96   /**
97    * @copydoc Dali::AutofillManager::GetFillItemPresentationText()
98    */
99   virtual const std::string& GetFillItemPresentationText() const = 0;
100
101   /**
102    * @copydoc Dali::AutofillManager::GetFillItemValue()
103    */
104   virtual const std::string& GetFillItemValue() const = 0;
105
106   /**
107    * @copydoc Dali::AutofillManager::SaveAutofillData()
108    */
109   virtual void SaveAutofillData( Dali::AutofillGroup group ) = 0;
110
111 public: // Signals
112
113   /**
114    * @copydoc Dali::AutofillManager::AuthenticationReceivedSignal()
115    */
116   virtual Dali::AutofillManager::AuthSignalType& AuthenticationReceivedSignal() { return mAuthReceivedSignal; }
117
118   /**
119    * @copydoc Dali::AutofillManager::FillResponseReceivedSignal()
120    */
121   virtual Dali::AutofillManager::FillSignalType& FillResponseReceivedSignal() { return mFillReceivedSignal; }
122
123   /**
124    * @copydoc Dali::AutofillManager::ListEventSignal()
125    */
126   virtual Dali::AutofillManager::ListSignalType& ListEventSignal() { return mListReceivedSignal; }
127
128 private:
129   /**
130    * Context created the first time and kept until deleted.
131    */
132   virtual void CreateContext() = 0;
133
134   /**
135    * Delete Autofill context.
136    */
137   virtual void DeleteContext() = 0;
138
139 public:
140   /**
141    * Constructor.
142    */
143   AutofillManager() = default;
144
145 protected:
146   /**
147    * Destructor.
148    */
149   ~AutofillManager() = default;
150
151 private:
152   // Undefined copy constructor
153   AutofillManager( const AutofillManager& autofillManager ) = delete;
154
155   // Undefined assignment operator
156   AutofillManager& operator=( AutofillManager& autofillManager ) = delete;
157
158 private:
159   Dali::AutofillManager::AuthSignalType mAuthReceivedSignal;                      ///< Authentication Received Signal
160   Dali::AutofillManager::FillSignalType mFillReceivedSignal;                      ///< Fill Response Received Signal
161   Dali::AutofillManager::ListSignalType mListReceivedSignal;                      ///< List Received Signal
162
163
164 };
165
166 inline static Internal::Adaptor::AutofillManager& GetImplementation(Dali::AutofillManager& autofillManager)
167 {
168   DALI_ASSERT_ALWAYS( autofillManager && "AutofillManager handle is empty" );
169
170   BaseObject& handle = autofillManager.GetBaseObject();
171
172   return static_cast<Internal::Adaptor::AutofillManager&>(handle);
173 }
174
175 inline static const Internal::Adaptor::AutofillManager& GetImplementation(const Dali::AutofillManager& autofillManager)
176 {
177   DALI_ASSERT_ALWAYS( autofillManager && "AutofillManager handle is empty" );
178
179   const BaseObject& handle = autofillManager.GetBaseObject();
180
181   return static_cast<const Internal::Adaptor::AutofillManager&>(handle);
182 }
183
184 } // namespace Adaptor
185
186 } // namespace Internal
187
188 } // namespace Dali
189
190 #endif // DALI_INTERNAL_AUTOFILL_MANAGER_IMPL_H