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 FWebCtrlWeb.cpp
20 * @brief The file contains the definition of Web class.
22 * The file contains the definition of Web class.
24 #include <FBaseResult.h>
25 #include <FBaseSysLog.h>
26 #include <FGrpPoint.h>
27 #include <FGrpRectangle.h>
28 #include <FNetHttpHttpHeader.h>
29 #include <FWebCtrlHitElementResult.h>
30 #include <FWebCtrlPageNavigationList.h>
31 #include <FWebCtrlWeb.h>
32 #include <FWebCtrlWebSetting.h>
33 #include <FSec_AccessController.h>
34 #include "FWebCtrl_WebImpl.h"
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Collection;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Net::Http;
41 using namespace Tizen::Security;
44 namespace Tizen { namespace Web { namespace Controls
59 Web::Construct(const Rectangle& rect)
61 SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
65 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
66 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
68 _WebImpl* pWebImpl = _WebImpl::CreateWebImplN(const_cast< Web* >(this), rect);
69 SysTryReturn(NID_WEB_CTRL, pWebImpl, GetLastResult(), GetLastResult(), "[%s] This instance has not been constructed as yet.", GetErrorMessage(GetLastResult()));
71 _pControlImpl = pWebImpl;
73 SysLog(NID_WEB_CTRL, "rect.x : %d, rect.y : %d, rect.width : %d, rect.height : %d", rect.x, rect.y, rect.width, rect.height);
80 Web::Construct(const FloatRectangle& rect)
82 SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
86 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
87 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
89 _WebImpl* pWebImpl = _WebImpl::CreateWebImplN(const_cast< Web* >(this), rect);
90 SysTryReturn(NID_WEB_CTRL, pWebImpl, GetLastResult(), GetLastResult(), "[%s] This instance has not been constructed as yet.", GetErrorMessage(GetLastResult()));
92 _pControlImpl = pWebImpl;
94 SysLog(NID_WEB_CTRL, "rect.x : %f, rect.y : %f, rect.width : %f, rect.height : %f", rect.x, rect.y, rect.width, rect.height);
101 Web::LoadUrl(const String& url)
103 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
104 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
107 result r = E_SUCCESS;
109 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
110 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
112 r = pWebImpl->LoadUrl(url);
113 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
115 SysLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
120 Web::LoadUrl(const String& url, const HttpHeader& header)
122 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
123 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
125 result r = E_SUCCESS;
127 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
128 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
130 r = pWebImpl->LoadUrl(url, header);
131 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
133 SysLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
140 Web::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body)
142 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
143 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
145 result r = E_SUCCESS;
147 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
148 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
150 SysLog(NID_WEB_CTRL, "The current value of url is %ls, header is %d, body is %ls", url.GetPointer(), &header, (char*) body.GetPointer());
152 r = pWebImpl->LoadUrlWithPostRequest(url, header, body);
153 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
160 Web::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding)
162 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
163 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
166 result r = E_SUCCESS;
168 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
169 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
171 r = pWebImpl->LoadData(baseUrl, content, mime, encoding);
172 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
174 SysLog(NID_WEB_CTRL, "baseUrl : %ls, content : %ls, mime : %ls, encoding : %ls", baseUrl.GetPointer(), reinterpret_cast < const char* >(content.GetPointer()), mime.GetPointer(), encoding.GetPointer());
179 Web::StopLoading(void)
181 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
182 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
185 result r = E_SUCCESS;
187 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
188 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
190 pWebImpl->StopLoading();
197 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
198 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
201 result r = E_SUCCESS;
203 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
204 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
211 Web::IsLoading(void) const
213 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
214 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
216 return pWebImpl->IsLoading();
221 Web::CanGoBack(void) const
223 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
224 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
226 return pWebImpl->CanGoBack();
231 Web::CanGoForward(void) const
233 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
234 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
236 return pWebImpl->CanGoForward();
243 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
244 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
247 result r = E_SUCCESS;
249 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
250 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
259 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
260 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
263 result r = E_SUCCESS;
265 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
266 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
268 pWebImpl->GoForward();
273 Web::GetBackForwardListN(void) const
275 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
276 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
280 const PageNavigationList* pList = pWebImpl->GetBackForwardListN();
281 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Failed to get PageNavigationList.", GetErrorMessage(GetLastResult()));
283 return const_cast< PageNavigationList* >(pList);
288 Web::SearchText(const String& word, bool searchForward)
290 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
291 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
293 SysLog(NID_WEB_CTRL, "The current value of word is %ls, searchForward is %d", word.GetPointer(), searchForward);
295 return pWebImpl->SearchText(word, searchForward);
300 Web::SetSetting(const WebSetting& setting)
302 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
303 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
305 result r = E_SUCCESS;
307 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
308 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
310 r = pWebImpl->SetSetting(setting);
311 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to set setting.", GetErrorMessage(r));
318 Web::GetSetting(void) const
320 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
321 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
323 return pWebImpl->GetSetting();
328 Web::GetElementByPointN(const Point& point) const
330 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
331 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
335 const HitElementResult* pResult = pWebImpl->GetElementByPointN(point);
336 SysTryReturn(NID_WEB_CTRL, pResult, null, GetLastResult(), "[%s] Failed to get HitElementResult.", GetErrorMessage(GetLastResult()));
338 return const_cast< HitElementResult* >(pResult);
343 Web::GetElementByPointN(const FloatPoint& point) const
345 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
346 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
350 const HitElementResult* pResult = pWebImpl->GetElementByPointN(point);
351 SysTryReturn(NID_WEB_CTRL, pResult, null, GetLastResult(), "[%s] Failed to get HitElementResult.", GetErrorMessage(GetLastResult()));
353 return const_cast< HitElementResult* >(pResult);
358 Web::EvaluateJavascriptN(const String& scriptCode)
360 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
361 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
364 result r = E_SUCCESS;
366 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
367 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
369 String* pScript = pWebImpl->EvaluateJavascriptN(scriptCode);
370 SysTryReturn(NID_WEB_CTRL, pScript, null, GetLastResult(), "[%s] Failed to evaluate javascript.", GetErrorMessage(GetLastResult()));
372 SysLog(NID_WEB_CTRL, "The current value of scriptCode is %ls", scriptCode.GetPointer());
379 Web::SetZoomLevel(float level)
381 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
382 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
384 result r = E_SUCCESS;
386 r = pWebImpl->SetZoomLevel(level);
387 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
389 SysLog(NID_WEB_CTRL, "The current value of level is %f", level);
396 Web::GetZoomLevel(void) const
398 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
399 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
401 return pWebImpl->GetZoomLevel();
406 Web::GetTitle(void) const
408 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
409 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
411 return pWebImpl->GetTitle();
416 Web::GetUrl(void) const
418 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
419 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
421 return pWebImpl->GetUrl();
426 Web::IsMimeSupported(const String& mime) const
428 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
429 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructedl. Construct() should be called before use.");
431 SysLog(NID_WEB_CTRL, "The current value of mime is %ls", mime.GetPointer());
433 return pWebImpl->IsMimeSupported(mime);
438 Web::SetLoadingListener(ILoadingListener* pLoadingListener)
440 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
441 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
444 result r = E_SUCCESS;
446 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
447 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
449 pWebImpl->SetLoadingListener(pLoadingListener);
451 SysLog(NID_WEB_CTRL, "The current value of pLoadingListener is %u", pLoadingListener);
456 Web::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
458 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
459 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
462 result r = E_SUCCESS;
464 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
465 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
467 pWebImpl->SetDownloadListener(pDownLoadListener);
469 SysLog(NID_WEB_CTRL, "The current value of pDownLoadListener is %u", pDownLoadListener);
474 Web::SetBlockSelectionPosition(const Point& startPoint)
476 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
477 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
479 result r = E_SUCCESS;
481 r = pWebImpl->SetBlockSelectionPosition(startPoint);
482 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
489 Web::SetBlockSelectionPosition(const FloatPoint& startPoint)
491 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
492 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
494 result r = E_SUCCESS;
496 r = pWebImpl->SetBlockSelectionPosition(startPoint);
497 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
504 Web::ReleaseBlock(void)
506 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
507 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
509 pWebImpl->ReleaseBlock();
516 Web::GetBlockRange(Point& startPoint, Point& endPoint) const
518 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
519 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
521 pWebImpl->GetBlockRange(startPoint, endPoint);
528 Web::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
530 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
531 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
533 pWebImpl->GetBlockRange(startPoint, endPoint);
540 Web::GetTextFromBlock(void) const
542 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
543 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
545 return pWebImpl->GetTextFromBlock();
550 Web::SetScrollEnabled(bool enable)
552 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
553 SysAssertf(pWebImpl != null, "Not yet constructed or Not attached to parent control.");
555 pWebImpl->SetScrollEnabled(enable);
557 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
564 Web::IsScrollEnabled(void) const
566 const _WebImpl* pWebImpl = const_cast< _WebImpl* >(_WebImpl::GetInstance(this));
567 SysAssertf(pWebImpl != null, "Not yet constructed or Not attached to parent control.");
569 return pWebImpl->IsScrollEnabled();
574 Web::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
576 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
577 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
579 pWebImpl->SetWebUiEventListener(pUiEventListener);
581 SysLog(NID_WEB_CTRL, "The current value of pUiEventListener is %u", pUiEventListener);
586 Web::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
588 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
589 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
591 pWebImpl->SetWebUiEventListenerF(pUiEventListener);
593 SysLog(NID_WEB_CTRL, "The current value of pUiEventListener is %u", pUiEventListener);
598 Web::SearchTextAllAsync(const String& text, bool caseSensitive)
600 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
601 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
603 result r = E_SUCCESS;
605 r = pWebImpl->SearchTextAllAsync(text, caseSensitive);
606 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
608 SysLog(NID_WEB_CTRL, "The current value of text is %ls, caseSensitive is %d", text.GetPointer(), caseSensitive);
615 Web::SearchNextAsync(bool searchForward)
617 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
618 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
620 result r = E_SUCCESS;
622 r = pWebImpl->SearchNextAsync(searchForward);
623 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
625 SysLog(NID_WEB_CTRL, "The current value of searchForward is %d", searchForward);
632 Web::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
634 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
635 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
637 pWebImpl->SetTextSearchListener(pTextSearchListener);
639 SysLog(NID_WEB_CTRL, "The current value of pTextSearchListener is %u", pTextSearchListener);
644 Web::IsPrivateBrowsingEnabled(void) const
646 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
647 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
649 return pWebImpl->IsPrivateBrowsingEnabled();
654 Web::SetPrivateBrowsingEnabled(bool enable)
656 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
657 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
659 result r = E_SUCCESS;
661 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
662 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
664 pWebImpl->SetPrivateBrowsingEnabled(enable);
666 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
673 Web::ClearHistory(void)
675 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
676 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
678 result r = E_SUCCESS;
680 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
681 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s]The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
683 pWebImpl->ClearHistory();
690 Web::ClearCache(void)
692 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
693 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
695 result r = E_SUCCESS;
697 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
698 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s]The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
700 pWebImpl->ClearCache();
707 Web::ClearCookie(void)
709 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
710 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
712 result r = E_SUCCESS;
714 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
715 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s]The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
717 pWebImpl->ClearCookie();
724 Web::ClearFormData(void)
726 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
727 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
729 result r = E_SUCCESS;
731 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
732 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s]The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
734 pWebImpl->ClearFormData();
741 Web::ClearLoginFormData(void)
743 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
744 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
746 result r = E_SUCCESS;
748 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
749 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s]The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
751 pWebImpl->ClearLoginFormData();
758 Web::IsCookieEnabled(void) const
760 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
761 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
763 return pWebImpl->IsCookieEnabled();
768 Web::SetCookieEnabled(bool enable)
770 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
771 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
773 result r = E_SUCCESS;
775 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
776 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
778 pWebImpl->SetCookieEnabled(enable);
780 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
787 Web::SavePageAsPdf(const String& filePath, const Dimension* pSize)
789 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
790 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed. Construct() should be called before use.");
792 result r = E_SUCCESS;
794 r = pWebImpl->SavePageAsPdf(filePath, pSize);
795 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
797 SysLog(NID_WEB_CTRL, "The current value of filePath is %ls, pSize is %u", filePath.GetPointer(), pSize);
804 Web::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
806 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
807 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
809 result r = E_SUCCESS;
811 r = pWebImpl->AddJavaScriptBridge(jsBridge);
812 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
819 Web::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
821 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
822 SysAssertf(pWebImpl != null, "Not yet constructed or Not attached to parent control.");
824 result r = E_SUCCESS;
826 r = pWebImpl->RemoveJavaScriptBridge(jsBridge);
827 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
834 Web::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
836 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
837 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
839 pWebImpl->SetWebKeypadEventListener(pKeypadEventListener);
841 SysLog(NID_WEB_CTRL, "The current value of pKeypadEventListener is %u", pKeypadEventListener);
846 Web::GetFaviconN(void) const
848 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
849 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed. Construct() should be called before use.");
853 Bitmap* pFavicon = pWebImpl->GetFaviconN();
854 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
863 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
864 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructedl. Construct() should be called before use.");
873 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
874 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructedl. Construct() should be called before use.");
881 Web::ScrollBy(const Tizen::Graphics::Point& diff)
883 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
884 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
886 pWebImpl->ScrollBy(diff);
891 Web::ScrollTo(const Tizen::Graphics::Point& dest)
893 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
894 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
896 pWebImpl->ScrollTo(dest);
901 Web::GetScrollPosition(void) const
903 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
904 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
906 return pWebImpl->GetScrollPosition();
911 Web::GetPageSize(void) const
913 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
914 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
916 return pWebImpl->GetPageSize();
920 }}} // Tizen::Web::Controls