tizen beta release
[framework/web/wrt-commons.git] / modules / widget_dao / include / dpl / wrt-dao-ro / global_dao_read_only.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    global_dao_read_only.h
18  * @author  Pawel Sikorski (p.sikorski@samsung.com)
19  * @version 1.0
20  * @brief   This file contains the declaration of global dao
21  */
22
23 #ifndef WRT_SRC_CONFIGURATION_GLOBAL_DAO_READ_ONLY_H_
24 #define WRT_SRC_CONFIGURATION_GLOBAL_DAO_READ_ONLY_H_
25
26 #include <list>
27 #include <set>
28 #include <string>
29
30 #include <dpl/string.h>
31 #include <dpl/exception.h>
32
33 #include <dpl/wrt-dao-ro/common_dao_types.h>
34
35 namespace WrtDB {
36
37 typedef std::list<DPL::String> WidgetPackageList;
38 typedef std::set<DPL::String> DeviceCapabilitySet;
39
40 //#ifdef USE_BROWSER_SETTING
41 //typedef DPL::DB::ORM::wrt::UserAgents::key_value::ColumnType UserAgent;
42 //#endif //USE_BROWSER_SETTING
43
44 class GlobalDAOReadOnly
45 {
46   public:
47     /**
48      * GlobalDAOReadOnly Exception classes
49      */
50     class Exception
51     {
52       public:
53         DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
54         DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
55     };
56
57   public:
58     /**
59      * Retrieve Parental mode status
60      *
61      * @return true for Parental Mode on, false for Parental Mode off
62      */
63     static bool GetParentalMode();
64
65     /**
66      * Retrieve Parental mode maximal allowed age
67      *
68      * @return NULL if allowed age not set, else pointer value is allowed age
69      */
70     static DPL::OptionalInt GetParentalAllowedAge();
71     /**
72      * Retrieve Parental mode maximal allowed age
73      *
74      * @return NULL if allowed age not set, else pointer value is allowed age
75      */
76
77     static bool IsValidSubTag(const DPL::String& tag, int type);
78
79     static bool IsPowderRulePresent(
80             const ChildProtection::PowderRules::CategoryRule& rule);
81
82     static ChildProtection::PowderRules GetPowderRules();
83
84     static ChildProtection::BlackList GetAdultBlackList();
85
86     static bool IsElementOnAdultBlackList(const DPL::String &url);
87
88     /**
89      * Retrieve list of deffered widget packages to be installed
90      *
91      * @return Widget package list
92      */
93     static WidgetPackageList GetDefferedWidgetPackageInstallationList();
94
95     static bool GetDeveloperMode();
96
97     static bool GetSecureByDefault();
98
99     static bool getComplianceMode();
100
101     static std::string getComplianceFakeImei();
102
103     static std::string getComplianceFakeMeid();
104
105     static WidgetAccessInfoList GetWhiteURIList();
106
107     enum NetworkAccessMode
108     {
109         NEVER_CONNECT,
110         ALWAYS_ASK,
111         CONNECT_AUTOMATICALLY
112     };
113
114     /**
115      * This method returns network access mode for home network.
116      *
117      * @return Access mode for home network.
118      */
119     static NetworkAccessMode GetHomeNetworkDataUsage();
120
121     /**
122      * This method returns network access mode while roaming is enabled.
123      *
124      * @return Access mode for home network.
125      */
126     static NetworkAccessMode GetRoamingDataUsage();
127
128     static DPL::String GetUserAgentValue(const DPL::String &key);
129
130     /**
131      * This method returns set of device capabilities used by apifeature.
132      */
133     static DeviceCapabilitySet GetDeviceCapability(
134             const DPL::String &apifeature);
135
136
137     /**
138      * This method gets Autofill for Webkit
139      */
140     struct AutoSaveData
141     {
142         DPL::String userId;
143         DPL::String passwd;
144     };
145
146     static DPL::Optional<AutoSaveData> GetAutoSaveIdPasswd(
147             const DPL::String &url);
148
149   protected:
150     GlobalDAOReadOnly()
151     {
152     }
153 };
154
155 } // namespace WrtDB
156
157 #endif // WRT_SRC_CONFIGURATION_GLOBAL_DAO_READ_ONLY_H_