f7fadc0747aac2523e1386427e536484c50f1e4c
[platform/framework/web/wrt.git] / src / view / common / view_logic_security_origin_support.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  * @file    view_logic_security_origin_support.h
18  * @author  Jihoon Chung (jihoon.chung@samsung.com)
19  * @version 1.0
20  * @brief   Header file for security origin
21  */
22
23 #ifndef VIEW_LOGIC_SECURITY_ORIGIN_SUPPORT_H_
24 #define VIEW_LOGIC_SECURITY_ORIGIN_SUPPORT_H_
25
26 #include <memory>
27 #include <Evas.h>
28 #include <Elementary.h>
29 #include <dpl/wrt-dao-ro/common_dao_types.h>
30 #include <wrt-commons/security-origin-dao/security_origin_dao.h>
31
32 class WidgetModel;
33 namespace SecurityOriginDB {
34     class SecurityOriginDAO;
35 }
36
37 namespace ViewModule {
38
39 class SecurityOriginSupportImplementation;
40
41 class SecurityOriginSupport
42 {
43   public:
44     SecurityOriginSupport(WidgetModel* widgetModel);
45     virtual ~SecurityOriginSupport();
46     SecurityOriginDB::SecurityOriginDAO* getSecurityOriginDAO();
47     WrtDB::SettingsType isNeedPermissionCheck(
48         SecurityOriginDB::Feature feature);
49
50   private:
51     std::unique_ptr<SecurityOriginSupportImplementation> m_impl;
52 };
53
54 namespace SecurityOriginSupportUtil {
55 class PermissionData
56 {
57   public:
58     SecurityOriginDB::SecurityOriginDAO* m_originDao;
59     SecurityOriginDB::SecurityOriginData m_originData;
60     void* m_data;
61
62     PermissionData(
63         SecurityOriginDB::SecurityOriginDAO* originDao,
64         SecurityOriginDB::SecurityOriginData originData,
65         void* data) :
66             m_originDao(originDao),
67             m_originData(originData),
68             m_data(data)
69     {
70     };
71 };
72
73 Evas_Object* createPopup(Evas_Object* window,
74                          const char* bodyText,
75                          const char* checkText,
76                          Evas_Smart_Cb buttonCallback,
77                          void* data);
78 Evas_Object* getPopup(Evas_Object* button);
79 Evas_Object* getCheck(Evas_Object* popup);
80 SecurityOriginDB::Result getResult(Evas_Object* button);
81 };
82 } // namespace ViewModule
83
84
85 #endif // VIEW_LOGIC_SECURITY_ORIGIN_SUPPORT_H_