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 <FSysVibrator.h>
30 #include <FWebCtrlHitElementResult.h>
31 #include <FWebCtrlPageNavigationList.h>
32 #include <FWebCtrlWeb.h>
33 #include <FWebCtrlWebSetting.h>
34 #include <FSec_AccessController.h>
35 #include <FSys_VibratorImpl.h>
36 #include "FWebCtrl_WebImpl.h"
39 using namespace Tizen::Base;
40 using namespace Tizen::Base::Collection;
41 using namespace Tizen::Graphics;
42 using namespace Tizen::Net::Http;
43 using namespace Tizen::Security;
46 namespace Tizen { namespace Web { namespace Controls
61 Web::Construct(const Rectangle& rect)
63 SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
67 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
68 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
69 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
71 _WebImpl* pWebImpl = _WebImpl::CreateWebImplN(const_cast< Web* >(this), rect);
72 SysTryReturn(NID_WEB_CTRL, pWebImpl, GetLastResult(), GetLastResult(), "[%s] This instance has not been constructed as yet.", GetErrorMessage(GetLastResult()));
74 _pControlImpl = pWebImpl;
76 SysLog(NID_WEB_CTRL, "rect.x : %d, rect.y : %d, rect.width : %d, rect.height : %d", rect.x, rect.y, rect.width, rect.height);
83 Web::Construct(const FloatRectangle& rect)
85 SysAssertf(_pControlImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
89 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
90 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
91 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
93 _WebImpl* pWebImpl = _WebImpl::CreateWebImplN(const_cast< Web* >(this), rect);
94 SysTryReturn(NID_WEB_CTRL, pWebImpl, GetLastResult(), GetLastResult(), "[%s] This instance has not been constructed as yet.", GetErrorMessage(GetLastResult()));
96 _pControlImpl = pWebImpl;
98 SysLog(NID_WEB_CTRL, "rect.x : %f, rect.y : %f, rect.width : %f, rect.height : %f", rect.x, rect.y, rect.width, rect.height);
105 Web::LoadUrl(const String& url)
107 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
108 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
111 result r = E_SUCCESS;
113 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
114 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
115 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
117 r = pWebImpl->LoadUrl(url);
118 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
120 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
125 Web::LoadUrl(const String& url, const HttpHeader& header)
127 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
128 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
130 result r = E_SUCCESS;
132 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
133 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
134 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
136 r = pWebImpl->LoadUrl(url, header);
137 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
139 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
146 Web::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body)
148 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
149 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
151 result r = E_SUCCESS;
153 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
154 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
155 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
157 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, header is %d, body is %ls", url.GetPointer(), &header, (char*) body.GetPointer());
159 r = pWebImpl->LoadUrlWithPostRequest(url, header, body);
160 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
167 Web::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding)
169 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
170 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
173 result r = E_SUCCESS;
175 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
176 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
177 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
179 r = pWebImpl->LoadData(baseUrl, content, mime, encoding);
180 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
182 SysSecureLog(NID_WEB_CTRL, "baseUrl : %ls, content : %ls, mime : %ls, encoding : %ls", baseUrl.GetPointer(), reinterpret_cast < const char* >(content.GetPointer()), mime.GetPointer(), encoding.GetPointer());
187 Web::StopLoading(void)
189 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
190 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
193 result r = E_SUCCESS;
195 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
196 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
197 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
199 pWebImpl->StopLoading();
206 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
207 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
210 result r = E_SUCCESS;
212 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
213 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
214 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
221 Web::IsLoading(void) const
223 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
224 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
226 return pWebImpl->IsLoading();
231 Web::CanGoBack(void) const
233 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
234 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
236 return pWebImpl->CanGoBack();
241 Web::CanGoForward(void) const
243 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
244 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
246 return pWebImpl->CanGoForward();
253 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
254 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
257 result r = E_SUCCESS;
259 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
260 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
261 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
270 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
271 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
274 result r = E_SUCCESS;
276 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
277 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
278 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
280 pWebImpl->GoForward();
285 Web::GetBackForwardListN(void) const
287 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
288 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
292 const PageNavigationList* pList = pWebImpl->GetBackForwardListN();
293 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Failed to get PageNavigationList.", GetErrorMessage(GetLastResult()));
295 return const_cast< PageNavigationList* >(pList);
300 Web::SearchText(const String& word, bool searchForward)
302 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
303 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
305 SysLog(NID_WEB_CTRL, "The current value of word is %ls, searchForward is %d", word.GetPointer(), searchForward);
307 return pWebImpl->SearchText(word, searchForward);
312 Web::SetSetting(const WebSetting& setting)
314 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
315 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
317 result r = E_SUCCESS;
319 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
320 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
321 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
323 r = pWebImpl->SetSetting(setting);
324 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to set setting.", GetErrorMessage(r));
331 Web::GetSetting(void) const
333 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
334 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
336 return pWebImpl->GetSetting();
341 Web::GetElementByPointN(const Point& point) const
343 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
344 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
348 const HitElementResult* pResult = pWebImpl->GetElementByPointN(point);
349 SysTryReturn(NID_WEB_CTRL, pResult, null, GetLastResult(), "[%s] Failed to get HitElementResult.", GetErrorMessage(GetLastResult()));
351 return const_cast< HitElementResult* >(pResult);
356 Web::GetElementByPointN(const FloatPoint& point) const
358 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
359 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
363 const HitElementResult* pResult = pWebImpl->GetElementByPointN(point);
364 SysTryReturn(NID_WEB_CTRL, pResult, null, GetLastResult(), "[%s] Failed to get HitElementResult.", GetErrorMessage(GetLastResult()));
366 return const_cast< HitElementResult* >(pResult);
371 Web::EvaluateJavascriptN(const String& scriptCode)
373 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
374 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
377 result r = E_SUCCESS;
379 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
380 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
381 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
383 String* pScript = pWebImpl->EvaluateJavascriptN(scriptCode);
384 SysTryReturn(NID_WEB_CTRL, pScript, null, GetLastResult(), "[%s] Failed to evaluate javascript.", GetErrorMessage(GetLastResult()));
386 SysLog(NID_WEB_CTRL, "The current value of scriptCode is %ls", scriptCode.GetPointer());
393 Web::SetZoomLevel(float level)
395 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
396 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
398 result r = E_SUCCESS;
400 r = pWebImpl->SetZoomLevel(level);
401 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
403 SysLog(NID_WEB_CTRL, "The current value of level is %f", level);
410 Web::GetZoomLevel(void) const
412 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
413 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
415 return pWebImpl->GetZoomLevel();
420 Web::GetTitle(void) const
422 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
423 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
425 return pWebImpl->GetTitle();
430 Web::GetUrl(void) const
432 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
433 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
435 return pWebImpl->GetUrl();
440 Web::IsMimeSupported(const String& mime) const
442 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
443 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
445 SysLog(NID_WEB_CTRL, "The current value of mime is %ls", mime.GetPointer());
447 return pWebImpl->IsMimeSupported(mime);
452 Web::SetLoadingListener(ILoadingListener* pLoadingListener)
454 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
455 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
458 result r = E_SUCCESS;
460 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
461 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
462 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
464 pWebImpl->SetLoadingListener(pLoadingListener);
466 SysLog(NID_WEB_CTRL, "The current value of pLoadingListener is %u", pLoadingListener);
471 Web::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
473 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
474 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
477 result r = E_SUCCESS;
479 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
480 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
481 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
483 pWebImpl->SetDownloadListener(pDownLoadListener);
485 SysLog(NID_WEB_CTRL, "The current value of pDownLoadListener is %u", pDownLoadListener);
490 Web::SetBlockSelectionPosition(const Point& startPoint)
492 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
493 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
495 result r = E_SUCCESS;
497 r = pWebImpl->SetBlockSelectionPosition(startPoint);
498 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
505 Web::SetBlockSelectionPosition(const FloatPoint& startPoint)
507 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
508 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
510 result r = E_SUCCESS;
512 r = pWebImpl->SetBlockSelectionPosition(startPoint);
513 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
520 Web::ReleaseBlock(void)
522 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
523 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
525 pWebImpl->ReleaseBlock();
532 Web::GetBlockRange(Point& startPoint, Point& endPoint) const
534 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
535 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
537 pWebImpl->GetBlockRange(startPoint, endPoint);
544 Web::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
546 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
547 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
549 pWebImpl->GetBlockRange(startPoint, endPoint);
556 Web::GetTextFromBlock(void) const
558 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
559 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
561 return pWebImpl->GetTextFromBlock();
566 Web::SetScrollEnabled(bool enable)
568 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
569 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
571 pWebImpl->SetScrollEnabled(enable);
573 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
580 Web::IsScrollEnabled(void) const
582 const _WebImpl* pWebImpl = const_cast< _WebImpl* >(_WebImpl::GetInstance(this));
583 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
585 return pWebImpl->IsScrollEnabled();
590 Web::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
592 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
593 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
595 pWebImpl->SetWebUiEventListener(pUiEventListener);
597 SysLog(NID_WEB_CTRL, "The current value of pUiEventListener is %u", pUiEventListener);
602 Web::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
604 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
605 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
607 pWebImpl->SetWebUiEventListenerF(pUiEventListener);
609 SysLog(NID_WEB_CTRL, "The current value of pUiEventListener is %u", pUiEventListener);
614 Web::SearchTextAllAsync(const String& text, bool caseSensitive)
616 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
617 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
619 result r = E_SUCCESS;
621 r = pWebImpl->SearchTextAllAsync(text, caseSensitive);
622 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
624 SysLog(NID_WEB_CTRL, "The current value of text is %ls, caseSensitive is %d", text.GetPointer(), caseSensitive);
631 Web::SearchNextAsync(bool searchForward)
633 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
634 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
636 result r = E_SUCCESS;
638 r = pWebImpl->SearchNextAsync(searchForward);
639 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
641 SysLog(NID_WEB_CTRL, "The current value of searchForward is %d", searchForward);
648 Web::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
650 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
651 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
653 pWebImpl->SetTextSearchListener(pTextSearchListener);
655 SysLog(NID_WEB_CTRL, "The current value of pTextSearchListener is %u", pTextSearchListener);
660 Web::IsPrivateBrowsingEnabled(void) const
662 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
663 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
665 return pWebImpl->IsPrivateBrowsingEnabled();
670 Web::SetPrivateBrowsingEnabled(bool enable)
672 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
673 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
675 result r = E_SUCCESS;
677 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
678 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
679 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
681 pWebImpl->SetPrivateBrowsingEnabled(enable);
683 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
690 Web::ClearHistory(void)
692 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
693 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
695 result r = E_SUCCESS;
697 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
698 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
699 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
701 pWebImpl->ClearHistory();
708 Web::ClearCache(void)
710 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
711 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
713 result r = E_SUCCESS;
715 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
716 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
717 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
719 pWebImpl->ClearCache();
726 Web::ClearCookie(void)
728 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
729 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
731 result r = E_SUCCESS;
733 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
734 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
735 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
737 pWebImpl->ClearCookie();
744 Web::ClearFormData(void)
746 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
747 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
749 result r = E_SUCCESS;
751 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
752 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
753 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
755 pWebImpl->ClearFormData();
762 Web::ClearLoginFormData(void)
764 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
765 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
767 result r = E_SUCCESS;
769 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
770 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
771 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
773 pWebImpl->ClearLoginFormData();
780 Web::IsCookieEnabled(void) const
782 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
783 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
785 return pWebImpl->IsCookieEnabled();
790 Web::SetCookieEnabled(bool enable)
792 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
793 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
795 result r = E_SUCCESS;
797 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
798 r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
799 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
801 pWebImpl->SetCookieEnabled(enable);
803 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
810 Web::SavePageAsPdf(const String& filePath, const Dimension* pSize)
812 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
813 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
815 result r = E_SUCCESS;
817 r = pWebImpl->SavePageAsPdf(filePath, pSize);
818 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
820 SysLog(NID_WEB_CTRL, "The current value of filePath is %ls, pSize is %u", filePath.GetPointer(), pSize);
827 Web::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
829 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
830 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
832 result r = E_SUCCESS;
834 r = pWebImpl->AddJavaScriptBridge(jsBridge);
835 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
842 Web::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
844 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
845 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
847 result r = E_SUCCESS;
849 r = pWebImpl->RemoveJavaScriptBridge(jsBridge);
850 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
857 Web::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
859 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
860 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
862 pWebImpl->SetWebKeypadEventListener(pKeypadEventListener);
864 SysLog(NID_WEB_CTRL, "The current value of pKeypadEventListener is %u", pKeypadEventListener);
869 Web::GetFaviconN(void) const
871 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
872 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
876 Bitmap* pFavicon = pWebImpl->GetFaviconN();
877 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
886 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
887 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
896 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
897 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
904 Web::ScrollBy(const Tizen::Graphics::Point& diff)
906 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
907 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
909 pWebImpl->ScrollBy(diff);
914 Web::ScrollTo(const Tizen::Graphics::Point& dest)
916 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
917 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
919 pWebImpl->ScrollTo(dest);
924 Web::GetScrollPosition(void) const
926 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
927 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
929 return pWebImpl->GetScrollPosition();
934 Web::GetPageSize(void) const
936 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
937 SysAssertf(pWebImpl, "Not yet constructed. Construct() should be called before use.");
939 return pWebImpl->GetPageSize();
943 }}} // Tizen::Web::Controls