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 result r = E_SUCCESS;
511 pWebImpl->ReleaseBlock();
518 Web::GetBlockRange(Point& startPoint, Point& endPoint) const
520 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
521 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
523 result r = E_SUCCESS;
525 pWebImpl->GetBlockRange(startPoint, endPoint);
532 Web::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
534 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
535 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
537 result r = E_SUCCESS;
539 pWebImpl->GetBlockRange(startPoint, endPoint);
546 Web::GetTextFromBlock(void) const
548 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
549 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
551 return pWebImpl->GetTextFromBlock();
556 Web::SetScrollEnabled(bool enable)
558 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
559 SysAssertf(pWebImpl != null, "Not yet constructed or Not attached to parent control.");
561 pWebImpl->SetScrollEnabled(enable);
563 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
570 Web::IsScrollEnabled(void) const
572 const _WebImpl* pWebImpl = const_cast< _WebImpl* >(_WebImpl::GetInstance(this));
573 SysAssertf(pWebImpl != null, "Not yet constructed or Not attached to parent control.");
575 return pWebImpl->IsScrollEnabled();
580 Web::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
582 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
583 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
585 pWebImpl->SetWebUiEventListener(pUiEventListener);
587 SysLog(NID_WEB_CTRL, "The current value of pUiEventListener is %u", pUiEventListener);
592 Web::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
594 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
595 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
597 pWebImpl->SetWebUiEventListenerF(pUiEventListener);
599 SysLog(NID_WEB_CTRL, "The current value of pUiEventListener is %u", pUiEventListener);
604 Web::SearchTextAllAsync(const String& text, bool caseSensitive)
606 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
607 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
609 result r = E_SUCCESS;
611 r = pWebImpl->SearchTextAllAsync(text, caseSensitive);
612 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
614 SysLog(NID_WEB_CTRL, "The current value of text is %ls, caseSensitive is %d", text.GetPointer(), caseSensitive);
621 Web::SearchNextAsync(bool searchForward)
623 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
624 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
626 result r = E_SUCCESS;
628 r = pWebImpl->SearchNextAsync(searchForward);
629 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
631 SysLog(NID_WEB_CTRL, "The current value of searchForward is %d", searchForward);
638 Web::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
640 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
641 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
643 pWebImpl->SetTextSearchListener(pTextSearchListener);
645 SysLog(NID_WEB_CTRL, "The current value of pTextSearchListener is %u", pTextSearchListener);
650 Web::IsPrivateBrowsingEnabled(void) const
652 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
653 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
655 return pWebImpl->IsPrivateBrowsingEnabled();
660 Web::SetPrivateBrowsingEnabled(bool enable)
662 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
663 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
665 result r = E_SUCCESS;
667 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
668 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
670 pWebImpl->SetPrivateBrowsingEnabled(enable);
672 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
679 Web::ClearHistory(void)
681 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
682 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
684 result r = E_SUCCESS;
686 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
687 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));
689 pWebImpl->ClearHistory();
696 Web::ClearCache(void)
698 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
699 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
701 result r = E_SUCCESS;
703 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
704 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));
706 pWebImpl->ClearCache();
713 Web::ClearCookie(void)
715 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
716 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
718 result r = E_SUCCESS;
720 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
721 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));
723 pWebImpl->ClearCookie();
730 Web::ClearFormData(void)
732 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
733 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
735 result r = E_SUCCESS;
737 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
738 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));
740 pWebImpl->ClearFormData();
747 Web::ClearLoginFormData(void)
749 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
750 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
752 result r = E_SUCCESS;
754 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
755 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));
757 pWebImpl->ClearLoginFormData();
764 Web::IsCookieEnabled(void) const
766 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
767 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
769 return pWebImpl->IsCookieEnabled();
774 Web::SetCookieEnabled(bool enable)
776 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
777 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
779 result r = E_SUCCESS;
781 r = _AccessController::CheckUserPrivilege(_PRV_WEB_SERVICE);
782 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));
784 pWebImpl->SetCookieEnabled(enable);
786 SysLog(NID_WEB_CTRL, "The current value of enable is %d", enable);
793 Web::SavePageAsPdf(const String& filePath, const Dimension* pSize)
795 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
796 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed. Construct() should be called before use.");
798 result r = E_SUCCESS;
800 r = pWebImpl->SavePageAsPdf(filePath, pSize);
801 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
803 SysLog(NID_WEB_CTRL, "The current value of filePath is %ls, pSize is %u", filePath.GetPointer(), pSize);
810 Web::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
812 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
813 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
815 result r = E_SUCCESS;
817 r = pWebImpl->AddJavaScriptBridge(jsBridge);
818 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
825 Web::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
827 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
828 SysAssertf(pWebImpl != null, "Not yet constructed or Not attached to parent control.");
830 result r = E_SUCCESS;
832 r = pWebImpl->RemoveJavaScriptBridge(jsBridge);
833 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
840 Web::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
842 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
843 SysAssertf(pWebImpl != null, "Not yet constructedl. Construct() should be called before use.");
845 pWebImpl->SetWebKeypadEventListener(pKeypadEventListener);
847 SysLog(NID_WEB_CTRL, "The current value of pKeypadEventListener is %u", pKeypadEventListener);
852 Web::GetFaviconN(void) const
854 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
855 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed. Construct() should be called before use.");
859 Bitmap* pFavicon = pWebImpl->GetFaviconN();
860 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
869 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
870 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructedl. Construct() should be called before use.");
879 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
880 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructedl. Construct() should be called before use.");
887 Web::ScrollBy(const Tizen::Graphics::Point& diff)
889 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
890 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
892 pWebImpl->ScrollBy(diff);
897 Web::ScrollTo(const Tizen::Graphics::Point& dest)
899 _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
900 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
902 pWebImpl->ScrollTo(dest);
907 Web::GetScrollPosition(void) const
909 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
910 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
912 return pWebImpl->GetScrollPosition();
917 Web::GetPageSize(void) const
919 const _WebImpl* pWebImpl = _WebImpl::GetInstance(this);
920 SysAssertf(pWebImpl != null && pWebImpl->HasValidNativeNode(), "Not yet constructed or Not attached to parent control.");
922 return pWebImpl->GetPageSize();
926 }}} // Tizen::Web::Controls