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 FWebCtrl_WebImpl.cpp
20 * @brief The file contains the definition of _WebImpl class.
22 * The file contains the definition of _WebImpl class.
24 #include <Ecore_IMF_Evas.h>
25 #include <Ecore_Evas.h>
26 #include <elm_config.h>
29 #include <ewk_popup_menu_item.h>
30 #include <libsoup/soup-status.h>
32 #include <FAppAppControl.h>
33 #include <FAppIAppControlListener.h>
34 #include <FBaseColAllElementsDeleter.h>
35 #include <FBaseColHashMapT.h>
36 #include <FBaseRtMutex.h>
37 #include <FBaseRtMutexGuard.h>
38 #include <FBaseSysLog.h>
39 #include <FBaseUtilUri.h>
40 #include <FCntDownloadRequest.h>
41 #include <FGrpColor.h>
42 #include <FGrpPoint.h>
43 #include <FGrpRectangle.h>
44 #include <FIoDbEnumerator.h>
45 #include <FIoDbStatement.h>
47 #include <FMediaImage.h>
48 #include <FMediaImageTypes.h>
49 #include <FNetHttpHttpHeader.h>
50 #include <FSysVibrator.h>
51 #include <FUiControl.h>
52 #include <FUiCtrlKeypad.h>
53 #include <FWebCtrlHitElementResult.h>
54 #include <FWebCtrlITextSearchListener.h>
55 #include <FWebCtrlIWebDownloadListener.h>
56 #include <FWebCtrlIWebUiEventListener.h>
57 #include <FWebCtrlIWebUiEventListenerF.h>
58 #include <FWebCtrlIWebKeypadEventListener.h>
59 #include <FWebCtrlIJavaScriptBridge.h>
60 #include <FWebCtrlPageNavigationList.h>
61 #include <FWebCtrlAuthenticationChallenge.h>
62 #include <FWebCtrlWeb.h>
63 #include <FWebCtrlWebSetting.h>
64 #include <FWebHistoryItem.h>
65 #include <FWebJsonJsonObject.h>
66 #include <FWebJsonJsonParser.h>
67 #include <FWebJsonJsonString.h>
68 #include <FApp_AppControlImpl.h>
69 #include <FApp_AppControlManager.h>
70 #include <FApp_AppInfo.h>
71 #include <FApp_AppManagerImpl.h>
72 #include <FBase_StringConverter.h>
73 #include <FCnt_DownloadManagerImpl.h>
74 #include <FGrp_CoordinateSystem.h>
75 #include <FIo_DatabaseImpl.h>
76 #include <FIo_NormalFile.h>
77 #include <FSys_VibratorImpl.h>
78 #include <FUi_Control.h>
79 #include <FUi_CoordinateSystemUtils.h>
80 #include <FUi_EcoreEvasMgr.h>
81 #include <FUi_EcoreEvas.h>
82 #include <FUi_ResourceSizeInfo.h>
83 #include <FUi_Window.h>
84 #include <FUiAnim_EflNode.h>
85 #include <FUiAnim_VisualElement.h>
86 #include <FUiCtrl_FooterImpl.h>
87 #include <FUiCtrl_Form.h>
88 #include "FWeb_HistoryItemImpl.h"
89 #include "FWebCtrl_AppControlListener.h"
90 #include "FWebCtrl_AuthConfirmPopup.h"
91 #include "FWebCtrl_AuthenticationChallengeImpl.h"
92 #include "FWebCtrl_EflWebkit.h"
93 #include "FWebCtrl_GeolocationPermissionManagerImpl.h"
94 #include "FWebCtrl_HitElementResultImpl.h"
95 #include "FWebCtrl_InputPickerPopup.h"
96 #include "FWebCtrl_WebNotification.h"
97 #include "FWebCtrl_PageNavigationListImpl.h"
98 #include "FWebCtrl_PromptPopup.h"
99 #include "FWebCtrl_SelectBox.h"
100 #include "FWebCtrl_Utility.h"
101 #include "FWebCtrl_Web.h"
102 #include "FWebCtrl_WebDataHandler.h"
103 #include "FWebCtrl_WebEvent.h"
104 #include "FWebCtrl_WebEventArg.h"
105 #include "FWebCtrl_WebImpl.h"
106 #include "FWebCtrl_WebPresenter.h"
107 #include "FWebCtrl_WebSettingImpl.h"
110 using namespace Tizen::App;
111 using namespace Tizen::Base;
112 using namespace Tizen::Base::Collection;
113 using namespace Tizen::Base::Runtime;
114 using namespace Tizen::Base::Utility;
115 using namespace Tizen::Content;
116 using namespace Tizen::Graphics;
117 using namespace Tizen::Io;
118 using namespace Tizen::Media;
119 using namespace Tizen::Net::Http;
120 using namespace Tizen::System;
121 using namespace Tizen::Ui;
122 using namespace Tizen::Ui::Animations;
123 using namespace Tizen::Ui::Controls;
124 using namespace Tizen::Web::Json;
127 namespace Tizen { namespace Web { namespace Controls
131 static const char WEB_CTRL[] = "webcontrol";
132 static const char PARENT_WEB_CTRL[] = "parentwebcontrol";
135 static const float MIN_ZOOM_LEVEL = 0.3;
136 static const float MAX_ZOOM_LEVEL = 2;
139 static const int REDIRECTION_HEADER_GROUP = 300;
142 static const int MAX_TEXT_MATCH = pow(2, 31) - 1;
145 static const int PORTRAIT_KEYPAD_HEIGHT = 444;
146 static const int LANDSCAPE_KEYPAD_HEIGHT = 316;
147 static const int DEFAULT_LIST_ITEM_COUNT = 4;
151 AddHttpHeaderData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
153 result r = E_SUCCESS;
155 String key(reinterpret_cast< const char* >(pKey));
156 String value(reinterpret_cast< char* >(pValue));
158 SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
160 r = reinterpret_cast< HttpHeader* >(pUserData)->AddField(key, value);
161 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
168 AddHttpAttributeData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
170 result r = E_SUCCESS;
172 std::unique_ptr<String> pAttrKey(new (std::nothrow) String(reinterpret_cast< char* >(const_cast< void* >(pKey))));
173 std::unique_ptr<String> pAttrValue(new (std::nothrow) String(reinterpret_cast< char* >(pValue)));
174 SysTryReturn(NID_WEB_CTRL, pAttrKey.get() && pAttrValue.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
176 SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
178 r = reinterpret_cast< HashMap* >(pUserData)->Add(*pAttrKey, *pAttrValue);
179 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
181 pAttrValue.release();
188 FreeCharArray(void* pData)
190 delete[] reinterpret_cast<char*>(pData);
195 ConvertErrorCode(int error)
197 LoadingErrorType errorCode = WEB_ERROR_UNKNOWN;
201 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
203 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE:
205 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE_PROXY:
207 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT:
209 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT_PROXY:
211 case EWK_ERROR_NETWORK_STATUS_IO_ERROR:
213 case EWK_ERROR_NETWORK_STATUS_MALFORMED:
215 case EWK_ERROR_NETWORK_STATUS_TRY_AGAIN:
217 case EWK_ERROR_NETWORK_STATUS_TOO_MANY_REDIRECTS:
219 case EWK_ERROR_NETWORK_STATUS_TLS_FAILED:
221 case EWK_ERROR_NETWORK_STATUS_INTERNAL_SERVER_ERROR:
223 case EWK_ERROR_NETWORK_STATUS_BAD_GATEWAY:
225 case EWK_ERROR_NETWORK_STATUS_SERVICE_UNAVAILABLE:
227 case EWK_ERROR_NETWORK_STATUS_GATEWAY_TIMEOUT:
228 errorCode = WEB_NO_CONNECTION;
231 case EWK_ERROR_NETWORK_STATUS_BAD_REQUEST:
233 case EWK_ERROR_NETWORK_STATUS_REQUEST_URI_TOO_LONG:
234 errorCode = WEB_BAD_URL;
237 case EWK_ERROR_NETWORK_STATUS_FORBIDDEN:
238 errorCode = WEB_FILE_ACCESS_FAILED;
241 case EWK_ERROR_NETWORK_STATUS_REQUEST_TIMEOUT:
242 errorCode = WEB_REQUEST_TIMEOUT;
245 case EWK_ERROR_NETWORK_STATUS_UNSUPPORTED_MEDIA_TYPE:
246 errorCode = WEB_MIME_NOT_SUPPORTED;
249 case EWK_ERROR_NETWORK_STATUS_INSUFFICIENT_STORAGE:
250 errorCode = WEB_OUT_OF_MEMORY;
253 case EWK_ERROR_NETWORK_STATUS_REQUEST_ENTITY_TOO_LARGE:
254 errorCode = WEB_REQUEST_MAX_EXCEEDED;
257 case EWK_ERROR_NETWORK_STATUS_CONTINUE:
259 case EWK_ERROR_NETWORK_STATUS_SWITCHING_PROTOCOLS:
261 case EWK_ERROR_NETWORK_STATUS_PROCESSING:
263 case EWK_ERROR_NETWORK_STATUS_OK:
265 case EWK_ERROR_NETWORK_STATUS_CREATED:
267 case EWK_ERROR_NETWORK_STATUS_ACCEPTED:
269 case EWK_ERROR_NETWORK_STATUS_NON_AUTHORITATIVE:
271 case EWK_ERROR_NETWORK_STATUS_NO_CONTENT:
273 case EWK_ERROR_NETWORK_STATUS_RESET_CONTENT:
275 case EWK_ERROR_NETWORK_STATUS_PARTIAL_CONTENT:
277 case EWK_ERROR_NETWORK_STATUS_MULTI_STATUS:
279 case EWK_ERROR_NETWORK_STATUS_MULTIPLE_CHOICES:
281 case EWK_ERROR_NETWORK_STATUS_MOVED_PERMANENTLY:
283 case EWK_ERROR_NETWORK_STATUS_FOUND:
285 case EWK_ERROR_NETWORK_STATUS_SEE_OTHER:
287 case EWK_ERROR_NETWORK_STATUS_NOT_MODIFIED:
289 case EWK_ERROR_NETWORK_STATUS_USE_PROXY:
291 case EWK_ERROR_NETWORK_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL:
293 case EWK_ERROR_NETWORK_STATUS_TEMPORARY_REDIRECT:
294 errorCode = WEB_HTTP_RESPONSE;
297 case EWK_ERROR_NETWORK_STATUS_SSL_FAILED:
298 errorCode = WEB_INVALID_CERTIFICATE;
302 errorCode = WEB_ERROR_UNKNOWN;
311 FireLoadingErrorOccurredEvent(_WebImpl* pImpl, int code, const char* pDescription)
313 result r = E_SUCCESS;
315 std::unique_ptr<Integer> pErrorCode(new (std::nothrow) Integer(code));
316 std::unique_ptr<String> pErrorDescription(new (std::nothrow) String(pDescription));
317 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED));
318 SysTryReturnResult(NID_WEB_CTRL, pErrorCode.get() && pErrorDescription.get() && pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
320 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_TYPE, *pErrorCode.get());
321 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
322 pErrorCode.release();
324 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_MESSAGE, *pErrorDescription.get());
325 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
326 pErrorDescription.release();
328 r = pImpl->GetWebEvent()->FireAsync(*pEventArg);
329 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
337 OnScriptAlertRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
339 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
341 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
342 String msg(pMessage);
344 result r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_ALERT, pView, msg);
345 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
349 ewk_view_javascript_alert_reply(pView);
355 OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
357 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
359 result r = E_SUCCESS;
360 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
361 String msg(pMessage);
363 MessageBox messageBox;
364 r = messageBox.Construct(L"", msg, MSGBOX_STYLE_OKCANCEL);
365 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
369 messageBox.SetOwner(&pImpl->GetPublic());
371 r = messageBox.ShowAndWait(modalResult);
372 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
374 if (modalResult == MSGBOX_RESULT_OK)
376 ewk_view_javascript_confirm_reply(pView, EINA_TRUE);
380 ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
388 OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pDefaultValue, void* pUserData)
390 SysLog(NID_WEB_CTRL, "The current value of message is %s, defaulValue is %s", pMessage, pDefaultValue);
392 result r = E_SUCCESS;
393 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
394 String msg(pMessage);
395 String defVal(pDefaultValue);
397 std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
398 SysTryCatch(NID_WEB_CTRL, pPromptPopup.get(), , E_OUT_OF_MEMORY, "Memory allocation failed.");
400 r = pPromptPopup->Construct(msg, defVal, pView);
401 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
403 pPromptPopup->SetOwner(&pImpl->GetPublic());
405 r = pPromptPopup->ShowPopup();
406 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
408 pPromptPopup.release();
413 ewk_view_javascript_prompt_reply(pView, null);
420 OnCertificateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
422 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
423 Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(pEventInfo);
424 SysAssertf(pImpl && pPolicy, "Failed to request");
426 switch (pImpl->GetSetting().GetCertificateErrorHandlingMode())
428 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM:
430 if (pImpl->IsCertificateRequested())
432 ewk_certificate_policy_decision_allowed_set(pPolicy, static_cast< Eina_Bool >(pImpl->IsCertificateConfirmed()));
436 result r = E_SUCCESS;
438 r = pImpl->ShowCertificateConfirmPopup(CERTIFICATE_POPUP_MODE_USER_CONFIRM, pPolicy);
439 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
441 pImpl->SetCertificateRequested(true);
444 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL:
446 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
448 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE :
449 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_TRUE);
458 OnHttpAuthenticationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
460 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
461 Ewk_Auth_Challenge* pChallenge = reinterpret_cast< Ewk_Auth_Challenge* >(pEventInfo);
462 SysAssertf(pImpl && pChallenge, "Failed to request");
464 result r = E_SUCCESS;
466 r = pImpl->HttpAuthenticationRequested(pChallenge);
467 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
471 ewk_auth_challenge_credential_cancel(pChallenge);
472 evas_object_smart_callback_call(pView, "authentication,canceled", NULL);
477 OnHttpAuthenticationCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
479 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
480 SysAssertf(pImpl , "Failed to request");
482 if (pImpl->GetLoadingListener())
484 result r = E_SUCCESS;
486 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED));
487 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
489 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
490 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
497 OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
499 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
500 Ewk_Geolocation_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(pEventInfo);
501 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
503 if (pImpl->GetSetting().IsGeolocationEnabled())
505 result r = E_SUCCESS;
507 std::unique_ptr<DbEnumerator> pEnum;
509 String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
510 String table(GEOLOCATION_TABLE_NAME);
513 const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPermissionRequest);
514 String origin = _Utility::CreateOrigin(pSecurityOrigin);
516 r = db.Construct(geolocationPath, "r", null);
517 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
519 pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select permission From " + table + L" Where origin = '" + origin + L"'"));
522 r = pEnum->MoveNext();
523 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
526 r = pEnum->GetIntAt(0, permission);
527 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
529 SysLog(NID_WEB_CTRL, "The current value of permission is %d", permission);
531 ewk_geolocation_permission_request_set(pPermissionRequest, static_cast < Eina_Bool >(permission));
535 ewk_geolocation_permission_request_suspend(pPermissionRequest);
537 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_GEOLOCATION, pPermissionRequest);
538 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
545 ewk_geolocation_permission_request_set(pPermissionRequest, EINA_FALSE);
550 OnGetUserMediaPermissionRequsted(void* pUserData, Evas_Object* pView, void* pEventInfo)
552 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
553 Ewk_User_Media_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_User_Media_Permission_Request* >(pEventInfo);
554 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
556 result r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_USERMEDIA, pEventInfo);
557 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
561 ewk_user_media_permission_request_set(pPermissionRequest, EINA_FALSE);
566 OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
568 result r = E_SUCCESS;
569 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
571 Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(pEventInfo);
572 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
574 ewk_notification_permission_request_suspend(pPermissionRequest);
576 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_NOTIFICATION, pPermissionRequest);
577 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
581 ewk_notification_permission_request_set(pPermissionRequest, EINA_FALSE);
586 OnNotificationShow(void* pUserData, Evas_Object* pView, void* pEventInfo)
588 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
589 Ewk_Notification* pNotification = reinterpret_cast< Ewk_Notification* >(pEventInfo);
590 SysAssertf(pImpl && pNotification, "Failed to request");
592 result r = E_SUCCESS;
593 Ewk_Context* pContext = ewk_view_context_get(pView);
594 SysAssertf(pContext, "Failed to get webkit instance.");
595 uint64_t notificationId = ewk_notification_id_get(pNotification);
597 //ewk_notification_security_origin_get(pNotification)
599 const char* text = ewk_notification_body_get(pNotification);
600 SysSecureLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
602 std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification());
603 SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
605 r = pNotificationWindow->Construct(pContext, notificationId, pImpl);
606 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error propogated.", GetErrorMessage(r));
608 pNotificationWindow->SetText(String(text));
609 pNotificationWindow->LaunchNotification();
610 pNotificationWindow.release();
612 ewk_notification_showed(pContext, notificationId);
617 OnNotificationCancel(void* pUserData, Evas_Object* pView, void* pEventInfo)
619 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
620 uint64_t* pNotificationID = reinterpret_cast< uint64_t* >(pEventInfo);
621 SysAssertf(pImpl && pNotificationID, "Failed to request");
623 //ToDo : Where is ewk API for cancel operation?
628 OnProtocolHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
630 result r = E_SUCCESS;
631 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
632 SysAssertf(pImpl, "Failed to request");
634 r = pImpl->ShowUserConfirmPopup(USER_PROTOCOL_HANDLER, pEventInfo);
635 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
640 OnIsProtocolHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
642 int checkHandler = 0;
643 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
644 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
645 SysAssertf(pImpl && pHandlerData, "Failed to request");
647 checkHandler = pImpl->SearchHandler(pHandlerData, false);
648 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
649 switch (checkHandler)
654 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
657 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
660 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
668 OnProtocolHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
670 result r = E_SUCCESS;
671 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
672 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
673 SysAssertf(pImpl && pHandlerData, "Failed to request");
675 r = pImpl->UnregistrationHandler(pHandlerData, false);
676 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
681 OnContentHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
683 result r = E_SUCCESS;
684 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
685 SysAssertf(pImpl, "Failed to request");
687 r = pImpl->ShowUserConfirmPopup(USER_CONTENT_HANDLER, pEventInfo);
688 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
693 OnIsContentHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
695 int checkHandler = 0;
696 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
697 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
698 SysAssertf(pImpl && pHandlerData, "Failed to request");
700 checkHandler = pImpl->SearchHandler(pHandlerData, true);
701 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
703 switch (checkHandler)
708 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
711 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
714 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
723 OnContentHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
725 result r = E_SUCCESS;
726 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
727 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
728 SysAssertf(pImpl && pHandlerData, "Failed to request");
730 r = pImpl->UnregistrationHandler(pHandlerData, true);
731 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
736 OnVibrationRequested(uint64_t duration, void* pUserData)
738 result r = E_SUCCESS;
740 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
741 SysAssertf(pImpl, "Failed to request");
743 r = pImpl->VibrationRequested(duration);
744 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
749 OnVibrationCanceled(void* pUserData)
751 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
752 SysAssertf(pImpl, "Failed to request");
754 pImpl->VibrationCanceled();
759 OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* pOrigin, void* pUserData)
761 ewk_view_application_cache_permission_reply(pView, EINA_TRUE);
768 OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
770 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
771 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
772 SysAssertf(pImpl && pPolicy, "Failed to request");
774 String url(ewk_policy_decision_url_get(pPolicy));
775 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
777 if (url == L"about:blank")
779 ewk_policy_decision_use(pPolicy);
783 if (pImpl->GetLoadingListener() && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
784 && !pImpl->IsRedirectRequested())
786 pImpl->SetCertificateRequested(false);
788 if (pImpl->GetTextSearchListener())
790 pImpl->DisableAsyncSearch();
793 WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
794 Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
796 switch (ewkNavigationType)
798 case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
799 navigationType = WEB_NAVIGATION_LINK_CLICKED;
801 case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
802 navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
804 case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
805 navigationType = WEB_NAVIGATION_BACKFORWARD;
807 case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
808 navigationType = WEB_NAVIGATION_RELOAD;
810 case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
811 navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
813 case EWK_POLICY_NAVIGATION_TYPE_OTHER:
814 navigationType = WEB_NAVIGATION_OTHER;
820 if (pImpl->GetLoadingListener()->OnLoadingRequested(url, navigationType))
822 ewk_policy_decision_ignore(pPolicy);
828 String currentUrl(pImpl->GetUrl());
829 String redirectUrl(pImpl->GetProtocolFromUri(url, currentUrl));
830 if (redirectUrl != L"")
832 pImpl->LoadUrl(redirectUrl);
833 ewk_policy_decision_ignore(pPolicy);
841 String uriScheme(uri.GetScheme());
842 SysLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
844 if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file"))
846 ewk_policy_decision_ignore(pPolicy);
848 if (uriScheme == L"")
853 result r = E_SUCCESS;
855 _WebEventType eventType = WEB_EVENT_REQUEST_UNKNOWN;
857 if (uriScheme == L"rtsp")
859 eventType = WEB_EVENT_REQUEST_RTSP;
861 else if (uriScheme == L"mailto")
863 eventType = WEB_EVENT_REQUEST_EMAIL;
865 else if (uriScheme == L"tel")
867 eventType = WEB_EVENT_REQUEST_TEL;
869 else if (uriScheme == L"sms" || uriScheme == L"smsto" )
871 eventType = WEB_EVENT_REQUEST_SMS;
873 else if (uriScheme == L"mms" || uriScheme == L"mmsto" )
875 eventType = WEB_EVENT_REQUEST_MMS;
878 std::unique_ptr<_WebEventArg> pEventArg(new _WebEventArg(eventType, url));
879 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
881 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
882 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
888 ewk_policy_decision_use(pPolicy);
893 OnLoadingStarted(void* pUserData, Evas_Object* pView, void* pEventInfo)
895 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
896 SysAssertf(pImpl, "Failed to request");
898 if (pImpl->GetLoadingListener())
900 result r = E_SUCCESS;
902 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_STARTED));
903 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
905 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
906 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
913 OnPageTitleReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
915 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
916 char* pTitle = reinterpret_cast< char* >(pEventInfo);
917 SysAssertf(pImpl, "Failed to request");
919 SysLog(NID_WEB_CTRL, "The current value of title is %s", pTitle);
921 if (pImpl->GetLoadingListener())
923 result r = E_SUCCESS;
925 std::unique_ptr<String> pPageTitle(new (std::nothrow) String(pTitle));
926 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED));
927 SysTryReturnVoidResult(NID_WEB_CTRL, pPageTitle.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
929 r = pEventArg->SetEventInfo(_LoadingEventArg::PAGE_TITLE, *pPageTitle.get());
930 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
931 pPageTitle.release();
933 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
934 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
941 OnEstimatedProgress(void* pUserData, Evas_Object* pView, void* pEventInfo)
943 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
944 double* pProgress = reinterpret_cast< double* >(pEventInfo);
945 SysAssertf(pImpl, "Failed to request");
947 SysLog(NID_WEB_CTRL, "The current value of progress is %lf", *pProgress);
949 if (pImpl->GetLoadingListener())
951 result r = E_SUCCESS;
953 std::unique_ptr<Integer> pProgressPercentage(new (std::nothrow) Integer(static_cast< int >(*pProgress * 100)));
954 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PROGRESS));
955 SysTryReturnVoidResult(NID_WEB_CTRL, pProgressPercentage.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
957 r = pEventArg->SetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS, *pProgressPercentage.get());
958 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
959 pProgressPercentage.release();
961 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
962 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
969 OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
971 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
972 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
973 SysAssertf(pImpl && pPolicy, "Failed to request");
975 result r = E_SUCCESS;
977 const char* pUrl = ewk_policy_decision_url_get(pPolicy);
978 int code = ewk_policy_decision_response_status_code_get(pPolicy);
979 String mime(ewk_policy_decision_response_mime_get(pPolicy));
980 SysSecureLog(NID_WEB_CTRL, "url : %s, mime : %ls, code : %d", pUrl, mime.GetPointer(), code);
982 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
984 String url(ewk_policy_decision_url_get(pPolicy));
987 if (pLoadingListener && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
989 const Eina_Hash* pHeader = ewk_policy_decision_response_headers_get(pPolicy);
991 DecisionPolicy policy;
992 HttpHeader httpHeader;
994 if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
996 pImpl->SetRedirectRequested(true);
1000 eina_hash_foreach(pHeader, AddHttpHeaderData, &httpHeader);
1001 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1003 policy = pLoadingListener->OnWebDataReceived(mime, httpHeader);
1004 pImpl->SetPolicyDecision(policy);
1007 switch (pImpl->GetPolicyDecision())
1009 case WEB_DECISION_CONTINUE:
1011 String currentUrl(pImpl->GetUrl());
1012 String redirectUrl(pImpl->GetRedirectUri(url, currentUrl, mime));
1013 if (redirectUrl != L"")
1015 pImpl->LoadUrl(redirectUrl);
1016 ewk_policy_decision_ignore(pPolicy);
1021 if (pImpl->IsMimeSupported(mime) || mime == L"")
1028 SysLog(NID_WEB_CTRL, "Launch native app to handle the mime");
1030 ewk_policy_decision_ignore(pPolicy);
1032 AppControl* pAppControl = null;
1033 _SelectBox selectBox;
1035 int selectedIndex = 0;
1037 std::unique_ptr<IList, AllElementsDeleter> pList(_AppManagerImpl::FindAppControlsN(NULL, NULL, &mime, NULL));
1041 appCount = pList->GetCount();
1044 r = selectBox.Construct(false, L"", appCount+1); //+1 for Downloader
1045 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1047 selectBox.AddListItem(L"Download", _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
1048 for (int i = 0; i < appCount; i++)
1050 pAppControl = dynamic_cast< AppControl* >(pList->GetAt(i));
1051 SysTryReturnVoidResult(NID_WEB_CTRL, pAppControl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1053 String text = pAppControl->GetAppName();
1054 SysLog(NID_WEB_CTRL, "AppName : %S", text.GetPointer());
1056 selectBox.AddListItem(text, _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
1058 r = selectBox.ShowAndWait(selectedIndex);
1059 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1061 if (selectedIndex == 0) //download
1063 RequestId reqId = 0;
1064 DownloadRequest request(pUrl);
1066 _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
1067 SysTryReturnVoidResult(NID_WEB_CTRL, pManagerImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1069 r = pManagerImpl->Start(request, reqId);
1070 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1072 else if (selectedIndex != -1) // -1 for cancel
1074 String path("path");
1075 String pathVal(pUrl);
1078 r = dataList.Construct();
1079 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1081 r = dataList.Add(path, pathVal);
1082 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1084 pAppControl = dynamic_cast< AppControl* >(pList->GetAt(selectedIndex));
1085 SysTryReturnVoidResult(NID_WEB_CTRL, pAppControl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1087 _AppControlImpl* pAcImpl = _AppControlImpl::GetInstance(*pAppControl);
1088 SysTryReturnVoidResult(NID_WEB_CTRL, pAcImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1090 r = pAcImpl->Start(null, null, &dataList, null);
1091 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1098 case WEB_DECISION_DOWNLOAD:
1100 ewk_policy_decision_ignore(pPolicy);
1102 _WebDataHandler* pDownloadHandler = pImpl->GetDownloadHandler();
1103 SysTryReturnVoidResult(NID_WEB_CTRL, pDownloadHandler, E_SYSTEM, "[%s] A system error has been occurred. Failed to get DownloadHandler.", GetErrorMessage(E_SYSTEM));
1105 Ewk_Context* pContext = ewk_view_context_get(pView);
1106 SysAssertf(pContext, "Failed to get webkit instance.");
1108 pDownloadHandler->StartDownload(pUrl);
1112 case WEB_DECISION_IGNORE:
1114 ewk_policy_decision_ignore(pPolicy);
1124 ewk_policy_decision_use(pPolicy);
1129 ewk_policy_decision_ignore(pPolicy);
1134 OnProgressCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1136 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1137 SysAssertf(pImpl, "Failed to request");
1139 if (pImpl->IsRedirectRequested())
1141 pImpl->SetRedirectRequested(false);
1144 if (pImpl->IsLoadingErrorOccurred())
1146 pImpl->SetLoadingErrorOccurred(false);
1147 evas_object_smart_callback_call(pView, "load,finished", NULL);
1153 OnLoadingErrorOccurred(void* pUserData, Evas_Object* pView, void* pEventInfo)
1155 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1156 Ewk_Error* pErrorData = reinterpret_cast< Ewk_Error* >(pEventInfo);
1157 SysAssertf(pImpl && pErrorData, "Failed to request");
1159 int code = ewk_error_code_get(pErrorData);
1160 const char* pDescription = ewk_error_description_get(pErrorData);
1162 SysLog(NID_WEB_CTRL, "The current value of code is %d, description is %s", code, pDescription);
1164 pImpl->SetLoadingErrorOccurred(true);
1167 case EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE:
1169 case EWK_ERROR_CODE_PLUGINWILLHANDLELOAD:
1172 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
1173 evas_object_smart_callback_call(pView, "load,stop", NULL);
1177 if (pImpl->GetLoadingListener())
1179 result r = E_SUCCESS;
1181 r = FireLoadingErrorOccurredEvent(pImpl, code, pDescription);
1182 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1190 OnLoadingCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
1192 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1193 SysAssertf(pImpl, "Failed to request");
1195 if (pImpl->GetLoadingListener())
1197 result r = E_SUCCESS;
1199 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_CANCELED));
1200 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1202 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1203 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1204 pEventArg.release();
1211 OnLoadingCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1213 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1214 SysAssertf(pImpl, "Failed to request");
1216 if (pImpl->GetLoadingListener())
1218 result r = E_SUCCESS;
1220 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_COMPLETED));
1221 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1223 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1224 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1225 pEventArg.release();
1232 OnLoadingCommitted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1234 evas_object_focus_set(pView, EINA_FALSE);
1239 OnFaviconReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1241 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1242 SysAssertf(pImpl, "Failed to request");
1244 if (pImpl->GetLoadingListener())
1246 result r = E_SUCCESS;
1248 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED));
1249 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1251 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1252 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1253 pEventArg.release();
1260 OnDidStartDownloadCallback(const char* pUrl, void* pUserData)
1262 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1263 SysAssertf(pUrl && pImpl != null, "Failed to request");
1265 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s", pUrl);
1270 FireWebPageShowRequestedEvent(_WebImpl* pImpl, int event)
1272 result r = E_SUCCESS;
1274 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1275 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1277 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1278 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1279 pEventArg.release();
1286 OnWebPageShowRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1288 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1289 SysAssertf(pImpl, "Failed to request");
1291 if (pImpl->GetUiEventListener())
1293 result r = E_SUCCESS;
1295 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED);
1296 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1298 if (pImpl->GetUiEventListenerF())
1300 result r = E_SUCCESS;
1302 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT);
1303 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1309 OnWebWindowCreateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1311 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(pUserData);
1312 Evas_Object** pChildView = reinterpret_cast< Evas_Object** >(pEventInfo);
1313 SysAssertf(pParentImpl && pChildView, "Failed to request");
1315 IWebUiEventListener* pUserUiListener = pParentImpl->GetUiEventListener();
1316 IWebUiEventListenerF* pUserUiListenerF = pParentImpl->GetUiEventListenerF();
1317 if (pUserUiListener)
1319 Web* pWeb = pUserUiListener->OnWebWindowCreateRequested();
1322 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1323 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1325 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1326 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1329 if (pUserUiListenerF)
1331 Web* pWeb = pUserUiListenerF->OnWebWindowCreateRequested();
1334 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1335 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1337 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1338 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1345 FireWebWindowClosedRequestedEvent(_WebImpl* pImpl, int event)
1347 result r = E_SUCCESS;
1349 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1350 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1352 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1353 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1354 pEventArg.release();
1361 OnWebWindowClosedRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1363 _WebImpl* pChildImpl = reinterpret_cast< _WebImpl* >(pUserData);
1364 SysAssertf(pChildImpl, "Failed to request");
1366 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, PARENT_WEB_CTRL));
1367 if (pParentImpl == null)
1372 if (pParentImpl->GetUiEventListener())
1374 result r = E_SUCCESS;
1376 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED);
1377 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1379 if (pParentImpl->GetUiEventListenerF())
1381 result r = E_SUCCESS;
1383 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT);
1384 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1390 FireWebPreventDefaultTriggeredEvent(_WebImpl* pImpl, int event, bool trigger)
1392 result r = E_SUCCESS;
1394 std::unique_ptr<Boolean> pPreventTrigger(new (std::nothrow) Boolean(trigger));
1395 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1396 SysTryReturnResult(NID_WEB_CTRL, pPreventTrigger.get() && pEventArg.get(), E_OUT_OF_MEMORY, " Memory allocation failed." );
1398 r = pEventArg->SetEventInfo(_WebUiEventArg::PREVENT_DEFAULT, *pPreventTrigger.get());
1399 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1400 pPreventTrigger.release();
1402 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1403 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1404 pEventArg.release();
1411 OnWebPreventDefaultTriggered(void* pUserData, Evas_Object* pView, void* pEventInfo)
1413 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1414 Eina_Bool* pTrigger = reinterpret_cast< Eina_Bool* >(pEventInfo);
1415 SysAssertf(pImpl && pTrigger, "Failed to request");
1417 if (pImpl->GetUiEventListener())
1419 result r = E_SUCCESS;
1421 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED, static_cast< bool >(*pTrigger));
1422 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1424 if (pImpl->GetUiEventListenerF())
1426 result r = E_SUCCESS;
1428 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT, static_cast< bool >(*pTrigger));
1429 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1435 FireWebPageBlockSelectedEvent(_WebImpl* pImpl)
1437 result r = E_SUCCESS;
1439 std::unique_ptr<Point> startPoint(new (std::nothrow) Point());
1440 std::unique_ptr<Point> endPoint(new (std::nothrow) Point());
1441 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1443 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1445 if ((endPoint->x != 0) && (endPoint->y != 0))
1447 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED));
1448 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1450 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1451 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1452 startPoint.release();
1454 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1455 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1458 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1459 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1460 pEventArg.release();
1468 FireWebPageBlockSelectedEventF(_WebImpl* pImpl)
1470 result r = E_SUCCESS;
1472 std::unique_ptr<FloatPoint> startPoint(new (std::nothrow) FloatPoint());
1473 std::unique_ptr<FloatPoint> endPoint(new (std::nothrow) FloatPoint());
1475 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1477 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1479 if ((endPoint->x != 0.0f) && (endPoint->y != 0.0f))
1481 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT));
1482 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1484 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1485 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1486 startPoint.release();
1488 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1489 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1492 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1493 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1494 pEventArg.release();
1502 OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
1504 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1505 SysAssertf(pImpl, "Failed to request");
1507 if (pImpl->GetUiEventListener())
1509 result r = E_SUCCESS;
1511 r = FireWebPageBlockSelectedEvent(pImpl);
1512 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1514 if (pImpl->GetUiEventListenerF())
1516 result r = E_SUCCESS;
1518 r = FireWebPageBlockSelectedEventF(pImpl);
1519 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1525 OnWebPageBlockSelectedByOrientation(void* pUserData, Evas_Object* pView, void* pEventInfo)
1527 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1528 SysAssertf(pImpl, "Failed to request");
1530 if (!pImpl->IsOrientationChanged())
1535 pImpl->SetOrientationChanged(false);
1536 OnWebPageBlockSelected(pUserData, pView, pEventInfo);
1541 OnSelectUploadFile(Evas_Object* pView, Eina_Bool multipleFile, Eina_List* pAcceptTypes, const char* pCapture, void* pUserData)
1543 String isMultipleSelection(L"single");
1544 result r = E_SUCCESS;
1547 String mode(L"selectionType");
1548 String type(L"type");
1549 _AppControlImpl* pMediaAppControlImpl = null;
1552 String fileType = L"all";
1556 isMultipleSelection.Append(L"multiple");
1559 std::unique_ptr<AppControl> pMediaAppControl(_AppManagerImpl::FindAppControlN(L"tizen.filemanager", L"http://tizen.org/appcontrol/operation/pick"));
1560 SysTryReturn(NID_WEB_CTRL, pMediaAppControl.get(), EINA_TRUE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1562 std::unique_ptr<_MediaSelectionListener> pMediaListener(new (std::nothrow) _MediaSelectionListener());
1563 SysTryReturn(NID_WEB_CTRL, pMediaListener.get(), EINA_TRUE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1565 pMediaListener->Construct(pView, pMediaAppControl.get());
1567 itemCount = eina_list_count(pAcceptTypes);
1571 String item((char*)eina_list_nth(pAcceptTypes, 0));
1572 if (item.StartsWith("image/",0))
1574 fileType = L"image";
1576 else if (item.StartsWith("audio/",0))
1578 fileType = L"audio";
1580 else if (item.StartsWith("video/",0))
1582 fileType = L"video";
1586 r = dataList.Construct();
1587 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1589 r = dataList.Add(mode, isMultipleSelection);
1590 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1592 r = dataList.Add(type, fileType);
1593 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1595 pMediaAppControlImpl = _AppControlImpl::GetInstance(*pMediaAppControl.get());
1596 r = pMediaAppControlImpl->Start(null, null, &dataList, pMediaListener.get());
1597 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1599 pMediaListener.release();
1600 pMediaAppControl.release();
1605 ewk_view_open_panel_reply(pView, null, EINA_FALSE);
1611 OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
1613 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1614 char* pJsonText = reinterpret_cast< char* >(pEventInfo);
1615 SysAssertf(pImpl && pJsonText, "Failed to request");
1617 result r = E_SUCCESS;
1619 SysLog(NID_WEB_CTRL, "The current value of jsontext is %s", pJsonText);
1621 std::unique_ptr<_JsBridgeArg> pEventArg(new (std::nothrow) _JsBridgeArg());
1622 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1624 r = pEventArg->Construct(pJsonText);
1625 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1627 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1628 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1629 pEventArg.release();
1634 OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
1636 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1637 Eina_Rectangle* pEinaRect = reinterpret_cast< Eina_Rectangle* >(pEventInfo);
1638 SysAssertf(pImpl && pEinaRect, "Failed to request");
1640 if (pImpl->GetSetting().GetInputStyle() == INPUT_STYLE_OVERLAY)
1642 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1643 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1645 Rectangle rect(pEinaRect->x, pEinaRect->y, pEinaRect->w, pEinaRect->h);
1647 if (rect.height == 0)
1652 _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
1655 if (pFormCore->HasFooter() && pFormCore->IsFooterVisible())
1657 pImpl->SetFooterVisibleState(true);
1658 pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
1661 pFormCore->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
1664 if (pImpl->GetWebKeypadEventListener())
1666 if (pImpl->IsKeypadVisible() == true)
1668 if ((pImpl->GetPreviousKeypadBounds().width == rect.width) && (pImpl->GetPreviousKeypadBounds().height != rect.height))
1670 pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1675 pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1678 pImpl->SetKeypadVisibleState(true);
1679 pImpl->SetPreviousKeypadBounds(rect);
1683 result r = pImpl->SetFullScreenKeypad();
1684 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1690 OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
1692 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1693 SysAssertf(pImpl, "Failed to request");
1695 if (pImpl->GetWebKeypadEventListener())
1697 pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
1703 OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
1705 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1706 SysAssertf(pImpl, "Failed to request");
1708 _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
1711 if (pFormCore->HasFooter() && pImpl->IsFooterVisible())
1713 pImpl->SetFooterVisibleState(false);
1714 pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
1717 pFormCore->DeflateClientRectHeight(0);
1720 if (pImpl->GetWebKeypadEventListener())
1722 pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1725 pImpl->SetKeypadVisibleState(false);
1730 OnWindowObjectFocusGained(void *pUserData, Evas_Object *pWin, void *pEvent_info)
1732 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1733 SysAssertf(pImpl, "Failed to request");
1735 if (pImpl->IsKeypadOpened() == true)
1737 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1738 SysAssertf(pWebCore, "Failed to get Web core object");
1740 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1742 pImpl->SetKeypadOpened(false);
1748 OnWebNativeNodeFocusGained(void *pUserData, Evas *pCanvas, Evas_Object* pView, void* pEventInfo)
1750 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1751 SysAssertf(pImpl, "Failed to request");
1753 if (pImpl->IsKeypadOpened() == true)
1755 pImpl->SetKeypadOpened(false);
1761 OnColorPickerProviderRequested(Ewk_View_Smart_Data *pSmartData, int red, int green, int blue, int alpha)
1763 SysAssertf(pSmartData, "invalid smartdata");
1764 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1765 SysAssertf(pWebImpl, "Failed to get Impl");
1767 result r = E_SUCCESS;
1769 if (pWebImpl->GetColorpicker())
1776 r = pWebImpl->ShowColorPicker(red, green, blue, alpha, color);
1777 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1779 byte r1, g1, b1, a1;
1780 color.GetColorComponents(r1, g1, b1, a1);
1781 ewk_view_color_picker_color_set(pSmartData->self, r1, g1, b1, a1);
1788 OnColorPickerProviderDismissed(Ewk_View_Smart_Data *pSmartData)
1790 SysAssertf(pSmartData, "invalid smartdata");
1792 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1793 SysAssertf(pWebImpl, "Failed to get Impl");
1795 return pWebImpl->HideColorPicker();
1800 OnDatePickerProviderRequested(Ewk_View_Smart_Data *pSmartData, Ewk_Input_Type inputType, const char* inputValue)
1802 SysAssertf(pSmartData, "Failed to request");
1803 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1804 SysAssertf(pWebImpl, "Failed to get Impl");
1806 result r = E_SUCCESS;
1808 if (pWebImpl->GetDatepicker())
1810 ewk_view_focused_input_element_value_set(pSmartData->self, inputValue);
1817 r = pWebImpl->ShowDatePicker(inputType, inputValue, dateStr);
1818 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1820 std::unique_ptr<char[]> pDateStr(_StringConverter::CopyToCharArrayN(dateStr));
1821 SysTryReturn(NID_WEB_CTRL, pDateStr.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1823 ewk_view_focused_input_element_value_set(pSmartData->self, pDateStr.get());
1830 OnSelectBoxRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, double pageScaleFactor, Eina_List* pItems, int selectedIndex)
1832 SysAssertf(pSmartData, "Failed to request");
1834 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1835 SysAssertf(pWebImpl, "Failed to get Impl");
1837 result r = pWebImpl->ShowSelectBoxPopup(false, L"", pItems, pSmartData->self, selectedIndex);
1838 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1845 OnSelectBoxClosed(Ewk_View_Smart_Data *pSmartData)
1847 SysAssertf(pSmartData, "invalid smartdata");
1849 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1850 SysAssertf(pWebImpl, "Failed to get Impl");
1852 result r = pWebImpl->ClearSelectBoxPopup();
1853 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1860 OnSelectBoxUpdateRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, Eina_List* pItems, int selectedIndex)
1862 SysAssertf(pSmartData, "invalid smartdata");
1864 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1865 SysAssertf(pWebImpl, "Failed to get Impl");
1867 result r = pWebImpl->UpdateSelectBoxPopup(pItems, selectedIndex, false);
1868 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1875 OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
1877 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
1878 SysAssertf(pPresenter && !pError, "Failed to request");
1880 bool ret = EINA_TRUE;
1884 case EWK_COOKIE_ACCEPT_POLICY_ALWAYS:
1886 case EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY:
1890 case EWK_COOKIE_ACCEPT_POLICY_NEVER:
1899 SysLog(NID_WEB_CTRL, "The current value of policy is %d", ret);
1901 pPresenter->EndAsyncProcess(ret);
1906 OnScriptExecuted(Evas_Object* pView, const char* pResult, void* pUserData)
1908 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
1909 SysAssertf(pPresenter, "Failed to request");
1911 String result(pResult);
1912 SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
1914 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
1915 if (pImpl && pImpl->IsPresenterAlived(pPresenter))
1917 pPresenter->EndAsyncProcess(result);
1923 OnTextFound(void* pUserData, Evas_Object* pView, void* pEventInfo)
1925 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1926 SysAssertf(pImpl, "Failed to request");
1928 int* pTotalCount = reinterpret_cast< int* >(pEventInfo);
1929 SysLog(NID_WEB_CTRL, "The current value of totalCount is %d", *pTotalCount);
1931 _WebPresenter* pWebPresenter = pImpl->GetSearchPresenter();
1935 pWebPresenter->EndAsyncProcess(*pTotalCount);
1939 if (pImpl->GetTextSearchListener())
1941 result r = E_SUCCESS;
1945 if (*pTotalCount > 0)
1947 ordinal = pImpl->GetAsyncSearchOrdinal();
1948 pImpl->SetAsyncSearchResult(*pTotalCount);
1951 if (pImpl->GetPendingAsyncSearchCount() > 0)
1956 std::unique_ptr<Integer> pCount(new (std::nothrow) Integer(*pTotalCount));
1957 std::unique_ptr<Integer> pOrdinal(new (std::nothrow) Integer(ordinal));
1958 std::unique_ptr<_TextSearchEventArg> pEventArg(new (std::nothrow) _TextSearchEventArg(WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND));
1959 SysTryReturnVoidResult(NID_WEB_CTRL, pCount.get() && pOrdinal.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1961 r = pEventArg->SetEventInfo(_TextSearchEventArg::TOTAL_COUNT, *pCount.get());
1962 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1965 r = pEventArg->SetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL, *pOrdinal.get());
1966 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1969 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1970 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1971 pEventArg.release();
1977 class _JsBridgeHashCodeProvider
1978 : public Tizen::Base::Collection::IHashCodeProviderT< Tizen::Base::String >
1981 _JsBridgeHashCodeProvider(){}
1982 virtual ~_JsBridgeHashCodeProvider(void) {}
1985 int GetHashCode(const Tizen::Base::String& obj) const
1987 return obj.GetHashCode();
1993 //Comparer implementation
1994 class _JsBridgeComparer
1995 : public Tizen::Base::Collection::IComparerT< Tizen::Base::String >
1998 _JsBridgeComparer(){}
1999 virtual ~_JsBridgeComparer(void) {}
2002 result Compare(const Tizen::Base::String& obj1, const Tizen::Base::String& obj2, int& cmp) const
2019 _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
2020 : _ContainerImpl(pWeb, pCore)
2021 , __isFooterVisible(false)
2022 , __isKeypadVisible(false)
2023 , __isKeypadOpened(false)
2024 , __isLoadingErrorOccurred(false)
2025 , __isRedirectRequested(false)
2026 , __isCertificateRequested(false)
2027 , __isCertificateConfirmed(false)
2028 , __isOrientationChanged(false)
2029 , __keypadBounds(0, 0, 0, 0)
2031 , __pUserLoadingListener(null)
2032 , __pUserUiListener(null)
2033 , __pUserUiListenerF(null)
2034 , __pUserKeypadEventListener(null)
2035 , __pTextSearchListener(null)
2037 , __pJsBridgeList(null)
2038 , __pJsProvider(null)
2039 , __pJsComparer(null)
2040 , __pWebDownloadHandler(null)
2042 , __pAuthChallenge(null)
2043 , __pAuthPopup(null)
2044 , __pUserConfirmPopup(null)
2045 , __pCertConfirmPopup(null)
2046 , __pSelectBox(null)
2047 , __pDatePicker(null)
2048 , __pColorPicker(null)
2050 , __policy(WEB_DECISION_CONTINUE)
2051 , __defaultUserAgent(L"")
2053 __textSearch.__searchAll = false;
2054 __textSearch.__searchForward = true;
2055 __textSearch.__caseSensitive = false;
2056 __textSearch.__pending = 0;
2057 __textSearch.__currentIndex = 1;
2058 __textSearch.__totalCount = -1;
2059 __textSearch.__text = L"";
2063 _WebImpl::~_WebImpl()
2065 RemoveEventListenerCallback();
2069 _WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
2071 result r = E_SUCCESS;
2073 r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2074 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2076 _Web* pCore = _Web::CreateWebN();
2077 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2079 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2081 r = CheckConstruction(pCore, pImpl);
2082 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2084 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2085 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2087 r = pImpl->Construct();
2088 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2100 _WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
2102 result r = E_SUCCESS;
2104 r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2105 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2107 _Web* pCore = _Web::CreateWebN();
2108 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2110 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2112 r = CheckConstruction(pCore, pImpl);
2113 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2115 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2116 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2118 r = pImpl->Construct();
2119 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2131 _WebImpl::Construct(void)
2133 result r = E_SUCCESS;
2135 r = __mutex.Create();
2136 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2138 r = __textSearch.__searchQueue.Construct();
2139 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2141 r = __callbackList.Construct();
2142 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2144 r = InitJsBridgeList();
2145 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2148 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2150 __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
2151 SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
2158 _WebImpl::InitializeSetting(void)
2160 result r = E_SUCCESS;
2162 WebSetting* pWebSetting = __pWebCore->GetSetting();
2163 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(pWebSetting);
2165 SetCookieEnabled(pWebSettingImpl->IsCookieEnabled());
2166 SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
2167 SetZoomLevel(pWebSettingImpl->GetZoomLevel());
2169 __defaultUserAgent = pWebSettingImpl->GetUserAgent();
2171 r = SetSetting(*pWebSetting);
2172 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2174 SetEventListenerCallback();
2181 _WebImpl::IsLayoutable(void) const
2188 _WebImpl::InitWebEvent(void)
2190 __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
2191 SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2193 return __pWebEvent->Construct(*this);
2198 _WebImpl::GetWebEvent(void) const
2200 return __pWebEvent.get();
2205 _WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
2207 Eina_Hash* pHttpHeader = null;
2209 std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
2210 if (pFieldNameList.get())
2212 pHttpHeader = eina_hash_string_small_new(FreeCharArray);
2213 SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2215 int count = pFieldNameList->GetCount();
2217 for (int i = 0; i < count; i++)
2219 String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
2220 SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2222 std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
2223 SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2225 std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
2226 SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2228 while (pFieldValueEnum->MoveNext() == E_SUCCESS)
2230 Eina_Bool ret = false;
2232 String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
2233 SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2235 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
2236 SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2238 ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
2239 SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2246 eina_hash_free(pHttpHeader);
2253 _WebImpl::LoadUrl(const String& url) const
2255 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2256 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2258 ewk_view_url_set(__pWebCore->GetWebNativeNode(), pUrl.get());
2265 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
2267 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2268 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2270 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2272 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
2274 eina_hash_free(pHttpHeader);
2281 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
2283 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2284 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2286 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2288 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
2290 eina_hash_free(pHttpHeader);
2297 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
2299 SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
2301 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
2302 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2303 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
2304 SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2306 ewk_view_contents_set(__pWebCore->GetWebNativeNode(), reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
2313 _WebImpl::Pause(void)
2315 ewk_view_suspend(__pWebCore->GetWebNativeNode());
2320 _WebImpl::Resume(void)
2322 ewk_view_resume(__pWebCore->GetWebNativeNode());
2327 _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
2329 __pSelectBox.reset();
2331 SysTryReturnResult(NID_WEB_CTRL, eina_list_count(pItems) > 0, E_SYSTEM, "ItemCount is invalid.");
2333 result r = E_SUCCESS;
2335 std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
2336 SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2338 r = pSelectBox->Construct(isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
2339 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2341 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2342 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2344 __pSelectBox = std::move(pSelectBox);
2346 __pSelectBox->SetOwner(&GetPublic());
2348 return __pSelectBox->ShowPopup();
2353 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2355 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2357 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2362 _WebImpl::ClearSelectBoxPopup(void)
2364 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2366 __pSelectBox.reset();
2373 _WebImpl::GetDatepicker(void)
2375 _InputPickerPopup* pInputPicker =null;
2378 pInputPicker = __pDatePicker.get();
2380 return pInputPicker;
2385 _WebImpl::GetColorpicker(void)
2387 _InputPickerPopup* pInputPicker =null;
2390 pInputPicker = __pColorPicker.get();
2392 return pInputPicker;
2397 _WebImpl::CanGoBack(void) const
2399 return static_cast< bool >(ewk_view_back_possible(__pWebCore->GetWebNativeNode()));
2404 _WebImpl::CanGoForward(void) const
2406 return static_cast< bool >(ewk_view_forward_possible(__pWebCore->GetWebNativeNode()));
2411 _WebImpl::GoBack(void) const
2413 ewk_view_back(__pWebCore->GetWebNativeNode());
2418 _WebImpl::GoForward(void) const
2420 ewk_view_forward(__pWebCore->GetWebNativeNode());
2425 _WebImpl::GetUrl(void) const
2427 return ewk_view_url_get(__pWebCore->GetWebNativeNode());
2432 _WebImpl::GetTitle(void) const
2434 return ewk_view_title_get(__pWebCore->GetWebNativeNode());
2439 _WebImpl::StopLoading(void) const
2441 ewk_view_stop(__pWebCore->GetWebNativeNode());
2446 _WebImpl::Reload(void) const
2448 ewk_view_reload_bypass_cache(__pWebCore->GetWebNativeNode());
2453 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
2455 if (scriptCode.GetLength() == 0)
2460 result r = E_SUCCESS;
2462 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2463 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2465 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter());
2466 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2468 r = __callbackList.Add(pPresenter.get());
2469 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2471 ewk_view_script_execute(__pWebCore->GetWebNativeNode(), pScript.get(), OnScriptExecuted, pPresenter.get());
2473 std::unique_ptr<String> pResult(new (std::nothrow) String(L""));
2474 SysTryReturn(NID_WEB_CTRL, pResult.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2475 pPresenter->WaitAsyncProcess(*pResult.get());
2477 r = __callbackList.Remove(*pPresenter.get());
2478 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2479 pPresenter.release();
2481 return pResult.release();
2486 _WebImpl::IsPresenterAlived(_WebPresenter* pPresenter) const
2488 return __callbackList.Contains(*pPresenter);
2493 _WebImpl::SetZoomLevel(float level)
2495 SysTryReturnResult(NID_WEB_CTRL, level >= MIN_ZOOM_LEVEL && level <= MAX_ZOOM_LEVEL, E_OUT_OF_RANGE, "The level(%f) must be between 0.3 and 2.0(%f).", level, level);
2497 ewk_view_scale_set(__pWebCore->GetWebNativeNode(), static_cast< double >(level), 0, 0);
2504 _WebImpl::GetZoomLevel(void) const
2506 return static_cast< float >(ewk_view_scale_get(__pWebCore->GetWebNativeNode()));
2510 const PageNavigationList*
2511 _WebImpl::GetBackForwardListN(void) const
2513 result r = E_SUCCESS;
2515 _PageNavigationListImpl* pNavigationListImpl = null;
2516 _HistoryItemImpl* pHistoryItemImpl = null;
2518 std::unique_ptr<PageNavigationList> pNavigationList;
2519 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2522 int forwardCount = 0;
2527 Ewk_History* pEwkHistoryList = ewk_view_history_get(__pWebCore->GetWebNativeNode());
2528 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2530 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2531 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2533 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2534 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2536 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2537 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2539 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2540 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2542 r = pHistoryList->Construct();
2543 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2545 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2546 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2547 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2549 for (int i = -backCount; i < forwardCount + 1; i++)
2551 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2552 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2554 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2555 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2557 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2558 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2560 url = ewk_history_item_uri_get(pEwkItem);
2561 title = ewk_history_item_title_get(pEwkItem);
2562 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2564 pHistoryItemImpl->SetHistoryItem(url, title);
2566 r = pHistoryList->Add(*pHistoryItem.get());
2567 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2568 pHistoryItem.release();
2571 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2573 ewk_history_free(pEwkHistoryList);
2575 return pNavigationList.release();
2578 ewk_history_free(pEwkHistoryList);
2585 _WebImpl::SearchText(const String& text, bool searchForward)
2587 result r = E_SUCCESS;
2589 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2593 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2596 _WebPresenter presenter;
2597 presenter.InitAsyncProcess();
2599 r = SynchronizeSearch(SEARCH_SYNC, __pWebCore->GetWebNativeNode(), condition, text, searchForward, false, &presenter);
2600 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2603 presenter.WaitAsyncProcess(result);
2605 return static_cast < bool >(result);
2610 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2612 result r = E_SUCCESS;
2614 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2618 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2621 r = SynchronizeSearch(SEARCH_ALL_ASYNC, __pWebCore->GetWebNativeNode(), condition, text, true, caseSensitive);
2622 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2629 _WebImpl::SearchNextAsync(bool searchForward)
2631 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2632 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2633 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2635 result r = E_SUCCESS;
2637 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2639 if (__textSearch.__caseSensitive)
2641 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2646 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2649 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, __pWebCore->GetWebNativeNode(), condition, __textSearch.__text, searchForward);
2650 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2657 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
2659 MutexGuard lock(__mutex);
2661 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
2662 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2667 if (__textSearch.__searchAll)
2669 DisableAsyncSearch();
2671 __textSearch.__searchQueue.Enqueue(this);
2672 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2674 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2675 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2679 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2681 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2685 case SEARCH_ALL_ASYNC:
2686 __textSearch.__searchAll = true;
2687 __textSearch.__text = text;
2688 __textSearch.__searchForward = true;
2689 __textSearch.__caseSensitive = caseSensitive;
2690 __textSearch.__totalCount = -1;
2691 __textSearch.__currentIndex = 1;
2693 __textSearch.__searchQueue.Enqueue(this);
2694 __textSearch.__searchQueue.Enqueue(this);
2696 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2697 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2700 case SEARCH_NEXT_ASYNC:
2701 __textSearch.__searchForward = searchForward;
2703 CalculateAsyncSearchOrdinal();
2705 __textSearch.__searchQueue.Enqueue(this);
2707 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2719 _WebImpl::SetAsyncSearchResult(int totalCount)
2721 __textSearch.__totalCount = totalCount;
2726 _WebImpl::GetSearchPresenter(void)
2728 MutexGuard lock(__mutex);
2730 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
2735 _WebImpl::GetPendingAsyncSearchCount(void) const
2737 return __textSearch.__searchQueue.GetCount();
2742 _WebImpl::CalculateAsyncSearchOrdinal(void)
2744 if (__textSearch.__searchForward)
2746 __textSearch.__currentIndex++;
2750 __textSearch.__currentIndex--;
2756 _WebImpl::GetAsyncSearchOrdinal(void) const
2758 return __textSearch.__currentIndex;
2763 _WebImpl::DisableAsyncSearch(void)
2765 __textSearch.__searchAll = false;
2770 _WebImpl::SetSetting(const WebSetting& setting)
2772 if (__pWebCore->GetWebNativeNode())
2774 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2775 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
2776 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
2778 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
2779 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2781 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
2783 switch (setting.GetCacheControl())
2785 case WEB_CACHE_VALIDATED:
2786 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
2789 case WEB_CACHE_IGNORE:
2790 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
2797 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
2799 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
2803 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
2806 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
2808 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
2810 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
2812 if (__defaultUserAgent != setting.GetUserAgent())
2814 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
2815 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2817 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
2820 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
2822 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
2824 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
2826 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
2829 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
2831 pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
2832 pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
2833 pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
2834 pWebSettingImpl->SetFontSize(setting.GetFontSize());
2835 pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
2836 pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
2837 pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
2838 pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
2839 pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
2840 pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
2841 pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
2842 pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
2843 pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
2850 _WebImpl::GetSetting(void) const
2852 return *__pWebCore->GetSetting();
2856 const HitElementResult*
2857 _WebImpl::GetElementByPointN(const Point& point) const
2859 result r = E_SUCCESS;
2861 _HitElementResultImpl* pHitElementResultImpl = null;
2863 std::unique_ptr<HitElementResult> pHitElementResult;
2864 std::unique_ptr<Bitmap> pImage;
2865 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
2867 Point absPoint(__pWebCore->GetAbsoluteCoordinate(point));
2869 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
2870 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
2872 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
2873 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
2874 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
2875 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
2876 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
2878 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
2880 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
2881 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2883 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
2884 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2886 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
2892 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
2893 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
2894 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
2895 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
2897 r = buf.Construct(imageLength);
2898 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2900 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
2901 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2905 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
2906 // webkit support types such as ico and vp8 additionally
2907 if (strcmp(pExtension, "gif") == 0)
2909 format = IMG_FORMAT_GIF;
2911 else if (strcmp(pExtension, "jpg") == 0)
2913 format = IMG_FORMAT_JPG;
2915 else if (strcmp(pExtension, "png") == 0)
2917 format = IMG_FORMAT_PNG;
2919 else if (strcmp(pExtension, "bmp") == 0)
2921 format = IMG_FORMAT_BMP;
2925 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
2929 r = image.Construct();
2930 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2932 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
2933 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2938 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
2939 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2941 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
2942 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2944 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
2945 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2948 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
2950 ewk_hit_test_free(pEwkHitTest);
2952 return pHitElementResult.release();
2955 ewk_hit_test_free(pEwkHitTest);
2961 const HitElementResult*
2962 _WebImpl::GetElementByPointN(const FloatPoint& point) const
2964 const Point integerPoint(_CoordinateSystemUtils::ConvertToInteger(point));
2966 std::unique_ptr<const HitElementResult> pHitElementResult(GetElementByPointN(integerPoint));
2967 SysTryReturn(NID_WEB_CTRL, pHitElementResult.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2969 return pHitElementResult.release();
2974 _WebImpl::IsLoading(void) const
2976 double percent = ewk_view_load_progress_get(__pWebCore->GetWebNativeNode());
2978 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
2990 _WebImpl::GetTextFromBlock(void) const
2992 return ewk_view_text_selection_text_get(__pWebCore->GetWebNativeNode());
2997 _WebImpl::IsPrivateBrowsingEnabled(void) const
2999 if (__pWebCore->GetWebNativeNode() == null)
3001 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
3004 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3005 SysAssertf(pSettings, "Failed to get webkit instance.");
3007 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
3012 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
3014 if (__pWebCore->GetWebNativeNode() == null)
3016 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
3020 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3021 SysAssertf(pSettings, "Failed to get webkit instance.");
3023 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
3028 _WebImpl::ClearHistory(void)
3030 ewk_view_back_forward_list_clear(__pWebCore->GetWebNativeNode());
3035 _WebImpl::ClearCache(void)
3037 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3038 SysAssertf(pContext, "Failed to get webkit instance.");
3040 ewk_context_cache_clear(pContext);
3045 _WebImpl::ClearCookie(void)
3047 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3048 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3049 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3051 ewk_cookie_manager_cookies_clear(pCookieManager);
3056 _WebImpl::ClearFormData(void)
3058 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3059 SysAssertf(pContext, "Failed to get webkit instance.");
3061 ewk_context_form_candidate_data_clear(pContext);
3066 _WebImpl::ClearLoginFormData(void)
3068 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3069 SysAssertf(pContext, "Failed to get webkit instance.");
3071 ewk_context_form_password_data_clear(pContext);
3076 _WebImpl::IsCookieEnabled(void) const
3078 if (__pWebCore->GetWebNativeNode() == null)
3080 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
3083 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3084 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3085 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3087 _WebPresenter presenter;
3088 presenter.InitAsyncProcess();
3090 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, &presenter);
3092 bool result = false;
3093 presenter.WaitAsyncProcess(result);
3100 _WebImpl::SetCookieEnabled(bool enable)
3102 if (__pWebCore->GetWebNativeNode() == null)
3104 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
3109 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3110 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3111 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3115 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
3119 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
3120 ewk_cookie_manager_cookies_clear(pCookieManager);
3126 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
3128 result r = E_SUCCESS;
3130 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
3131 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3134 String fileExtension = File::GetFileExtension(filePath);
3135 int pathLength = filePath.GetLength();
3138 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
3140 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
3141 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3142 r = filePath.SubString(0, index + 1, dirPath);
3143 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3145 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
3146 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
3150 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
3152 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), pSize->width, pSize->height, pFilePath.get());
3156 Evas_Coord contentsWidth;
3157 Evas_Coord contentsHeight;
3159 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &contentsWidth, &contentsHeight);
3160 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), contentsWidth, contentsHeight, pFilePath.get());
3168 _WebImpl::IsMimeSupported(const String& mime) const
3170 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
3171 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3173 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(__pWebCore->GetWebNativeNode()), pMime.get()));
3178 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
3180 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
3185 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
3187 __pUserUiListener = pUiEventListener;
3192 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
3194 __pUserUiListenerF = pUiEventListener;
3199 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
3201 __pUserKeypadEventListener = pKeypadEventListener;
3206 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
3208 if (__pWebDownloadHandler.get() == null)
3210 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
3211 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3214 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
3215 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
3220 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
3222 __pTextSearchListener = pTextSearchListener;
3227 _WebImpl::SetScrollEnabled(bool enable)
3229 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
3234 _WebImpl::IsScrollEnabled(void) const
3236 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
3241 _WebImpl::InitJsBridgeList(void)
3243 result r = E_SUCCESS;
3245 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
3246 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3248 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
3249 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3251 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
3252 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3254 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
3255 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3257 __pJsBridgeList = std::move(pJsBridgeList);
3264 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3266 result r = E_SUCCESS;
3268 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3269 String key(pJsBridge->GetName());
3271 r = __pJsBridgeList->Add(key, pJsBridge);
3272 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3279 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3281 result r = E_SUCCESS;
3283 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3284 String key(pJsBridge->GetName());
3286 r = __pJsBridgeList->Remove(key);
3287 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3294 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3296 result r = E_SUCCESS;
3298 IJsonValue* pJsonValue = null;
3299 IJavaScriptBridge* pJsBridge = null;
3301 String key(L"name");
3303 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3304 SysTryReturn(NID_WEB_CTRL, pJsonObject, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. Json text must be Json Object type." , GetErrorMessage(E_INVALID_ARG));
3306 r = pJsonObject->GetValue(&key, pJsonValue);
3307 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3309 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3310 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3312 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3313 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3320 _WebImpl::GetLoadingListener(void) const
3322 return __pUserLoadingListener;
3326 IWebUiEventListener*
3327 _WebImpl::GetUiEventListener(void) const
3329 return __pUserUiListener;
3333 IWebUiEventListenerF*
3334 _WebImpl::GetUiEventListenerF(void) const
3336 return __pUserUiListenerF;
3340 IWebKeypadEventListener*
3341 _WebImpl::GetWebKeypadEventListener(void) const
3343 return __pUserKeypadEventListener;
3347 ITextSearchListener*
3348 _WebImpl::GetTextSearchListener(void) const
3350 return __pTextSearchListener;
3355 _WebImpl::SetEventListenerCallback(void) const
3357 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3360 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3361 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3363 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3364 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3366 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3367 SysAssertf(pSmartData, "Failed to request");
3369 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3370 SysAssertf(pSmart, "Failed to request");
3372 pSmart->popup_menu_show = OnSelectBoxRequested;
3373 pSmart->popup_menu_hide = OnSelectBoxClosed;
3374 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3376 pSmart->input_picker_show = OnDatePickerProviderRequested;
3377 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3378 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3380 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3382 // add loading event callbacks for ILoadingListener
3383 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3384 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3386 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3387 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3388 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3389 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3390 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3391 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3392 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3393 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3394 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3396 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3398 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3400 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3401 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3402 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3404 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3405 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3407 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3409 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3410 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3411 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3413 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3415 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3416 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3417 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3419 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3420 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3421 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3423 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3424 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3425 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3427 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3428 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3429 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3430 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3432 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3433 evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
3435 evas_object_smart_callback_add(pWebNativeNode, "text,style,state", OnWebPageBlockSelected, this);
3436 evas_object_smart_callback_add(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation, this);
3438 ewk_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(this));
3439 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3440 SysAssertf(pContext, "Failed to get webkit instance.");
3441 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3442 ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
3443 ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
3445 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3451 _WebImpl::RemoveEventListenerCallback(void) const
3453 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3456 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3457 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3459 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3460 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3462 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3463 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3465 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3466 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3467 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3468 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3469 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3470 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3471 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3472 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3474 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3476 evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3478 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3479 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3480 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3482 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3483 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3485 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3487 ewk_view_javascript_alert_callback_set(null, null, null);
3488 ewk_view_javascript_prompt_callback_set(null, null, null);
3489 ewk_view_javascript_confirm_callback_set(null, null, null);
3491 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3493 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3494 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3495 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3497 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3498 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3499 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3500 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3501 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3502 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3504 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3505 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3506 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3508 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3510 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3511 evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
3513 evas_object_smart_callback_del(pWebNativeNode, "text,style,state", OnWebPageBlockSelected);
3514 evas_object_smart_callback_del(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation);
3516 ewk_view_open_panel_callback_set(null, null, null);
3517 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3518 SysAssertf(pContext, "Failed to get webkit instance.");
3519 ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
3520 ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
3522 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3528 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3530 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3532 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3533 SysAssertf(pSmartData, "Failed to request");
3535 Point absPoint(__pWebCore->GetAbsoluteCoordinate(startPoint));
3537 Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3540 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3542 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3543 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
3545 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3547 if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false))
3549 ewk_view_command_execute(pWebNativeNode, "SelectWord", 0);
3553 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3554 char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
3557 ewk_view_command_execute(pWebNativeNode, "SelectWord", 0);
3562 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
3569 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
3571 return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToInteger(startPoint));
3576 _WebImpl::ReleaseBlock(void)
3578 ewk_view_text_selection_range_clear(__pWebCore->GetWebNativeNode());
3583 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
3585 FloatPoint tempStartPoint;
3586 FloatPoint tempEndPoint;
3588 GetBlockRange(tempStartPoint, tempEndPoint);
3590 startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
3591 endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
3596 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
3598 Eina_Rectangle leftHandle;
3599 Eina_Rectangle rightHandle;
3601 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
3603 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
3604 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
3605 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
3606 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
3608 if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
3610 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
3611 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
3617 _WebImpl::GetFaviconN(void) const
3619 result r = E_SUCCESS;
3621 Evas_Object* pView = __pWebCore->GetWebNativeNode();
3623 Evas* pEvas = evas_object_evas_get(pView);
3624 Ewk_Context* pContext = ewk_view_context_get(pView);
3625 SysAssertf(pEvas && pContext, "Failed to request");
3627 const char* pUrl = ewk_view_url_get(pView);
3629 Tizen::Graphics::BufferInfo bufferInfo;
3630 Tizen::Base::ByteBuffer byteBuffer;
3632 std::unique_ptr<Bitmap> pBitmapImage(new (std::nothrow) Bitmap());
3633 SysTryReturn(NID_WEB_CTRL, pBitmapImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3635 Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
3641 r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
3642 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3644 const Dimension dimension(bufferInfo.width, bufferInfo.height);
3646 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
3647 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3649 r = pBitmapImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
3650 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3652 return pBitmapImage.release();
3658 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
3660 ewk_view_scroll_by(__pWebCore->GetWebNativeNode(), diff.x, diff.y);
3665 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
3667 ewk_view_scroll_set(__pWebCore->GetWebNativeNode(), dest.x, dest.y);
3672 _WebImpl::GetScrollPosition(void) const
3676 ewk_view_scroll_pos_get(__pWebCore->GetWebNativeNode(), &position.x, &position.y);
3683 _WebImpl::GetPageSize(void) const
3685 Evas_Coord width = 0;
3686 Evas_Coord height = 0;
3688 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &width, &height);
3690 Dimension size(static_cast< int >(width), static_cast< int >(height));
3697 _WebImpl::SetLoadingErrorOccurred(bool arg)
3699 __isLoadingErrorOccurred = arg;
3704 _WebImpl::IsLoadingErrorOccurred(void) const
3706 return __isLoadingErrorOccurred;
3711 _WebImpl::SetRedirectRequested(bool arg)
3713 __isRedirectRequested = arg;
3718 _WebImpl::IsRedirectRequested(void) const
3720 return __isRedirectRequested;
3725 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
3732 _WebImpl::GetPolicyDecision(void) const
3739 _WebImpl::SetCertificateRequested(bool arg)
3741 __isCertificateRequested = arg;
3746 _WebImpl::IsCertificateRequested(void) const
3748 return __isCertificateRequested;
3753 _WebImpl::IsCertificateConfirmed(void) const
3755 return __isCertificateConfirmed;
3760 _WebImpl::SetOrientationChanged(bool arg)
3762 __isOrientationChanged = arg;
3767 _WebImpl::IsOrientationChanged(void) const
3769 return __isOrientationChanged;
3774 _WebImpl::LaunchAppControl(const IEventArg& arg)
3776 result r = E_SUCCESS;
3778 IEventArg* pArg = const_cast< IEventArg* >(&arg);
3779 _WebEventArg* pWebEventArg = dynamic_cast< _WebEventArg* >(pArg);
3780 SysTryReturnResult(NID_WEB_CTRL, pWebEventArg, E_INVALID_ARG, "Type casting failed. argument must be IEventArg type.");
3782 String operationId(L"");
3783 String uriPattern(pWebEventArg->GetEventMessage());
3784 SysLog(NID_WEB_CTRL, "The current value of web event type is %d", pWebEventArg->GetEventType());
3786 switch (pWebEventArg->GetEventType())
3788 case WEB_EVENT_REQUEST_RTSP:
3792 int uriLength = uriPattern.GetLength();
3795 operationId = L"http://tizen.org/appcontrol/operation/view";
3797 r = uriPattern.LastIndexOf(L".", uriLength - 1, index);
3798 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3800 r = uriPattern.SubString(index + 1, ext);
3801 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3803 r = _AppControlManager::GetMimeFromExt(ext, mimeType);
3804 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3806 r = _AppControlImpl::FindAndStart(operationId, &uriPattern, &mimeType, null, null, null);
3807 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3811 case WEB_EVENT_REQUEST_TEL:
3813 operationId = L"http://tizen.org/appcontrol/operation/dial";
3816 case WEB_EVENT_REQUEST_EMAIL:
3818 case WEB_EVENT_REQUEST_SMS:
3820 case WEB_EVENT_REQUEST_MMS:
3822 operationId = L"http://tizen.org/appcontrol/operation/compose";
3825 case WEB_EVENT_REQUEST_UNKNOWN:
3827 operationId = L"http://tizen.org/appcontrol/operation/view";
3835 r = _AppControlImpl::FindAndStart(operationId, &uriPattern, null, null, null, null);
3836 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3843 _WebImpl::SetFullScreenKeypad(void)
3845 result r = E_SUCCESS;
3847 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
3848 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
3850 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
3851 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3853 String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
3854 pKeypad->SetText(text);
3856 r = pKeypad->SetShowState(true);
3857 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3859 r = pKeypad->Show();
3860 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3862 pKeypad->AddTextEventListener(*this);
3864 __pKeypad = std::move(pKeypad);
3871 _WebImpl::RemoveFullScreenKeypad(void)
3873 __pKeypad->RemoveTextEventListener(*this);
3880 _WebImpl::IsFooterVisible(void) const
3882 return __isFooterVisible;
3887 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
3889 __isFooterVisible = isFooterVisible;
3894 _WebImpl::IsKeypadVisible(void) const
3896 return __isKeypadVisible;
3901 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
3903 __isKeypadVisible = isKeypadVisible;
3908 _WebImpl::IsKeypadOpened(void) const
3910 return __isKeypadOpened;
3914 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
3916 __isKeypadOpened = isKeypadOpened;
3921 _WebImpl::GetPreviousKeypadBounds(void) const
3923 return __keypadBounds;
3928 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
3930 __keypadBounds = bounds;
3935 _WebImpl::OnTextValueChangeCanceled(const Control& source)
3937 RemoveFullScreenKeypad();
3942 _WebImpl::OnTextValueChanged(const Control& source)
3944 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
3946 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
3948 RemoveFullScreenKeypad();
3953 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
3955 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
3956 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
3958 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
3959 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3961 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
3962 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
3964 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
3971 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
3973 result r = E_SUCCESS;
3975 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
3976 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
3978 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
3980 ILoadingListener* pLoadingListner = GetLoadingListener();
3981 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
3983 switch (pEventArg->GetEventType())
3985 case WEB_EVENT_LOADINGLISTENER_STARTED:
3987 pLoadingListner->OnLoadingStarted();
3991 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
3993 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
3994 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3996 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
4000 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
4002 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
4003 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4005 pLoadingListner->OnPageTitleReceived(*pPageTitle);
4009 case WEB_EVENT_LOADINGLISTENER_CANCELED:
4011 pLoadingListner->OnLoadingCanceled();
4015 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
4017 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
4018 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4020 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
4021 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4023 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
4025 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
4029 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
4031 pLoadingListner->OnLoadingCompleted();
4035 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
4037 pLoadingListner->OnHttpAuthenticationCanceled();
4041 case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
4043 std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
4044 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4048 pLoadingListner->OnFaviconReceived(*pFavicon.get());
4064 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
4066 result r = E_SUCCESS;
4068 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
4069 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4071 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4073 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
4074 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
4076 switch (pEventArg->GetEventType())
4078 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
4080 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
4081 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4083 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
4087 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
4089 pWebDownloadListener->OnWebDataDownloadCompleted();
4093 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
4095 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
4096 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4098 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
4100 pWebDownloadListener->OnWebDownloadFailed(errorType);
4115 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
4117 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4118 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4120 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4122 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4124 switch (pEventArg->GetEventType())
4126 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
4128 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4130 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4131 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4133 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4134 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4136 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4140 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
4142 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4144 __pUserUiListener->OnWebPageShowRequested(*pWeb);
4148 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
4150 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4152 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
4156 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
4158 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4160 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4161 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4163 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4178 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
4180 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4181 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4183 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4185 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4187 switch (pEventArg->GetEventType())
4189 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
4191 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4193 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4194 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4196 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4197 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4199 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4203 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
4205 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4207 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
4211 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
4213 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4215 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
4219 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
4221 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4223 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4224 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4226 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4241 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
4243 result r = E_SUCCESS;
4245 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
4246 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4248 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4250 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
4251 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
4253 switch (pEventArg->GetEventType())
4255 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4257 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4258 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4260 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4261 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4263 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4278 _WebImpl::VibrationRequested(uint64_t duration)
4280 result r = E_SUCCESS;
4282 __pVibrator.reset();
4284 std::unique_ptr<_VibratorImpl> pVibrator(new (std::nothrow) _VibratorImpl);
4285 SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4287 r = pVibrator->Construct();
4288 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4290 __pVibrator = std::move(pVibrator);
4292 IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
4294 r = __pVibrator->Start(&pattern, 1, 1);
4295 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4302 _WebImpl::VibrationCanceled(void)
4304 __pVibrator.reset();
4309 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4311 result r = E_SUCCESS;
4313 String host(ewk_auth_challenge_url_get(pChallenge));
4314 String realm(ewk_auth_challenge_realm_get(pChallenge));
4316 __pAuthChallenge.reset();
4318 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4319 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4321 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4322 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4324 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4325 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4327 __pAuthChallenge = std::move(pAuthChallenge);
4329 ewk_auth_challenge_suspend(pChallenge);
4330 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4332 __pAuthChallenge.release();
4336 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4337 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4345 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4347 result r = E_SUCCESS;
4349 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4350 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4352 r = pAuthPopup->Construct(host, realm, pAuthChallenge);
4353 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4355 __pAuthPopup = std::move(pAuthPopup);
4357 int modalResult = 0;
4359 __pAuthPopup->SetOwner(&GetPublic());
4361 r = __pAuthPopup->ShowAndWait(modalResult);
4362 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4365 __pAuthPopup.reset();
4372 _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
4374 result r = E_SUCCESS;
4376 std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
4377 SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4379 r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
4380 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4382 __pCertConfirmPopup = std::move(pCertConfirmPopup);
4384 int modalResult = 0;
4386 __pCertConfirmPopup->SetOwner(&GetPublic());
4388 r = __pCertConfirmPopup->ShowAndWait(modalResult);
4389 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4391 if (userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
4393 __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
4397 __pCertConfirmPopup.reset();
4403 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy)
4405 result r = E_SUCCESS;
4407 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4408 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4410 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, true);
4411 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4413 __pUserConfirmPopup = std::move(pUserConfirmPopup);
4415 int modalResult = 0;
4417 __pUserConfirmPopup->SetOwner(&GetPublic());
4419 r = __pUserConfirmPopup->ShowAndWait(modalResult);
4420 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4423 __pUserConfirmPopup.reset();
4429 _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4431 result r = E_SUCCESS;
4433 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4434 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4436 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, false, msg);
4437 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4439 __pUserConfirmPopup = std::move(pUserConfirmPopup);
4441 __pUserConfirmPopup->SetOwner(&GetPublic());
4443 r = __pUserConfirmPopup->ShowPopup();
4444 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4446 __pUserConfirmPopup.release();
4451 __pUserConfirmPopup.reset();
4458 _WebImpl::GetParentFormCore(_Control* pControlCore)
4461 _Form* pFormCore = null;
4463 _Control* pParentControlCore = dynamic_cast< _Control* >(pControlCore->GetParent());
4464 if (!pParentControlCore)
4469 pFormCore = dynamic_cast< _Form* >(pParentControlCore);
4475 return GetParentFormCore(pParentControlCore);
4480 _WebImpl::OnFocusGained(const _ControlImpl& source)
4487 _WebImpl::OnFocusLost(const _ControlImpl& source)
4489 if(IsKeypadVisible() == true)
4491 SetKeypadOpened(true);
4493 SetKeypadVisibleState(false);
4496 evas_object_focus_set(__pWebCore->GetWebNativeNode(), EINA_FALSE);
4503 _WebImpl::HasValidNativeNode(void) const
4505 if (__pWebCore && __pWebCore->GetWebNativeNode())
4515 _WebImpl::OnPreAttachedToMainTree(void)
4517 result r = E_SUCCESS;
4519 r = __pWebCore->InitializeWebNativeNode();
4520 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4522 r = InitializeSetting();
4523 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4525 r = _ContainerImpl::OnPreAttachedToMainTree();
4526 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4533 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
4535 _ContainerImpl::OnChangeLayout(orientation);
4537 if (__pColorPicker.get())
4539 __pColorPicker->ChangeLayout(orientation);
4542 __isOrientationChanged = true;
4547 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
4549 if (IsVisible() == true)
4551 ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
4555 ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
4561 _WebImpl::GetDownloadHandler(void) const
4563 return __pWebDownloadHandler.get();
4568 _WebImpl::HideColorPicker(void)
4570 __pColorPicker.reset();
4577 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
4579 result r = E_SUCCESS;
4581 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
4582 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4584 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
4586 r = pColorHadler->Construct(colorVal, this);
4587 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4589 __pColorPicker = std::move(pColorHadler);
4591 r = __pColorPicker->ShowPopup();
4592 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4594 color = __pColorPicker->GetColor();
4599 __pColorPicker.reset();
4606 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
4608 result r = E_SUCCESS;
4610 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
4611 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4613 r = pInputPicker->Construct(String(inputValue), inputType, this);
4614 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4616 __pDatePicker = std::move(pInputPicker);
4618 r = __pDatePicker->ShowPopup();
4619 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4621 dateStr = __pDatePicker->GetDate();
4624 __pDatePicker.reset();
4631 _WebImpl::GetInstance(Web* pWeb)
4633 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
4638 _WebImpl::GetInstance(const Web* pWeb)
4640 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
4645 _WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
4647 int checkReturn = 0;
4649 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
4652 if( checkmime == true)
4654 table = CUSTOM_CONTENT_TABLE_NAME;
4658 table = CUSTOM_PROTOCOL_TABLE_NAME;
4661 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
4662 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
4663 String target(ewk_custom_handlers_data_target_get(pHandlerData));
4665 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
4667 result r = db.Construct(handlerPath, "r+", null);
4668 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
4670 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow From " + table + L" Where baseUrl = '" + baseUri + L"' AND url = '" + uri + L"' AND mime = '" + target + L"'"));
4671 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4675 r = pEnum->MoveNext();
4676 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
4677 r = pEnum->GetIntAt(0, checkReturn);
4678 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
4690 _WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
4694 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
4697 if( checkmime == true)
4699 table = CUSTOM_CONTENT_TABLE_NAME;
4703 table = CUSTOM_PROTOCOL_TABLE_NAME;
4706 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
4707 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
4708 String target(ewk_custom_handlers_data_target_get(pHandlerData));
4710 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
4712 result r = db.Construct(handlerPath, "r+", null);
4713 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4715 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select id From " + table + L" Where baseUrl = '" + baseUri + L"' AND url = '" + uri + L"' AND mime = '" + target + L"'"));
4716 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4720 r = pEnum->MoveNext();
4721 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4722 r = pEnum->GetIntAt(0, checkId);
4723 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4725 std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
4726 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4728 r = pDeleteStmt->BindInt(0, checkId);
4729 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4731 db.BeginTransaction();
4733 std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
4735 db.CommitTransaction();
4742 const Tizen::Base::String
4743 _WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
4745 if (originUri == L"" || currentUri == L"")
4750 result r = E_SUCCESS;
4753 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
4754 String originReplace(originUri);
4755 String table(CUSTOM_PROTOCOL_TABLE_NAME);
4759 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
4760 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4762 r = currentUri.SubString(0, found + 1, baseUri);
4763 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4765 r = db.Construct(handlerPath, "r+", null);
4766 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4768 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
4769 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
4773 while (pEnum->MoveNext() == E_SUCCESS)
4778 String originScheme;
4780 r = pEnum->GetStringAt(0, protocol);
4781 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4783 r = pEnum->GetStringAt(1, queryUrl);
4784 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4786 r = pEnum->GetIntAt(2, allow);
4787 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4794 String protocolScheme(protocol + L":");
4796 r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
4797 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4799 if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
4801 if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
4803 r = originReplace.Replace(originScheme, "");
4804 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4806 queryUrl.Replace("%s", originReplace, 0);
4807 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4819 const Tizen::Base::String
4820 _WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
4822 if (originUri == L"" || currentUri == L"" || mime == L"")
4827 result r = E_SUCCESS;
4830 String originUrlStr = originUri;
4831 const String replaceStr = L"%s";
4833 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
4834 String table(CUSTOM_CONTENT_TABLE_NAME);
4838 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
4839 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4841 r = currentUri.SubString(0, found + 1, baseUri);
4842 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4844 r = db.Construct(handlerPath, "r+", null);
4845 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4847 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
4851 r = pEnum->MoveNext();
4852 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4853 r = pEnum->GetIntAt(0, allow);
4854 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4855 r = pEnum->GetStringAt(1, contentUrl);
4856 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4864 if (contentUrl != L"")
4866 r = contentUrl.Replace(replaceStr, originUrlStr, 0);
4867 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4878 }}} // Tizen::Web::Controls