2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FWebCtrlWebSetting.cpp
20 * @brief The file contains the definition of WebSetting class.
22 * The file contains the definition of WebSetting class.
25 #include <FBaseResult.h>
26 #include <FBaseSysLog.h>
27 #include <FWebCtrlWebSetting.h>
28 #include "FWebCtrl_WebSettingImpl.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Ui::Controls;
35 namespace Tizen { namespace Web { namespace Controls
39 WebSetting::WebSetting(void)
40 : __pWebSettingImpl(new (std::nothrow) _WebSettingImpl())
42 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebSettingImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
46 WebSetting::WebSetting(const WebSetting& setting)
47 : __pWebSettingImpl(new (std::nothrow) _WebSettingImpl(*_WebSettingImpl::GetInstance(&setting)))
49 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebSettingImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
54 WebSetting::operator =(const WebSetting& setting)
61 Object::operator =(setting);
62 _WebSettingImpl* pImpl = _WebSettingImpl::GetInstance(this);
65 *pImpl = *_WebSettingImpl::GetInstance(&setting);
72 WebSetting::~WebSetting(void)
74 delete __pWebSettingImpl;
75 __pWebSettingImpl = null;
80 WebSetting::SetCacheControl(CacheMode mode)
82 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
84 __pWebSettingImpl->SetCacheControl(mode);
86 SysLog(NID_WEB_CTRL, "The current value of mode is %d", mode);
91 WebSetting::GetCacheControl(void) const
93 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
95 return __pWebSettingImpl->GetCacheControl();
100 WebSetting::SetFontSize(int fontSize)
102 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
104 __pWebSettingImpl->SetFontSize(fontSize);
106 SysLog(NID_WEB_CTRL, "The current value of fontSize is %d", fontSize);
111 WebSetting::GetFontSize(void) const
113 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
115 return __pWebSettingImpl->GetFontSize();
120 WebSetting::SetDefaultTextEncoding(const String& encoding)
122 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
124 __pWebSettingImpl->SetDefaultTextEncoding(encoding);
126 SysLog(NID_WEB_CTRL, "The current value of encoding is %ls", encoding.GetPointer());
131 WebSetting::GetDefaultTextEncoding(void) const
133 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
135 return __pWebSettingImpl->GetDefaultTextEncoding();
140 WebSetting::SetJavascriptEnabled(bool enable)
142 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
144 __pWebSettingImpl->SetJavascriptEnabled(enable);
146 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
151 WebSetting::SetAutoImageLoadEnabled(bool enable)
153 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
155 __pWebSettingImpl->SetAutoImageLoadEnabled(enable);
157 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
162 WebSetting::IsJavascriptEnabled(void) const
164 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
166 return __pWebSettingImpl->IsJavascriptEnabled();
171 WebSetting::IsAutoImageLoadEnabled(void) const
173 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
175 return __pWebSettingImpl->IsAutoImageLoadEnabled();
180 WebSetting::SetInputStyle(InputStyle inputStyle)
182 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
184 __pWebSettingImpl->SetInputStyle(inputStyle);
186 SysLog(NID_WEB_CTRL, "The current value of inputStyle is %d", inputStyle);
191 WebSetting::GetInputStyle(void) const
193 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
195 return __pWebSettingImpl->GetInputStyle();
200 WebSetting::SetCertificateErrorHandlingMode(CertificateErrorHandlingMode mode)
202 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
204 __pWebSettingImpl->SetCertificateErrorHandlingMode(mode);
206 SysLog(NID_WEB_CTRL, "The current value of mode is %d", mode);
210 CertificateErrorHandlingMode
211 WebSetting::GetCertificateErrorHandlingMode(void) const
213 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
215 return __pWebSettingImpl->GetCertificateErrorHandlingMode();
220 WebSetting::SetUserAgent(const String& agent)
222 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
224 __pWebSettingImpl->SetUserAgent(agent);
226 SysLog(NID_WEB_CTRL, "The current value of agent is %ls", agent.GetPointer());
231 WebSetting::GetUserAgent(void) const
233 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
235 return __pWebSettingImpl->GetUserAgent();
240 WebSetting::SetAutoFittingEnabled(bool enable)
242 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
244 __pWebSettingImpl->SetAutoFittingEnabled(enable);
246 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
251 WebSetting::IsAutoFittingEnabled(void) const
253 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
255 return __pWebSettingImpl->IsAutoFittingEnabled();
260 WebSetting::SetJavaScriptPopupEnabled(bool enable)
262 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
264 __pWebSettingImpl->SetJavaScriptPopupEnabled(enable);
266 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
271 WebSetting::IsJavaScriptPopupEnabled(void) const
273 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
275 return __pWebSettingImpl->IsJavaScriptPopupEnabled();
280 WebSetting::SetGeolocationEnabled(bool enable)
282 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
284 __pWebSettingImpl->SetGeolocationEnabled(enable);
286 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
291 WebSetting::IsGeolocationEnabled(void) const
293 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
295 return __pWebSettingImpl->IsGeolocationEnabled();
300 WebSetting::SetAutoFormDataShowEnabled(bool enable)
302 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
304 __pWebSettingImpl->SetAutoFormDataShowEnabled(enable);
306 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
311 WebSetting::IsAutoFormDataShowEnabled(void) const
313 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
315 return __pWebSettingImpl->IsAutoFormDataShowEnabled();
320 WebSetting::SetAutoLoginFormFillEnabled(bool enable)
322 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
324 __pWebSettingImpl->SetAutoLoginFormFillEnabled(enable);
326 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
331 WebSetting::IsAutoLoginFormFillEnabled(void) const
333 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
335 return __pWebSettingImpl->IsAutoLoginFormFillEnabled();
340 WebSetting::Equals(const Object& obj) const
342 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
344 const WebSetting* pRhs = dynamic_cast< const WebSetting* >(&obj);
350 return __pWebSettingImpl->Equals(*pRhs->__pWebSettingImpl);
355 WebSetting::GetHashCode(void) const
357 SysAssertf(__pWebSettingImpl != null, "Not yet constructed. Construct() should be called before use.");
359 return __pWebSettingImpl->GetHashCode();
363 }}} // Tizen::Web::Controls