add patch
[framework/osp/web.git] / src / controls / inc / FWebCtrl_UserConfirmPopup.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        FWebCtrl_UserConfirmPopup.h
20  * @brief       The file contains the definition of _UserConfirmPopup class.
21  */
22 #ifndef _FWEB_CTRL_INTERNAL_USER_CONFIRM_POPUP_H_
23 #define _FWEB_CTRL_INTERNAL_USER_CONFIRM_POPUP_H_
24
25 #include <unique_ptr.h>
26 #include <EWebKit2.h>
27 #include <FBaseString.h>
28 #include <FUiIPropagatedKeyEventListener.h>
29 #include "FWebCtrl_WebPopup.h"
30
31 namespace Tizen { namespace Ui { namespace Controls
32 {
33 class CheckButton;
34 }}}
35
36 namespace Tizen { namespace Web { namespace Controls
37 {
38 class _WebImpl;
39
40 enum _UserConfirmPopupButtonId
41 {
42         ID_BUTTON_USER_ALLOW,
43         ID_BUTTON_USER_CANCEL,
44         ID_BUTTON_USER_CERT_VIEW
45 };
46
47 enum _UserConfirmMode
48 {
49         USER_CONFIRM_USERMEDIA,
50         USER_PROTOCOL_HANDLER,
51         USER_CONTENT_HANDLER,
52         USER_CONFIRM_GEOLOCATION,
53         USER_CONFIRM_NOTIFICATION,
54         USER_SCRIPT_ALERT,
55         USER_SCRIPT_CONFIRM,
56         USER_CONFIRM_APP_CACHE,
57         USER_CONFIRM_DB_QUOTA_EXCEDED,
58         USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED,
59         USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED
60 };
61
62 class _UserConfirmPopup
63         : public _WebPopup
64         , public Tizen::Ui::IPropagatedKeyEventListener
65 {
66
67 public:
68         /**
69          * Constructor
70          */
71         _UserConfirmPopup(void);
72
73         /**
74          * Destructor
75          */
76         virtual ~_UserConfirmPopup(void);
77
78         result Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, Tizen::Web::Controls::_WebImpl* pImpl, bool sync = false, Tizen::Base::String msg = L"");
79
80         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
81
82         virtual bool  OnKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
83         virtual bool  OnKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
84         virtual bool  OnPreviewKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
85         virtual bool  OnPreviewKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
86         virtual bool  TranslateKeyEventInfo (Tizen::Ui::Control &source, Tizen::Ui::KeyEventInfo &keyEventInfo);
87
88 private:
89         _UserConfirmPopup(const _UserConfirmPopup&);
90
91         _UserConfirmPopup& operator =(const _UserConfirmPopup&);
92
93         Tizen::Base::String GetMessageFromPolicy(void);
94
95         void HandleUserAction(Eina_Bool allow);
96
97         void RegisterHandler(bool checkhandler, Eina_Bool allow);
98         result AddGeolocationDb(Ewk_Geolocation_Permission_Request* pPolicy, bool enable);
99
100 private:
101         void* __pUserPolicyData;
102         _UserConfirmMode __userConfirmMode;
103         Tizen::Ui::Controls::CheckButton* __pCheckButton;
104
105         bool __sync;
106         Tizen::Web::Controls::_WebImpl* __pImpl;
107 }; // _UserConfirmPopup
108
109 }}} // Tizen::Web::Controls
110 #endif // _FWEB_CTRL_INTERNAL_USER_CONFIRM_POPUP_H_