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 <FGrp_Screen.h>
76 #include <FIo_DatabaseImpl.h>
77 #include <FIo_NormalFile.h>
78 #include <FSys_VibratorImpl.h>
79 #include <FUi_Control.h>
80 #include <FUi_CoordinateSystemUtils.h>
81 #include <FUi_EcoreEvasMgr.h>
82 #include <FUi_EcoreEvas.h>
83 #include <FUi_ResourceSizeInfo.h>
84 #include <FUi_Window.h>
85 #include <FUiAnim_EflNode.h>
86 #include <FUiAnim_VisualElement.h>
87 #include <FUiCtrl_FooterImpl.h>
88 #include <FUiCtrl_Form.h>
89 #include "FWeb_HistoryItemImpl.h"
90 #include "FWebCtrl_AppControlListener.h"
91 #include "FWebCtrl_AuthConfirmPopup.h"
92 #include "FWebCtrl_AuthenticationChallengeImpl.h"
93 #include "FWebCtrl_EflWebkit.h"
94 #include "FWebCtrl_GeolocationPermissionManagerImpl.h"
95 #include "FWebCtrl_HitElementResultImpl.h"
96 #include "FWebCtrl_InputPickerPopup.h"
97 #include "FWebCtrl_WebNotification.h"
98 #include "FWebCtrl_PageNavigationListImpl.h"
99 #include "FWebCtrl_PromptPopup.h"
100 #include "FWebCtrl_SelectBox.h"
101 #include "FWebCtrl_Utility.h"
102 #include "FWebCtrl_Web.h"
103 #include "FWebCtrl_WebDataHandler.h"
104 #include "FWebCtrl_WebEvent.h"
105 #include "FWebCtrl_WebEventArg.h"
106 #include "FWebCtrl_WebImpl.h"
107 #include "FWebCtrl_WebPresenter.h"
108 #include "FWebCtrl_WebSettingImpl.h"
111 using namespace Tizen::App;
112 using namespace Tizen::Base;
113 using namespace Tizen::Base::Collection;
114 using namespace Tizen::Base::Runtime;
115 using namespace Tizen::Base::Utility;
116 using namespace Tizen::Content;
117 using namespace Tizen::Graphics;
118 using namespace Tizen::Io;
119 using namespace Tizen::Media;
120 using namespace Tizen::Net::Http;
121 using namespace Tizen::System;
122 using namespace Tizen::Ui;
123 using namespace Tizen::Ui::Animations;
124 using namespace Tizen::Ui::Controls;
125 using namespace Tizen::Web::Json;
128 namespace Tizen { namespace Web { namespace Controls
132 static const char WEB_CTRL[] = "webcontrol";
133 static const char PARENT_WEB_CTRL[] = "parentwebcontrol";
136 static const float MIN_ZOOM_LEVEL = 0.3;
137 static const float MAX_ZOOM_LEVEL = 2;
140 static const int REDIRECTION_HEADER_GROUP = 300;
143 static const int MAX_TEXT_MATCH = pow(2, 31) - 1;
146 static const int PORTRAIT_KEYPAD_HEIGHT = 444;
147 static const int LANDSCAPE_KEYPAD_HEIGHT = 316;
148 static const int DEFAULT_LIST_ITEM_COUNT = 4;
152 AddHttpHeaderData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
154 result r = E_SUCCESS;
156 String key(reinterpret_cast< const char* >(pKey));
157 String value(reinterpret_cast< char* >(pValue));
159 SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
161 r = reinterpret_cast< HttpHeader* >(pUserData)->AddField(key, value);
162 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
169 AddHttpAttributeData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
171 result r = E_SUCCESS;
173 std::unique_ptr<String> pAttrKey(new (std::nothrow) String(reinterpret_cast< char* >(const_cast< void* >(pKey))));
174 std::unique_ptr<String> pAttrValue(new (std::nothrow) String(reinterpret_cast< char* >(pValue)));
175 SysTryReturn(NID_WEB_CTRL, pAttrKey.get() && pAttrValue.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
177 SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
179 r = reinterpret_cast< HashMap* >(pUserData)->Add(*pAttrKey, *pAttrValue);
180 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
182 pAttrValue.release();
189 FreeCharArray(void* pData)
191 delete[] reinterpret_cast<char*>(pData);
196 ConvertErrorCode(int error)
198 LoadingErrorType errorCode = WEB_ERROR_UNKNOWN;
202 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
204 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE:
206 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE_PROXY:
208 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT:
210 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT_PROXY:
212 case EWK_ERROR_NETWORK_STATUS_IO_ERROR:
214 case EWK_ERROR_NETWORK_STATUS_MALFORMED:
216 case EWK_ERROR_NETWORK_STATUS_TRY_AGAIN:
218 case EWK_ERROR_NETWORK_STATUS_TOO_MANY_REDIRECTS:
220 case EWK_ERROR_NETWORK_STATUS_TLS_FAILED:
222 case EWK_ERROR_NETWORK_STATUS_INTERNAL_SERVER_ERROR:
224 case EWK_ERROR_NETWORK_STATUS_BAD_GATEWAY:
226 case EWK_ERROR_NETWORK_STATUS_SERVICE_UNAVAILABLE:
228 case EWK_ERROR_NETWORK_STATUS_GATEWAY_TIMEOUT:
229 errorCode = WEB_NO_CONNECTION;
232 case EWK_ERROR_NETWORK_STATUS_BAD_REQUEST:
234 case EWK_ERROR_NETWORK_STATUS_REQUEST_URI_TOO_LONG:
235 errorCode = WEB_BAD_URL;
238 case EWK_ERROR_NETWORK_STATUS_FORBIDDEN:
239 errorCode = WEB_FILE_ACCESS_FAILED;
242 case EWK_ERROR_NETWORK_STATUS_REQUEST_TIMEOUT:
243 errorCode = WEB_REQUEST_TIMEOUT;
246 case EWK_ERROR_NETWORK_STATUS_UNSUPPORTED_MEDIA_TYPE:
247 errorCode = WEB_MIME_NOT_SUPPORTED;
250 case EWK_ERROR_NETWORK_STATUS_INSUFFICIENT_STORAGE:
251 errorCode = WEB_OUT_OF_MEMORY;
254 case EWK_ERROR_NETWORK_STATUS_REQUEST_ENTITY_TOO_LARGE:
255 errorCode = WEB_REQUEST_MAX_EXCEEDED;
258 case EWK_ERROR_NETWORK_STATUS_CONTINUE:
260 case EWK_ERROR_NETWORK_STATUS_SWITCHING_PROTOCOLS:
262 case EWK_ERROR_NETWORK_STATUS_PROCESSING:
264 case EWK_ERROR_NETWORK_STATUS_OK:
266 case EWK_ERROR_NETWORK_STATUS_CREATED:
268 case EWK_ERROR_NETWORK_STATUS_ACCEPTED:
270 case EWK_ERROR_NETWORK_STATUS_NON_AUTHORITATIVE:
272 case EWK_ERROR_NETWORK_STATUS_NO_CONTENT:
274 case EWK_ERROR_NETWORK_STATUS_RESET_CONTENT:
276 case EWK_ERROR_NETWORK_STATUS_PARTIAL_CONTENT:
278 case EWK_ERROR_NETWORK_STATUS_MULTI_STATUS:
280 case EWK_ERROR_NETWORK_STATUS_MULTIPLE_CHOICES:
282 case EWK_ERROR_NETWORK_STATUS_MOVED_PERMANENTLY:
284 case EWK_ERROR_NETWORK_STATUS_FOUND:
286 case EWK_ERROR_NETWORK_STATUS_SEE_OTHER:
288 case EWK_ERROR_NETWORK_STATUS_NOT_MODIFIED:
290 case EWK_ERROR_NETWORK_STATUS_USE_PROXY:
292 case EWK_ERROR_NETWORK_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL:
294 case EWK_ERROR_NETWORK_STATUS_TEMPORARY_REDIRECT:
295 errorCode = WEB_HTTP_RESPONSE;
298 case EWK_ERROR_NETWORK_STATUS_SSL_FAILED:
299 errorCode = WEB_INVALID_CERTIFICATE;
303 errorCode = WEB_ERROR_UNKNOWN;
312 FireLoadingErrorOccurredEvent(_WebImpl* pImpl, int code, const char* pDescription)
314 result r = E_SUCCESS;
316 std::unique_ptr<Integer> pErrorCode(new (std::nothrow) Integer(code));
317 std::unique_ptr<String> pErrorDescription(new (std::nothrow) String(pDescription));
318 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED));
319 SysTryReturnResult(NID_WEB_CTRL, pErrorCode.get() && pErrorDescription.get() && pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
321 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_TYPE, *pErrorCode.get());
322 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
323 pErrorCode.release();
325 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_MESSAGE, *pErrorDescription.get());
326 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
327 pErrorDescription.release();
329 r = pImpl->GetWebEvent()->FireAsync(*pEventArg);
330 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
338 OnScriptAlertRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
340 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
342 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
343 String msg(pMessage);
345 result r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_ALERT, pView, msg);
346 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
350 ewk_view_javascript_alert_reply(pView);
356 OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
358 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
360 result r = E_SUCCESS;
361 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
362 String msg(pMessage);
364 MessageBox messageBox;
365 r = messageBox.Construct(L"", msg, MSGBOX_STYLE_OKCANCEL);
366 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
370 messageBox.SetOwner(&pImpl->GetPublic());
372 r = messageBox.ShowAndWait(modalResult);
373 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
375 if (modalResult == MSGBOX_RESULT_OK)
377 ewk_view_javascript_confirm_reply(pView, EINA_TRUE);
381 ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
389 OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pDefaultValue, void* pUserData)
391 SysLog(NID_WEB_CTRL, "The current value of message is %s, defaulValue is %s", pMessage, pDefaultValue);
393 result r = E_SUCCESS;
394 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
395 String msg(pMessage);
396 String defVal(pDefaultValue);
398 std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
399 SysTryCatch(NID_WEB_CTRL, pPromptPopup.get(), , E_OUT_OF_MEMORY, "Memory allocation failed.");
401 r = pPromptPopup->Construct(msg, defVal, pView);
402 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
404 pPromptPopup->SetOwner(&pImpl->GetPublic());
406 r = pPromptPopup->ShowPopup();
407 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
409 pPromptPopup.release();
414 ewk_view_javascript_prompt_reply(pView, null);
421 OnCertificateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
423 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
424 Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(pEventInfo);
425 SysAssertf(pImpl && pPolicy, "Failed to request");
427 switch (pImpl->GetSetting().GetCertificateErrorHandlingMode())
429 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM:
431 if (pImpl->IsCertificateRequested())
433 ewk_certificate_policy_decision_allowed_set(pPolicy, static_cast< Eina_Bool >(pImpl->IsCertificateConfirmed()));
437 result r = E_SUCCESS;
439 r = pImpl->ShowCertificateConfirmPopup(CERTIFICATE_POPUP_MODE_USER_CONFIRM, pPolicy);
440 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
442 pImpl->SetCertificateRequested(true);
445 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL:
447 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
449 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE :
450 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_TRUE);
459 OnHttpAuthenticationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
461 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
462 Ewk_Auth_Challenge* pChallenge = reinterpret_cast< Ewk_Auth_Challenge* >(pEventInfo);
463 SysAssertf(pImpl && pChallenge, "Failed to request");
465 result r = E_SUCCESS;
467 r = pImpl->HttpAuthenticationRequested(pChallenge);
468 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
472 ewk_auth_challenge_credential_cancel(pChallenge);
473 evas_object_smart_callback_call(pView, "authentication,canceled", NULL);
478 OnHttpAuthenticationCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
480 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
481 SysAssertf(pImpl , "Failed to request");
483 if (pImpl->GetLoadingListener())
485 result r = E_SUCCESS;
487 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED));
488 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
490 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
491 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
498 OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
500 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
501 Ewk_Geolocation_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(pEventInfo);
502 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
504 if (pImpl->GetSetting().IsGeolocationEnabled())
506 result r = E_SUCCESS;
508 std::unique_ptr<DbEnumerator> pEnum;
510 String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
511 String table(GEOLOCATION_TABLE_NAME);
514 const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPermissionRequest);
515 String origin = _Utility::CreateOrigin(pSecurityOrigin);
517 r = db.Construct(geolocationPath, "r", null);
518 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
520 pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select permission From " + table + L" Where origin = '" + origin + L"'"));
523 r = pEnum->MoveNext();
524 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
527 r = pEnum->GetIntAt(0, permission);
528 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
530 SysLog(NID_WEB_CTRL, "The current value of permission is %d", permission);
532 ewk_geolocation_permission_request_set(pPermissionRequest, static_cast < Eina_Bool >(permission));
536 ewk_geolocation_permission_request_suspend(pPermissionRequest);
538 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_GEOLOCATION, pPermissionRequest);
539 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
546 ewk_geolocation_permission_request_set(pPermissionRequest, EINA_FALSE);
551 OnGetUserMediaPermissionRequsted(void* pUserData, Evas_Object* pView, void* pEventInfo)
553 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
554 Ewk_User_Media_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_User_Media_Permission_Request* >(pEventInfo);
555 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
557 result r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_USERMEDIA, pEventInfo);
558 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
562 ewk_user_media_permission_request_set(pPermissionRequest, EINA_FALSE);
567 OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
569 result r = E_SUCCESS;
570 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
572 Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(pEventInfo);
573 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
575 ewk_notification_permission_request_suspend(pPermissionRequest);
577 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_NOTIFICATION, pPermissionRequest);
578 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
582 ewk_notification_permission_request_set(pPermissionRequest, EINA_FALSE);
587 OnNotificationShow(void* pUserData, Evas_Object* pView, void* pEventInfo)
589 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
590 Ewk_Notification* pNotification = reinterpret_cast< Ewk_Notification* >(pEventInfo);
591 SysAssertf(pImpl && pNotification, "Failed to request");
593 result r = E_SUCCESS;
594 Ewk_Context* pContext = ewk_view_context_get(pView);
595 SysAssertf(pContext, "Failed to get webkit instance.");
596 uint64_t notificationId = ewk_notification_id_get(pNotification);
598 //ewk_notification_security_origin_get(pNotification)
600 const char* text = ewk_notification_body_get(pNotification);
601 SysSecureLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
603 std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification());
604 SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
606 r = pNotificationWindow->Construct(pContext, notificationId, pImpl);
607 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error propogated.", GetErrorMessage(r));
609 pNotificationWindow->SetText(String(text));
610 pNotificationWindow->LaunchNotification();
611 pNotificationWindow.release();
613 ewk_notification_showed(pContext, notificationId);
618 OnNotificationCancel(void* pUserData, Evas_Object* pView, void* pEventInfo)
620 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
621 uint64_t* pNotificationID = reinterpret_cast< uint64_t* >(pEventInfo);
622 SysAssertf(pImpl && pNotificationID, "Failed to request");
624 //ToDo : Where is ewk API for cancel operation?
629 OnProtocolHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
631 result r = E_SUCCESS;
632 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
633 SysAssertf(pImpl, "Failed to request");
635 r = pImpl->ShowUserConfirmPopup(USER_PROTOCOL_HANDLER, pEventInfo);
636 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
641 OnIsProtocolHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
643 int checkHandler = 0;
644 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
645 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
646 SysAssertf(pImpl && pHandlerData, "Failed to request");
648 checkHandler = pImpl->SearchHandler(pHandlerData, false);
649 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
650 switch (checkHandler)
655 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
658 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
661 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
669 OnProtocolHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
671 result r = E_SUCCESS;
672 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
673 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
674 SysAssertf(pImpl && pHandlerData, "Failed to request");
676 r = pImpl->UnregistrationHandler(pHandlerData, false);
677 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
682 OnContentHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
684 result r = E_SUCCESS;
685 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
686 SysAssertf(pImpl, "Failed to request");
688 r = pImpl->ShowUserConfirmPopup(USER_CONTENT_HANDLER, pEventInfo);
689 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
694 OnIsContentHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
696 int checkHandler = 0;
697 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
698 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
699 SysAssertf(pImpl && pHandlerData, "Failed to request");
701 checkHandler = pImpl->SearchHandler(pHandlerData, true);
702 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
704 switch (checkHandler)
709 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
712 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
715 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
724 OnContentHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
726 result r = E_SUCCESS;
727 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
728 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
729 SysAssertf(pImpl && pHandlerData, "Failed to request");
731 r = pImpl->UnregistrationHandler(pHandlerData, true);
732 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
737 OnVibrationRequested(uint64_t duration, void* pUserData)
739 result r = E_SUCCESS;
741 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
742 SysAssertf(pImpl, "Failed to request");
744 r = pImpl->VibrationRequested(duration);
745 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
750 OnVibrationCanceled(void* pUserData)
752 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
753 SysAssertf(pImpl, "Failed to request");
755 pImpl->VibrationCanceled();
760 OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* pOrigin, void* pUserData)
762 ewk_view_application_cache_permission_reply(pView, EINA_TRUE);
769 OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
771 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
772 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
773 SysAssertf(pImpl && pPolicy, "Failed to request");
775 String url(ewk_policy_decision_url_get(pPolicy));
776 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
778 if (url == L"about:blank")
780 ewk_policy_decision_use(pPolicy);
784 if (pImpl->GetLoadingListener() && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
785 && !pImpl->IsRedirectRequested())
787 pImpl->SetCertificateRequested(false);
789 if (pImpl->GetTextSearchListener())
791 pImpl->DisableAsyncSearch();
794 WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
795 Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
797 switch (ewkNavigationType)
799 case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
800 navigationType = WEB_NAVIGATION_LINK_CLICKED;
802 case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
803 navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
805 case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
806 navigationType = WEB_NAVIGATION_BACKFORWARD;
808 case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
809 navigationType = WEB_NAVIGATION_RELOAD;
811 case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
812 navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
814 case EWK_POLICY_NAVIGATION_TYPE_OTHER:
815 navigationType = WEB_NAVIGATION_OTHER;
821 if (pImpl->GetLoadingListener()->OnLoadingRequested(url, navigationType))
823 ewk_policy_decision_ignore(pPolicy);
829 String currentUrl(pImpl->GetUrl());
830 String redirectUrl(pImpl->GetProtocolFromUri(url, currentUrl));
831 if (redirectUrl != L"")
833 pImpl->LoadUrl(redirectUrl);
834 ewk_policy_decision_ignore(pPolicy);
842 String uriScheme(uri.GetScheme());
843 SysLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
845 if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file"))
847 ewk_policy_decision_ignore(pPolicy);
849 if (uriScheme == L"")
854 result r = E_SUCCESS;
856 _WebEventType eventType = WEB_EVENT_REQUEST_UNKNOWN;
858 if (uriScheme == L"rtsp")
860 eventType = WEB_EVENT_REQUEST_RTSP;
862 else if (uriScheme == L"mailto")
864 eventType = WEB_EVENT_REQUEST_EMAIL;
866 else if (uriScheme == L"tel")
868 eventType = WEB_EVENT_REQUEST_TEL;
870 else if (uriScheme == L"sms" || uriScheme == L"smsto" )
872 eventType = WEB_EVENT_REQUEST_SMS;
874 else if (uriScheme == L"mms" || uriScheme == L"mmsto" )
876 eventType = WEB_EVENT_REQUEST_MMS;
879 std::unique_ptr<_WebEventArg> pEventArg(new _WebEventArg(eventType, url));
880 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
882 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
883 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
889 ewk_policy_decision_use(pPolicy);
894 OnLoadingStarted(void* pUserData, Evas_Object* pView, void* pEventInfo)
896 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
897 SysAssertf(pImpl, "Failed to request");
899 if (pImpl->GetLoadingListener())
901 result r = E_SUCCESS;
903 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_STARTED));
904 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
906 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
907 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
914 OnPageTitleReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
916 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
917 char* pTitle = reinterpret_cast< char* >(pEventInfo);
918 SysAssertf(pImpl, "Failed to request");
920 SysLog(NID_WEB_CTRL, "The current value of title is %s", pTitle);
922 if (pImpl->GetLoadingListener())
924 result r = E_SUCCESS;
926 std::unique_ptr<String> pPageTitle(new (std::nothrow) String(pTitle));
927 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED));
928 SysTryReturnVoidResult(NID_WEB_CTRL, pPageTitle.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
930 r = pEventArg->SetEventInfo(_LoadingEventArg::PAGE_TITLE, *pPageTitle.get());
931 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
932 pPageTitle.release();
934 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
935 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
942 OnEstimatedProgress(void* pUserData, Evas_Object* pView, void* pEventInfo)
944 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
945 double* pProgress = reinterpret_cast< double* >(pEventInfo);
946 SysAssertf(pImpl, "Failed to request");
948 SysLog(NID_WEB_CTRL, "The current value of progress is %lf", *pProgress);
950 if (pImpl->GetLoadingListener())
952 result r = E_SUCCESS;
954 std::unique_ptr<Integer> pProgressPercentage(new (std::nothrow) Integer(static_cast< int >(*pProgress * 100)));
955 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PROGRESS));
956 SysTryReturnVoidResult(NID_WEB_CTRL, pProgressPercentage.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
958 r = pEventArg->SetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS, *pProgressPercentage.get());
959 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
960 pProgressPercentage.release();
962 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
963 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
970 OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
972 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
973 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
974 SysAssertf(pImpl && pPolicy, "Failed to request");
976 result r = E_SUCCESS;
978 const char* pUrl = ewk_policy_decision_url_get(pPolicy);
979 int code = ewk_policy_decision_response_status_code_get(pPolicy);
980 String mime(ewk_policy_decision_response_mime_get(pPolicy));
981 SysSecureLog(NID_WEB_CTRL, "url : %s, mime : %ls, code : %d", pUrl, mime.GetPointer(), code);
983 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
985 String url(ewk_policy_decision_url_get(pPolicy));
988 if (pLoadingListener && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
990 const Eina_Hash* pHeader = ewk_policy_decision_response_headers_get(pPolicy);
992 DecisionPolicy policy;
993 HttpHeader httpHeader;
995 if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
997 pImpl->SetRedirectRequested(true);
1001 eina_hash_foreach(pHeader, AddHttpHeaderData, &httpHeader);
1002 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1004 policy = pLoadingListener->OnWebDataReceived(mime, httpHeader);
1005 pImpl->SetPolicyDecision(policy);
1008 switch (pImpl->GetPolicyDecision())
1010 case WEB_DECISION_CONTINUE:
1012 String currentUrl(pImpl->GetUrl());
1013 String redirectUrl(pImpl->GetRedirectUri(url, currentUrl, mime));
1014 if (redirectUrl != L"")
1016 pImpl->LoadUrl(redirectUrl);
1017 ewk_policy_decision_ignore(pPolicy);
1022 if (pImpl->IsMimeSupported(mime) || mime == L"")
1029 SysLog(NID_WEB_CTRL, "Launch native app to handle the mime");
1031 ewk_policy_decision_ignore(pPolicy);
1033 AppControl* pAppControl = null;
1034 _SelectBox selectBox;
1036 int selectedIndex = 0;
1038 std::unique_ptr<IList, AllElementsDeleter> pList(_AppManagerImpl::FindAppControlsN(NULL, NULL, &mime, NULL));
1042 appCount = pList->GetCount();
1045 r = selectBox.Construct(false, L"", appCount+1); //+1 for Downloader
1046 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1048 selectBox.AddListItem(L"Download", _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
1049 for (int i = 0; i < appCount; i++)
1051 pAppControl = dynamic_cast< AppControl* >(pList->GetAt(i));
1052 SysTryReturnVoidResult(NID_WEB_CTRL, pAppControl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1054 String text = pAppControl->GetAppName();
1055 SysLog(NID_WEB_CTRL, "AppName : %S", text.GetPointer());
1057 selectBox.AddListItem(text, _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
1059 r = selectBox.ShowAndWait(selectedIndex);
1060 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1062 if (selectedIndex == 0) //download
1064 RequestId reqId = 0;
1065 DownloadRequest request(pUrl);
1067 _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
1068 SysTryReturnVoidResult(NID_WEB_CTRL, pManagerImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1070 r = pManagerImpl->Start(request, reqId);
1071 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1073 else if (selectedIndex != -1) // -1 for cancel
1075 String path("path");
1076 String pathVal(pUrl);
1079 r = dataList.Construct();
1080 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1082 r = dataList.Add(path, pathVal);
1083 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1085 pAppControl = dynamic_cast< AppControl* >(pList->GetAt(selectedIndex));
1086 SysTryReturnVoidResult(NID_WEB_CTRL, pAppControl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1088 _AppControlImpl* pAcImpl = _AppControlImpl::GetInstance(*pAppControl);
1089 SysTryReturnVoidResult(NID_WEB_CTRL, pAcImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1091 r = pAcImpl->Start(null, null, &dataList, null);
1092 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1099 case WEB_DECISION_DOWNLOAD:
1101 ewk_policy_decision_ignore(pPolicy);
1103 _WebDataHandler* pDownloadHandler = pImpl->GetDownloadHandler();
1104 SysTryReturnVoidResult(NID_WEB_CTRL, pDownloadHandler, E_SYSTEM, "[%s] A system error has been occurred. Failed to get DownloadHandler.", GetErrorMessage(E_SYSTEM));
1106 Ewk_Context* pContext = ewk_view_context_get(pView);
1107 SysAssertf(pContext, "Failed to get webkit instance.");
1109 pDownloadHandler->StartDownload(pUrl);
1113 case WEB_DECISION_IGNORE:
1115 ewk_policy_decision_ignore(pPolicy);
1125 ewk_policy_decision_use(pPolicy);
1130 ewk_policy_decision_ignore(pPolicy);
1135 OnProgressCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1137 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1138 SysAssertf(pImpl, "Failed to request");
1140 if (pImpl->IsRedirectRequested())
1142 pImpl->SetRedirectRequested(false);
1145 if (pImpl->IsLoadingErrorOccurred())
1147 pImpl->SetLoadingErrorOccurred(false);
1148 evas_object_smart_callback_call(pView, "load,finished", NULL);
1154 OnLoadingErrorOccurred(void* pUserData, Evas_Object* pView, void* pEventInfo)
1156 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1157 Ewk_Error* pErrorData = reinterpret_cast< Ewk_Error* >(pEventInfo);
1158 SysAssertf(pImpl && pErrorData, "Failed to request");
1160 int code = ewk_error_code_get(pErrorData);
1161 const char* pDescription = ewk_error_description_get(pErrorData);
1163 SysLog(NID_WEB_CTRL, "The current value of code is %d, description is %s", code, pDescription);
1165 pImpl->SetLoadingErrorOccurred(true);
1168 case EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE:
1170 case EWK_ERROR_CODE_PLUGINWILLHANDLELOAD:
1173 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
1174 evas_object_smart_callback_call(pView, "load,stop", NULL);
1178 if (pImpl->GetLoadingListener())
1180 result r = E_SUCCESS;
1182 r = FireLoadingErrorOccurredEvent(pImpl, code, pDescription);
1183 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1191 OnLoadingCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
1193 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1194 SysAssertf(pImpl, "Failed to request");
1196 if (pImpl->GetLoadingListener())
1198 result r = E_SUCCESS;
1200 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_CANCELED));
1201 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1203 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1204 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1205 pEventArg.release();
1212 OnLoadingCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1214 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1215 SysAssertf(pImpl, "Failed to request");
1217 if (pImpl->GetLoadingListener())
1219 result r = E_SUCCESS;
1221 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_COMPLETED));
1222 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1224 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1225 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1226 pEventArg.release();
1233 OnLoadingCommitted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1235 evas_object_focus_set(pView, EINA_FALSE);
1240 OnFaviconReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1242 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1243 SysAssertf(pImpl, "Failed to request");
1245 if (pImpl->GetLoadingListener())
1247 result r = E_SUCCESS;
1249 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED));
1250 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1252 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1253 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1254 pEventArg.release();
1261 OnDidStartDownloadCallback(const char* pUrl, void* pUserData)
1263 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1264 SysAssertf(pUrl && pImpl != null, "Failed to request");
1266 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s", pUrl);
1271 FireWebPageShowRequestedEvent(_WebImpl* pImpl, int event)
1273 result r = E_SUCCESS;
1275 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1276 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1278 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1279 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1280 pEventArg.release();
1287 OnWebPageShowRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1289 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1290 SysAssertf(pImpl, "Failed to request");
1292 if (pImpl->GetUiEventListener())
1294 result r = E_SUCCESS;
1296 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED);
1297 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1299 if (pImpl->GetUiEventListenerF())
1301 result r = E_SUCCESS;
1303 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT);
1304 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1310 OnWebWindowCreateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1312 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(pUserData);
1313 Evas_Object** pChildView = reinterpret_cast< Evas_Object** >(pEventInfo);
1314 SysAssertf(pParentImpl && pChildView, "Failed to request");
1316 IWebUiEventListener* pUserUiListener = pParentImpl->GetUiEventListener();
1317 IWebUiEventListenerF* pUserUiListenerF = pParentImpl->GetUiEventListenerF();
1318 if (pUserUiListener)
1320 Web* pWeb = pUserUiListener->OnWebWindowCreateRequested();
1323 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1324 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1326 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1327 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1330 if (pUserUiListenerF)
1332 Web* pWeb = pUserUiListenerF->OnWebWindowCreateRequested();
1335 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1336 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1338 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1339 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1346 FireWebWindowClosedRequestedEvent(_WebImpl* pImpl, int event)
1348 result r = E_SUCCESS;
1350 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1351 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1353 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1354 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1355 pEventArg.release();
1362 OnWebWindowClosedRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1364 _WebImpl* pChildImpl = reinterpret_cast< _WebImpl* >(pUserData);
1365 SysAssertf(pChildImpl, "Failed to request");
1367 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, PARENT_WEB_CTRL));
1368 if (pParentImpl == null)
1373 if (pParentImpl->GetUiEventListener())
1375 result r = E_SUCCESS;
1377 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED);
1378 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1380 if (pParentImpl->GetUiEventListenerF())
1382 result r = E_SUCCESS;
1384 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT);
1385 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1391 FireWebPreventDefaultTriggeredEvent(_WebImpl* pImpl, int event, bool trigger)
1393 result r = E_SUCCESS;
1395 std::unique_ptr<Boolean> pPreventTrigger(new (std::nothrow) Boolean(trigger));
1396 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1397 SysTryReturnResult(NID_WEB_CTRL, pPreventTrigger.get() && pEventArg.get(), E_OUT_OF_MEMORY, " Memory allocation failed." );
1399 r = pEventArg->SetEventInfo(_WebUiEventArg::PREVENT_DEFAULT, *pPreventTrigger.get());
1400 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1401 pPreventTrigger.release();
1403 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1404 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1405 pEventArg.release();
1412 OnWebPreventDefaultTriggered(void* pUserData, Evas_Object* pView, void* pEventInfo)
1414 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1415 Eina_Bool* pTrigger = reinterpret_cast< Eina_Bool* >(pEventInfo);
1416 SysAssertf(pImpl && pTrigger, "Failed to request");
1418 if (pImpl->GetUiEventListener())
1420 result r = E_SUCCESS;
1422 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED, static_cast< bool >(*pTrigger));
1423 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1425 if (pImpl->GetUiEventListenerF())
1427 result r = E_SUCCESS;
1429 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT, static_cast< bool >(*pTrigger));
1430 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1436 FireWebPageBlockSelectedEvent(_WebImpl* pImpl)
1438 result r = E_SUCCESS;
1440 std::unique_ptr<Point> startPoint(new (std::nothrow) Point());
1441 std::unique_ptr<Point> endPoint(new (std::nothrow) Point());
1442 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1444 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1446 if ((endPoint->x != 0) && (endPoint->y != 0))
1448 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED));
1449 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1451 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1452 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1453 startPoint.release();
1455 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1456 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1459 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1460 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1461 pEventArg.release();
1469 FireWebPageBlockSelectedEventF(_WebImpl* pImpl)
1471 result r = E_SUCCESS;
1473 std::unique_ptr<FloatPoint> startPoint(new (std::nothrow) FloatPoint());
1474 std::unique_ptr<FloatPoint> endPoint(new (std::nothrow) FloatPoint());
1476 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1478 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1480 if ((endPoint->x != 0.0f) && (endPoint->y != 0.0f))
1482 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT));
1483 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1485 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1486 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1487 startPoint.release();
1489 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1490 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1493 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1494 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1495 pEventArg.release();
1503 OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
1505 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1506 SysAssertf(pImpl, "Failed to request");
1508 if (pImpl->GetUiEventListener())
1510 result r = E_SUCCESS;
1512 r = FireWebPageBlockSelectedEvent(pImpl);
1513 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1515 if (pImpl->GetUiEventListenerF())
1517 result r = E_SUCCESS;
1519 r = FireWebPageBlockSelectedEventF(pImpl);
1520 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1526 OnWebPageBlockSelectedByOrientation(void* pUserData, Evas_Object* pView, void* pEventInfo)
1528 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1529 SysAssertf(pImpl, "Failed to request");
1531 if (!pImpl->IsOrientationChanged())
1536 pImpl->SetOrientationChanged(false);
1538 int orientation = 0;
1539 _ControlRotation rotation = _ControlManager::GetInstance()->GetOrientationStatus();
1542 case _CONTROL_ROTATION_0:
1545 case _CONTROL_ROTATION_90:
1548 case _CONTROL_ROTATION_180:
1551 case _CONTROL_ROTATION_270:
1555 ewk_view_orientation_send(pView, orientation);
1557 OnWebPageBlockSelected(pUserData, pView, pEventInfo);
1562 OnSelectUploadFile(Evas_Object* pView, Eina_Bool multipleFile, Eina_List* pAcceptTypes, const char* pCapture, void* pUserData)
1564 String isMultipleSelection(L"single");
1565 result r = E_SUCCESS;
1568 String mode(L"selectionType");
1569 String type(L"type");
1570 _AppControlImpl* pMediaAppControlImpl = null;
1573 String fileType = L"all";
1577 isMultipleSelection.Append(L"multiple");
1580 std::unique_ptr<AppControl> pMediaAppControl(_AppManagerImpl::FindAppControlN(L"tizen.filemanager", L"http://tizen.org/appcontrol/operation/pick"));
1581 SysTryReturn(NID_WEB_CTRL, pMediaAppControl.get(), EINA_TRUE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1583 std::unique_ptr<_MediaSelectionListener> pMediaListener(new (std::nothrow) _MediaSelectionListener());
1584 SysTryReturn(NID_WEB_CTRL, pMediaListener.get(), EINA_TRUE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1586 pMediaListener->Construct(pView, pMediaAppControl.get());
1588 itemCount = eina_list_count(pAcceptTypes);
1592 String item((char*)eina_list_nth(pAcceptTypes, 0));
1593 if (item.StartsWith("image/",0))
1595 fileType = L"image";
1597 else if (item.StartsWith("audio/",0))
1599 fileType = L"audio";
1601 else if (item.StartsWith("video/",0))
1603 fileType = L"video";
1607 r = dataList.Construct();
1608 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1610 r = dataList.Add(mode, isMultipleSelection);
1611 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1613 r = dataList.Add(type, fileType);
1614 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1616 pMediaAppControlImpl = _AppControlImpl::GetInstance(*pMediaAppControl.get());
1617 r = pMediaAppControlImpl->Start(null, null, &dataList, pMediaListener.get());
1618 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1620 pMediaListener.release();
1621 pMediaAppControl.release();
1626 ewk_view_open_panel_reply(pView, null, EINA_FALSE);
1632 OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
1634 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1635 char* pJsonText = reinterpret_cast< char* >(pEventInfo);
1636 SysAssertf(pImpl && pJsonText, "Failed to request");
1638 result r = E_SUCCESS;
1640 SysLog(NID_WEB_CTRL, "The current value of jsontext is %s", pJsonText);
1642 std::unique_ptr<_JsBridgeArg> pEventArg(new (std::nothrow) _JsBridgeArg());
1643 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1645 r = pEventArg->Construct(pJsonText);
1646 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1648 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1649 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1650 pEventArg.release();
1655 OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
1657 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1658 Eina_Rectangle* pEinaRect = reinterpret_cast< Eina_Rectangle* >(pEventInfo);
1659 SysAssertf(pImpl && pEinaRect, "Failed to request");
1661 if (pImpl->GetSetting().GetInputStyle() == INPUT_STYLE_OVERLAY)
1663 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1664 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1666 Rectangle rect(pEinaRect->x, pEinaRect->y, pEinaRect->w, pEinaRect->h);
1668 if (rect.height == 0)
1673 _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
1676 if (pFormCore->HasFooter() && pFormCore->IsFooterVisible())
1678 pImpl->SetFooterVisibleState(true);
1679 pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
1682 pFormCore->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
1685 if (pImpl->GetWebKeypadEventListener())
1687 if (pImpl->IsKeypadVisible() == true)
1689 if ((pImpl->GetPreviousKeypadBounds().width == rect.width) && (pImpl->GetPreviousKeypadBounds().height != rect.height))
1691 pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1696 pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1699 pImpl->SetKeypadVisibleState(true);
1700 pImpl->SetPreviousKeypadBounds(rect);
1704 result r = pImpl->SetFullScreenKeypad();
1705 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1711 OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
1713 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1714 SysAssertf(pImpl, "Failed to request");
1716 if (pImpl->GetWebKeypadEventListener())
1718 pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
1724 OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
1726 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1727 SysAssertf(pImpl, "Failed to request");
1729 _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
1732 if (pFormCore->HasFooter() && pImpl->IsFooterVisible())
1734 pImpl->SetFooterVisibleState(false);
1735 pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
1738 pFormCore->DeflateClientRectHeight(0);
1741 if (pImpl->GetWebKeypadEventListener())
1743 pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1746 pImpl->SetKeypadVisibleState(false);
1751 OnWindowObjectFocusGained(void *pUserData, Evas_Object *pWin, void *pEvent_info)
1753 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1754 SysAssertf(pImpl, "Failed to request");
1756 if (pImpl->IsKeypadOpened() == true)
1758 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1759 SysAssertf(pWebCore, "Failed to get Web core object");
1761 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1763 pImpl->SetKeypadOpened(false);
1769 OnWebNativeNodeFocusGained(void *pUserData, Evas *pCanvas, Evas_Object* pView, void* pEventInfo)
1771 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1772 SysAssertf(pImpl, "Failed to request");
1774 if (pImpl->IsKeypadOpened() == true)
1776 pImpl->SetKeypadOpened(false);
1782 OnColorPickerProviderRequested(Ewk_View_Smart_Data *pSmartData, int red, int green, int blue, int alpha)
1784 SysAssertf(pSmartData, "invalid smartdata");
1785 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1786 SysAssertf(pWebImpl, "Failed to get Impl");
1788 result r = E_SUCCESS;
1790 if (pWebImpl->GetColorpicker())
1797 r = pWebImpl->ShowColorPicker(red, green, blue, alpha, color);
1798 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1800 byte r1, g1, b1, a1;
1801 color.GetColorComponents(r1, g1, b1, a1);
1802 ewk_view_color_picker_color_set(pSmartData->self, r1, g1, b1, a1);
1809 OnColorPickerProviderDismissed(Ewk_View_Smart_Data *pSmartData)
1811 SysAssertf(pSmartData, "invalid smartdata");
1813 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1814 SysAssertf(pWebImpl, "Failed to get Impl");
1816 return pWebImpl->HideColorPicker();
1821 OnDatePickerProviderRequested(Ewk_View_Smart_Data *pSmartData, Ewk_Input_Type inputType, const char* inputValue)
1823 SysAssertf(pSmartData, "Failed to request");
1824 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1825 SysAssertf(pWebImpl, "Failed to get Impl");
1827 result r = E_SUCCESS;
1829 if (pWebImpl->GetDatepicker())
1831 ewk_view_focused_input_element_value_set(pSmartData->self, inputValue);
1838 r = pWebImpl->ShowDatePicker(inputType, inputValue, dateStr);
1839 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1841 std::unique_ptr<char[]> pDateStr(_StringConverter::CopyToCharArrayN(dateStr));
1842 SysTryReturn(NID_WEB_CTRL, pDateStr.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1844 ewk_view_focused_input_element_value_set(pSmartData->self, pDateStr.get());
1851 OnSelectBoxRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, double pageScaleFactor, Eina_List* pItems, int selectedIndex)
1853 SysAssertf(pSmartData, "Failed to request");
1855 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1856 SysAssertf(pWebImpl, "Failed to get Impl");
1858 result r = pWebImpl->ShowSelectBoxPopup(false, L"", pItems, pSmartData->self, selectedIndex);
1859 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1866 OnSelectBoxClosed(Ewk_View_Smart_Data *pSmartData)
1868 SysAssertf(pSmartData, "invalid smartdata");
1870 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1871 SysAssertf(pWebImpl, "Failed to get Impl");
1873 result r = pWebImpl->ClearSelectBoxPopup();
1874 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1881 OnSelectBoxUpdateRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, Eina_List* pItems, int selectedIndex)
1883 SysAssertf(pSmartData, "invalid smartdata");
1885 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1886 SysAssertf(pWebImpl, "Failed to get Impl");
1888 result r = pWebImpl->UpdateSelectBoxPopup(pItems, selectedIndex, false);
1889 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1896 OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
1898 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
1899 SysAssertf(pPresenter && !pError, "Failed to request");
1901 bool ret = EINA_TRUE;
1905 case EWK_COOKIE_ACCEPT_POLICY_ALWAYS:
1907 case EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY:
1911 case EWK_COOKIE_ACCEPT_POLICY_NEVER:
1920 SysLog(NID_WEB_CTRL, "The current value of policy is %d", ret);
1922 pPresenter->EndAsyncProcess(ret);
1927 OnScriptExecuted(Evas_Object* pView, const char* pResult, void* pUserData)
1929 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
1930 SysAssertf(pPresenter, "Failed to request");
1932 String result(pResult);
1933 SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
1935 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
1936 if (pImpl && pImpl->IsPresenterAlived(pPresenter))
1938 pPresenter->EndAsyncProcess(result);
1944 OnTextFound(void* pUserData, Evas_Object* pView, void* pEventInfo)
1946 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1947 SysAssertf(pImpl, "Failed to request");
1949 int* pTotalCount = reinterpret_cast< int* >(pEventInfo);
1950 SysLog(NID_WEB_CTRL, "The current value of totalCount is %d", *pTotalCount);
1952 _WebPresenter* pWebPresenter = pImpl->GetSearchPresenter();
1956 pWebPresenter->EndAsyncProcess(*pTotalCount);
1960 if (pImpl->GetTextSearchListener())
1962 result r = E_SUCCESS;
1966 if (*pTotalCount > 0)
1968 ordinal = pImpl->GetAsyncSearchOrdinal();
1969 pImpl->SetAsyncSearchResult(*pTotalCount);
1972 if (pImpl->GetPendingAsyncSearchCount() > 0)
1977 std::unique_ptr<Integer> pCount(new (std::nothrow) Integer(*pTotalCount));
1978 std::unique_ptr<Integer> pOrdinal(new (std::nothrow) Integer(ordinal));
1979 std::unique_ptr<_TextSearchEventArg> pEventArg(new (std::nothrow) _TextSearchEventArg(WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND));
1980 SysTryReturnVoidResult(NID_WEB_CTRL, pCount.get() && pOrdinal.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1982 r = pEventArg->SetEventInfo(_TextSearchEventArg::TOTAL_COUNT, *pCount.get());
1983 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1986 r = pEventArg->SetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL, *pOrdinal.get());
1987 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1990 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1991 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1992 pEventArg.release();
1998 class _JsBridgeHashCodeProvider
1999 : public Tizen::Base::Collection::IHashCodeProviderT< Tizen::Base::String >
2002 _JsBridgeHashCodeProvider(){}
2003 virtual ~_JsBridgeHashCodeProvider(void) {}
2006 int GetHashCode(const Tizen::Base::String& obj) const
2008 return obj.GetHashCode();
2014 //Comparer implementation
2015 class _JsBridgeComparer
2016 : public Tizen::Base::Collection::IComparerT< Tizen::Base::String >
2019 _JsBridgeComparer(){}
2020 virtual ~_JsBridgeComparer(void) {}
2023 result Compare(const Tizen::Base::String& obj1, const Tizen::Base::String& obj2, int& cmp) const
2040 _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
2041 : _ContainerImpl(pWeb, pCore)
2042 , __isFooterVisible(false)
2043 , __isKeypadVisible(false)
2044 , __isKeypadOpened(false)
2045 , __isLoadingErrorOccurred(false)
2046 , __isRedirectRequested(false)
2047 , __isCertificateRequested(false)
2048 , __isCertificateConfirmed(false)
2049 , __isOrientationChanged(false)
2050 , __keypadBounds(0, 0, 0, 0)
2052 , __pUserLoadingListener(null)
2053 , __pUserUiListener(null)
2054 , __pUserUiListenerF(null)
2055 , __pUserKeypadEventListener(null)
2056 , __pTextSearchListener(null)
2058 , __pJsBridgeList(null)
2059 , __pJsProvider(null)
2060 , __pJsComparer(null)
2061 , __pWebDownloadHandler(null)
2063 , __pAuthChallenge(null)
2064 , __pAuthPopup(null)
2065 , __pUserConfirmPopup(null)
2066 , __pCertConfirmPopup(null)
2067 , __pSelectBox(null)
2068 , __pDatePicker(null)
2069 , __pColorPicker(null)
2071 , __policy(WEB_DECISION_CONTINUE)
2072 , __defaultUserAgent(L"")
2074 __textSearch.__searchAll = false;
2075 __textSearch.__searchForward = true;
2076 __textSearch.__caseSensitive = false;
2077 __textSearch.__pending = 0;
2078 __textSearch.__currentIndex = 1;
2079 __textSearch.__totalCount = -1;
2080 __textSearch.__text = L"";
2084 _WebImpl::~_WebImpl()
2086 RemoveEventListenerCallback();
2090 _WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
2092 result r = E_SUCCESS;
2094 r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2095 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2097 _Web* pCore = _Web::CreateWebN();
2098 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2100 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2102 r = CheckConstruction(pCore, pImpl);
2103 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2105 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2106 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2108 r = pImpl->Construct();
2109 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2121 _WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
2123 result r = E_SUCCESS;
2125 r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2126 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2128 _Web* pCore = _Web::CreateWebN();
2129 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2131 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2133 r = CheckConstruction(pCore, pImpl);
2134 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2136 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2137 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2139 r = pImpl->Construct();
2140 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2152 _WebImpl::Construct(void)
2154 result r = E_SUCCESS;
2156 r = __mutex.Create();
2157 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2159 r = __textSearch.__searchQueue.Construct();
2160 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2162 r = __callbackList.Construct();
2163 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2165 r = InitJsBridgeList();
2166 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2169 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2171 __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
2172 SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
2179 _WebImpl::InitializeSetting(void)
2181 result r = E_SUCCESS;
2183 WebSetting* pWebSetting = __pWebCore->GetSetting();
2184 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(pWebSetting);
2186 SetCookieEnabled(pWebSettingImpl->IsCookieEnabled());
2187 SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
2188 SetZoomLevel(pWebSettingImpl->GetZoomLevel());
2190 __defaultUserAgent = pWebSettingImpl->GetUserAgent();
2192 r = SetSetting(*pWebSetting);
2193 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2195 SetEventListenerCallback();
2202 _WebImpl::IsLayoutable(void) const
2209 _WebImpl::InitWebEvent(void)
2211 __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
2212 SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2214 return __pWebEvent->Construct(*this);
2219 _WebImpl::GetWebEvent(void) const
2221 return __pWebEvent.get();
2226 _WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
2228 Eina_Hash* pHttpHeader = null;
2230 std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
2231 if (pFieldNameList.get())
2233 pHttpHeader = eina_hash_string_small_new(FreeCharArray);
2234 SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2236 int count = pFieldNameList->GetCount();
2238 for (int i = 0; i < count; i++)
2240 String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
2241 SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2243 std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
2244 SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2246 std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
2247 SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2249 while (pFieldValueEnum->MoveNext() == E_SUCCESS)
2251 Eina_Bool ret = false;
2253 String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
2254 SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2256 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
2257 SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2259 ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
2260 SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2267 eina_hash_free(pHttpHeader);
2274 _WebImpl::LoadUrl(const String& url) const
2276 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2277 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2279 ewk_view_url_set(__pWebCore->GetWebNativeNode(), pUrl.get());
2286 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
2288 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2289 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2291 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2293 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
2295 eina_hash_free(pHttpHeader);
2302 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
2304 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2305 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2307 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2309 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
2311 eina_hash_free(pHttpHeader);
2318 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
2320 SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
2322 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
2323 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2324 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
2325 SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2327 ewk_view_contents_set(__pWebCore->GetWebNativeNode(), reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
2334 _WebImpl::Pause(void)
2336 ewk_view_suspend(__pWebCore->GetWebNativeNode());
2341 _WebImpl::Resume(void)
2343 ewk_view_resume(__pWebCore->GetWebNativeNode());
2348 _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
2350 __pSelectBox.reset();
2352 SysTryReturnResult(NID_WEB_CTRL, eina_list_count(pItems) > 0, E_SYSTEM, "ItemCount is invalid.");
2354 result r = E_SUCCESS;
2356 std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
2357 SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2359 r = pSelectBox->Construct(isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
2360 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2362 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2363 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2365 __pSelectBox = std::move(pSelectBox);
2367 __pSelectBox->SetOwner(&GetPublic());
2369 return __pSelectBox->ShowPopup();
2374 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2376 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2378 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2383 _WebImpl::ClearSelectBoxPopup(void)
2385 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2387 __pSelectBox.reset();
2394 _WebImpl::GetDatepicker(void)
2396 _InputPickerPopup* pInputPicker =null;
2399 pInputPicker = __pDatePicker.get();
2401 return pInputPicker;
2406 _WebImpl::GetColorpicker(void)
2408 _InputPickerPopup* pInputPicker =null;
2411 pInputPicker = __pColorPicker.get();
2413 return pInputPicker;
2418 _WebImpl::CanGoBack(void) const
2420 return static_cast< bool >(ewk_view_back_possible(__pWebCore->GetWebNativeNode()));
2425 _WebImpl::CanGoForward(void) const
2427 return static_cast< bool >(ewk_view_forward_possible(__pWebCore->GetWebNativeNode()));
2432 _WebImpl::GoBack(void) const
2434 ewk_view_back(__pWebCore->GetWebNativeNode());
2439 _WebImpl::GoForward(void) const
2441 ewk_view_forward(__pWebCore->GetWebNativeNode());
2446 _WebImpl::GetUrl(void) const
2448 return ewk_view_url_get(__pWebCore->GetWebNativeNode());
2453 _WebImpl::GetTitle(void) const
2455 return ewk_view_title_get(__pWebCore->GetWebNativeNode());
2460 _WebImpl::StopLoading(void) const
2462 ewk_view_stop(__pWebCore->GetWebNativeNode());
2467 _WebImpl::Reload(void) const
2469 ewk_view_reload_bypass_cache(__pWebCore->GetWebNativeNode());
2474 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
2476 if (scriptCode.GetLength() == 0)
2481 result r = E_SUCCESS;
2483 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2484 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2486 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter());
2487 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2489 r = __callbackList.Add(pPresenter.get());
2490 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2492 ewk_view_script_execute(__pWebCore->GetWebNativeNode(), pScript.get(), OnScriptExecuted, pPresenter.get());
2494 std::unique_ptr<String> pResult(new (std::nothrow) String(L""));
2495 SysTryReturn(NID_WEB_CTRL, pResult.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2496 pPresenter->WaitAsyncProcess(*pResult.get());
2498 r = __callbackList.Remove(*pPresenter.get());
2499 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2500 pPresenter.release();
2502 return pResult.release();
2507 _WebImpl::IsPresenterAlived(_WebPresenter* pPresenter) const
2509 return __callbackList.Contains(*pPresenter);
2514 _WebImpl::SetZoomLevel(float level)
2516 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);
2518 ewk_view_scale_set(__pWebCore->GetWebNativeNode(), static_cast< double >(level), 0, 0);
2525 _WebImpl::GetZoomLevel(void) const
2527 return static_cast< float >(ewk_view_scale_get(__pWebCore->GetWebNativeNode()));
2531 const PageNavigationList*
2532 _WebImpl::GetBackForwardListN(void) const
2534 result r = E_SUCCESS;
2536 _PageNavigationListImpl* pNavigationListImpl = null;
2537 _HistoryItemImpl* pHistoryItemImpl = null;
2539 std::unique_ptr<PageNavigationList> pNavigationList;
2540 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2543 int forwardCount = 0;
2548 Ewk_History* pEwkHistoryList = ewk_view_history_get(__pWebCore->GetWebNativeNode());
2549 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2551 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2552 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2554 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2555 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2557 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2558 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2560 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2561 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2563 r = pHistoryList->Construct();
2564 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2566 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2567 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2568 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2570 for (int i = -backCount; i < forwardCount + 1; i++)
2572 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2573 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2575 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2576 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2578 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2579 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2581 url = ewk_history_item_uri_get(pEwkItem);
2582 title = ewk_history_item_title_get(pEwkItem);
2583 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2585 pHistoryItemImpl->SetHistoryItem(url, title);
2587 r = pHistoryList->Add(*pHistoryItem.get());
2588 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2589 pHistoryItem.release();
2592 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2594 ewk_history_free(pEwkHistoryList);
2596 return pNavigationList.release();
2599 ewk_history_free(pEwkHistoryList);
2606 _WebImpl::SearchText(const String& text, bool searchForward)
2608 result r = E_SUCCESS;
2610 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2614 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2617 _WebPresenter presenter;
2618 presenter.InitAsyncProcess();
2620 r = SynchronizeSearch(SEARCH_SYNC, __pWebCore->GetWebNativeNode(), condition, text, searchForward, false, &presenter);
2621 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2624 presenter.WaitAsyncProcess(result);
2626 return static_cast < bool >(result);
2631 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2633 result r = E_SUCCESS;
2635 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2639 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2642 r = SynchronizeSearch(SEARCH_ALL_ASYNC, __pWebCore->GetWebNativeNode(), condition, text, true, caseSensitive);
2643 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2650 _WebImpl::SearchNextAsync(bool searchForward)
2652 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2653 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2654 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2656 result r = E_SUCCESS;
2658 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2660 if (__textSearch.__caseSensitive)
2662 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2667 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2670 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, __pWebCore->GetWebNativeNode(), condition, __textSearch.__text, searchForward);
2671 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2678 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
2680 MutexGuard lock(__mutex);
2682 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
2683 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2688 if (__textSearch.__searchAll)
2690 DisableAsyncSearch();
2692 __textSearch.__searchQueue.Enqueue(this);
2693 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2695 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2696 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2700 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2702 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2706 case SEARCH_ALL_ASYNC:
2707 __textSearch.__searchAll = true;
2708 __textSearch.__text = text;
2709 __textSearch.__searchForward = true;
2710 __textSearch.__caseSensitive = caseSensitive;
2711 __textSearch.__totalCount = -1;
2712 __textSearch.__currentIndex = 1;
2714 __textSearch.__searchQueue.Enqueue(this);
2715 __textSearch.__searchQueue.Enqueue(this);
2717 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2718 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2721 case SEARCH_NEXT_ASYNC:
2722 __textSearch.__searchForward = searchForward;
2724 CalculateAsyncSearchOrdinal();
2726 __textSearch.__searchQueue.Enqueue(this);
2728 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2740 _WebImpl::SetAsyncSearchResult(int totalCount)
2742 __textSearch.__totalCount = totalCount;
2747 _WebImpl::GetSearchPresenter(void)
2749 MutexGuard lock(__mutex);
2751 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
2756 _WebImpl::GetPendingAsyncSearchCount(void) const
2758 return __textSearch.__searchQueue.GetCount();
2763 _WebImpl::CalculateAsyncSearchOrdinal(void)
2765 if (__textSearch.__searchForward)
2767 __textSearch.__currentIndex++;
2771 __textSearch.__currentIndex--;
2777 _WebImpl::GetAsyncSearchOrdinal(void) const
2779 return __textSearch.__currentIndex;
2784 _WebImpl::DisableAsyncSearch(void)
2786 __textSearch.__searchAll = false;
2791 _WebImpl::SetSetting(const WebSetting& setting)
2793 if (__pWebCore->GetWebNativeNode())
2795 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2796 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
2797 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
2799 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
2800 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2802 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
2804 switch (setting.GetCacheControl())
2806 case WEB_CACHE_VALIDATED:
2807 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
2810 case WEB_CACHE_IGNORE:
2811 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
2818 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
2820 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
2824 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
2827 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
2829 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
2831 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
2833 if (__defaultUserAgent != setting.GetUserAgent())
2835 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
2836 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2838 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
2841 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
2843 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
2845 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
2847 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
2850 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
2852 pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
2853 pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
2854 pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
2855 pWebSettingImpl->SetFontSize(setting.GetFontSize());
2856 pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
2857 pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
2858 pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
2859 pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
2860 pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
2861 pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
2862 pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
2863 pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
2864 pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
2871 _WebImpl::GetSetting(void) const
2873 return *__pWebCore->GetSetting();
2877 const HitElementResult*
2878 _WebImpl::GetElementByPointN(const Point& point) const
2880 return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
2884 const HitElementResult*
2885 _WebImpl::GetElementByPointN(const FloatPoint& point) const
2887 SysTryReturn(NID_WEB_CTRL, Contains(point), null, E_INVALID_ARG, "[%s] The point must be contained in the bounds of a web control.", GetErrorMessage(E_INVALID_ARG));
2889 result r = E_SUCCESS;
2891 _HitElementResultImpl* pHitElementResultImpl = null;
2893 std::unique_ptr<HitElementResult> pHitElementResult;
2894 std::unique_ptr<Bitmap> pImage;
2895 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
2897 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
2899 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
2900 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
2902 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
2903 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
2904 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
2905 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
2906 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
2908 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
2910 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
2911 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2913 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
2914 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2916 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
2922 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
2923 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
2924 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
2925 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
2927 r = buf.Construct(imageLength);
2928 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2930 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
2931 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2935 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
2936 // webkit support types such as ico and vp8 additionally
2937 if (strcmp(pExtension, "gif") == 0)
2939 format = IMG_FORMAT_GIF;
2941 else if (strcmp(pExtension, "jpg") == 0)
2943 format = IMG_FORMAT_JPG;
2945 else if (strcmp(pExtension, "png") == 0)
2947 format = IMG_FORMAT_PNG;
2949 else if (strcmp(pExtension, "bmp") == 0)
2951 format = IMG_FORMAT_BMP;
2955 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
2959 r = image.Construct();
2960 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2962 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
2963 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2968 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
2969 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2971 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
2972 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2974 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
2975 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2978 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
2980 ewk_hit_test_free(pEwkHitTest);
2982 return pHitElementResult.release();
2985 ewk_hit_test_free(pEwkHitTest);
2992 _WebImpl::IsLoading(void) const
2994 double percent = ewk_view_load_progress_get(__pWebCore->GetWebNativeNode());
2996 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
3008 _WebImpl::GetTextFromBlock(void) const
3010 return ewk_view_text_selection_text_get(__pWebCore->GetWebNativeNode());
3015 _WebImpl::IsPrivateBrowsingEnabled(void) const
3017 if (__pWebCore->GetWebNativeNode() == null)
3019 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
3022 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3023 SysAssertf(pSettings, "Failed to get webkit instance.");
3025 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
3030 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
3032 if (__pWebCore->GetWebNativeNode() == null)
3034 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
3038 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3039 SysAssertf(pSettings, "Failed to get webkit instance.");
3041 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
3046 _WebImpl::ClearHistory(void)
3048 ewk_view_back_forward_list_clear(__pWebCore->GetWebNativeNode());
3053 _WebImpl::ClearCache(void)
3055 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3056 SysAssertf(pContext, "Failed to get webkit instance.");
3058 ewk_context_cache_clear(pContext);
3063 _WebImpl::ClearCookie(void)
3065 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3066 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3067 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3069 ewk_cookie_manager_cookies_clear(pCookieManager);
3074 _WebImpl::ClearFormData(void)
3076 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3077 SysAssertf(pContext, "Failed to get webkit instance.");
3079 ewk_context_form_candidate_data_clear(pContext);
3084 _WebImpl::ClearLoginFormData(void)
3086 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3087 SysAssertf(pContext, "Failed to get webkit instance.");
3089 ewk_context_form_password_data_clear(pContext);
3094 _WebImpl::IsCookieEnabled(void) const
3096 if (__pWebCore->GetWebNativeNode() == null)
3098 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
3101 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3102 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3103 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3105 _WebPresenter presenter;
3106 presenter.InitAsyncProcess();
3108 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, &presenter);
3110 bool result = false;
3111 presenter.WaitAsyncProcess(result);
3118 _WebImpl::SetCookieEnabled(bool enable)
3120 if (__pWebCore->GetWebNativeNode() == null)
3122 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
3127 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3128 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3129 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3133 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
3137 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
3138 ewk_cookie_manager_cookies_clear(pCookieManager);
3144 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
3146 result r = E_SUCCESS;
3148 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
3149 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3152 String fileExtension = File::GetFileExtension(filePath);
3153 int pathLength = filePath.GetLength();
3156 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
3158 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
3159 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3160 r = filePath.SubString(0, index + 1, dirPath);
3161 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3163 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
3164 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
3168 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
3170 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), pSize->width, pSize->height, pFilePath.get());
3174 Evas_Coord contentsWidth;
3175 Evas_Coord contentsHeight;
3177 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &contentsWidth, &contentsHeight);
3178 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), contentsWidth, contentsHeight, pFilePath.get());
3186 _WebImpl::IsMimeSupported(const String& mime) const
3188 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
3189 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3191 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(__pWebCore->GetWebNativeNode()), pMime.get()));
3196 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
3198 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
3203 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
3205 __pUserUiListener = pUiEventListener;
3210 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
3212 __pUserUiListenerF = pUiEventListener;
3217 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
3219 __pUserKeypadEventListener = pKeypadEventListener;
3224 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
3226 if (__pWebDownloadHandler.get() == null)
3228 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
3229 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3232 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
3233 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
3238 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
3240 __pTextSearchListener = pTextSearchListener;
3245 _WebImpl::SetScrollEnabled(bool enable)
3247 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
3252 _WebImpl::IsScrollEnabled(void) const
3254 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
3259 _WebImpl::InitJsBridgeList(void)
3261 result r = E_SUCCESS;
3263 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
3264 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3266 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
3267 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3269 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
3270 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3272 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
3273 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3275 __pJsBridgeList = std::move(pJsBridgeList);
3282 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3284 result r = E_SUCCESS;
3286 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3287 String key(pJsBridge->GetName());
3289 r = __pJsBridgeList->Add(key, pJsBridge);
3290 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3297 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3299 result r = E_SUCCESS;
3301 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3302 String key(pJsBridge->GetName());
3304 r = __pJsBridgeList->Remove(key);
3305 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3312 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3314 result r = E_SUCCESS;
3316 IJsonValue* pJsonValue = null;
3317 IJavaScriptBridge* pJsBridge = null;
3319 String key(L"name");
3321 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3322 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));
3324 r = pJsonObject->GetValue(&key, pJsonValue);
3325 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3327 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3328 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3330 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3331 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3338 _WebImpl::GetLoadingListener(void) const
3340 return __pUserLoadingListener;
3344 IWebUiEventListener*
3345 _WebImpl::GetUiEventListener(void) const
3347 return __pUserUiListener;
3351 IWebUiEventListenerF*
3352 _WebImpl::GetUiEventListenerF(void) const
3354 return __pUserUiListenerF;
3358 IWebKeypadEventListener*
3359 _WebImpl::GetWebKeypadEventListener(void) const
3361 return __pUserKeypadEventListener;
3365 ITextSearchListener*
3366 _WebImpl::GetTextSearchListener(void) const
3368 return __pTextSearchListener;
3373 _WebImpl::SetEventListenerCallback(void) const
3375 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3378 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3379 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3381 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3382 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3384 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3385 SysAssertf(pSmartData, "Failed to request");
3387 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3388 SysAssertf(pSmart, "Failed to request");
3390 pSmart->popup_menu_show = OnSelectBoxRequested;
3391 pSmart->popup_menu_hide = OnSelectBoxClosed;
3392 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3394 pSmart->input_picker_show = OnDatePickerProviderRequested;
3395 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3396 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3398 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3400 // add loading event callbacks for ILoadingListener
3401 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3402 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3404 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3405 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3406 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3407 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3408 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3409 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3410 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3411 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3412 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3414 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3416 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3418 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3419 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3420 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3422 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3423 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3425 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3427 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3428 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3429 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3431 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3433 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3434 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3435 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3437 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3438 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3439 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3441 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3442 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3443 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3445 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3446 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3447 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3448 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3450 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3451 evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
3453 evas_object_smart_callback_add(pWebNativeNode, "text,style,state", OnWebPageBlockSelected, this);
3454 evas_object_smart_callback_add(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation, this);
3456 ewk_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(this));
3457 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3458 SysAssertf(pContext, "Failed to get webkit instance.");
3459 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3460 ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
3461 ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
3463 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3469 _WebImpl::RemoveEventListenerCallback(void) const
3471 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3474 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3475 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3477 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3478 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3480 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3481 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3483 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3484 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3485 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3486 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3487 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3488 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3489 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3490 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3492 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3494 evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3496 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3497 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3498 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3500 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3501 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3503 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3505 ewk_view_javascript_alert_callback_set(null, null, null);
3506 ewk_view_javascript_prompt_callback_set(null, null, null);
3507 ewk_view_javascript_confirm_callback_set(null, null, null);
3509 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3511 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3512 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3513 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3515 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3516 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3517 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3518 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3519 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3520 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3522 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3523 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3524 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3526 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3528 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3529 evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
3531 evas_object_smart_callback_del(pWebNativeNode, "text,style,state", OnWebPageBlockSelected);
3532 evas_object_smart_callback_del(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation);
3534 ewk_view_open_panel_callback_set(null, null, null);
3535 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3536 SysAssertf(pContext, "Failed to get webkit instance.");
3537 ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
3538 ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
3540 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3546 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3548 return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
3553 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
3555 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3557 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3558 SysAssertf(pSmartData, "Failed to request");
3560 Point absPoint( _CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
3562 Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3565 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3567 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3568 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
3570 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3572 if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false))
3574 ewk_view_command_execute(pWebNativeNode, "SelectWord", 0);
3578 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3579 char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
3582 ewk_view_command_execute(pWebNativeNode, "SelectWord", 0);
3587 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
3594 _WebImpl::ReleaseBlock(void)
3596 ewk_view_text_selection_range_clear(__pWebCore->GetWebNativeNode());
3601 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
3603 FloatPoint tempStartPoint;
3604 FloatPoint tempEndPoint;
3606 GetBlockRange(tempStartPoint, tempEndPoint);
3608 startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
3609 endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
3614 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
3616 Eina_Rectangle leftHandle;
3617 Eina_Rectangle rightHandle;
3619 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
3621 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
3622 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
3623 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
3624 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
3626 if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
3628 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
3629 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
3635 _WebImpl::GetFaviconN(void) const
3637 result r = E_SUCCESS;
3639 Evas_Object* pView = __pWebCore->GetWebNativeNode();
3641 Evas* pEvas = evas_object_evas_get(pView);
3642 Ewk_Context* pContext = ewk_view_context_get(pView);
3643 SysAssertf(pEvas && pContext, "Failed to request");
3645 const char* pUrl = ewk_view_url_get(pView);
3647 Tizen::Graphics::BufferInfo bufferInfo;
3648 Tizen::Base::ByteBuffer byteBuffer;
3650 std::unique_ptr<Bitmap> pBitmapImage(new (std::nothrow) Bitmap());
3651 SysTryReturn(NID_WEB_CTRL, pBitmapImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3653 Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
3659 r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
3660 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3662 const Dimension dimension(bufferInfo.width, bufferInfo.height);
3664 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
3665 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3667 r = pBitmapImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
3668 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3670 return pBitmapImage.release();
3676 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
3678 ewk_view_scroll_by(__pWebCore->GetWebNativeNode(), diff.x, diff.y);
3683 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
3685 ewk_view_scroll_set(__pWebCore->GetWebNativeNode(), dest.x, dest.y);
3690 _WebImpl::GetScrollPosition(void) const
3694 ewk_view_scroll_pos_get(__pWebCore->GetWebNativeNode(), &position.x, &position.y);
3701 _WebImpl::GetPageSize(void) const
3703 Evas_Coord width = 0;
3704 Evas_Coord height = 0;
3706 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &width, &height);
3708 Dimension size(static_cast< int >(width), static_cast< int >(height));
3715 _WebImpl::SetLoadingErrorOccurred(bool arg)
3717 __isLoadingErrorOccurred = arg;
3722 _WebImpl::IsLoadingErrorOccurred(void) const
3724 return __isLoadingErrorOccurred;
3729 _WebImpl::SetRedirectRequested(bool arg)
3731 __isRedirectRequested = arg;
3736 _WebImpl::IsRedirectRequested(void) const
3738 return __isRedirectRequested;
3743 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
3750 _WebImpl::GetPolicyDecision(void) const
3757 _WebImpl::SetCertificateRequested(bool arg)
3759 __isCertificateRequested = arg;
3764 _WebImpl::IsCertificateRequested(void) const
3766 return __isCertificateRequested;
3771 _WebImpl::IsCertificateConfirmed(void) const
3773 return __isCertificateConfirmed;
3778 _WebImpl::SetOrientationChanged(bool arg)
3780 __isOrientationChanged = arg;
3785 _WebImpl::IsOrientationChanged(void) const
3787 return __isOrientationChanged;
3792 _WebImpl::LaunchAppControl(const IEventArg& arg)
3794 result r = E_SUCCESS;
3796 IEventArg* pArg = const_cast< IEventArg* >(&arg);
3797 _WebEventArg* pWebEventArg = dynamic_cast< _WebEventArg* >(pArg);
3798 SysTryReturnResult(NID_WEB_CTRL, pWebEventArg, E_INVALID_ARG, "Type casting failed. argument must be IEventArg type.");
3800 String operationId(L"");
3801 String uriPattern(pWebEventArg->GetEventMessage());
3802 SysLog(NID_WEB_CTRL, "The current value of web event type is %d", pWebEventArg->GetEventType());
3804 switch (pWebEventArg->GetEventType())
3806 case WEB_EVENT_REQUEST_RTSP:
3810 int uriLength = uriPattern.GetLength();
3813 operationId = L"http://tizen.org/appcontrol/operation/view";
3815 r = uriPattern.LastIndexOf(L".", uriLength - 1, index);
3816 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3818 r = uriPattern.SubString(index + 1, ext);
3819 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3821 r = _AppControlManager::GetMimeFromExt(ext, mimeType);
3822 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3824 r = _AppControlImpl::FindAndStart(operationId, &uriPattern, &mimeType, null, null, null);
3825 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3829 case WEB_EVENT_REQUEST_TEL:
3831 operationId = L"http://tizen.org/appcontrol/operation/dial";
3834 case WEB_EVENT_REQUEST_EMAIL:
3836 case WEB_EVENT_REQUEST_SMS:
3838 case WEB_EVENT_REQUEST_MMS:
3840 operationId = L"http://tizen.org/appcontrol/operation/compose";
3843 case WEB_EVENT_REQUEST_UNKNOWN:
3845 operationId = L"http://tizen.org/appcontrol/operation/view";
3853 r = _AppControlImpl::FindAndStart(operationId, &uriPattern, null, null, null, null);
3854 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3861 _WebImpl::SetFullScreenKeypad(void)
3863 result r = E_SUCCESS;
3865 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
3866 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
3868 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
3869 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3871 String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
3872 pKeypad->SetText(text);
3874 r = pKeypad->SetShowState(true);
3875 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3877 r = pKeypad->Show();
3878 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3880 pKeypad->AddTextEventListener(*this);
3882 __pKeypad = std::move(pKeypad);
3889 _WebImpl::RemoveFullScreenKeypad(void)
3891 __pKeypad->RemoveTextEventListener(*this);
3898 _WebImpl::IsFooterVisible(void) const
3900 return __isFooterVisible;
3905 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
3907 __isFooterVisible = isFooterVisible;
3912 _WebImpl::IsKeypadVisible(void) const
3914 return __isKeypadVisible;
3919 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
3921 __isKeypadVisible = isKeypadVisible;
3926 _WebImpl::IsKeypadOpened(void) const
3928 return __isKeypadOpened;
3932 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
3934 __isKeypadOpened = isKeypadOpened;
3939 _WebImpl::GetPreviousKeypadBounds(void) const
3941 return __keypadBounds;
3946 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
3948 __keypadBounds = bounds;
3953 _WebImpl::OnTextValueChangeCanceled(const Control& source)
3955 RemoveFullScreenKeypad();
3960 _WebImpl::OnTextValueChanged(const Control& source)
3962 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
3964 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
3966 RemoveFullScreenKeypad();
3971 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
3973 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
3974 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
3976 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
3977 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3979 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
3980 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
3982 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
3989 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
3991 result r = E_SUCCESS;
3993 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
3994 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
3996 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
3998 ILoadingListener* pLoadingListner = GetLoadingListener();
3999 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
4001 switch (pEventArg->GetEventType())
4003 case WEB_EVENT_LOADINGLISTENER_STARTED:
4005 pLoadingListner->OnLoadingStarted();
4009 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
4011 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
4012 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4014 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
4018 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
4020 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
4021 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4023 pLoadingListner->OnPageTitleReceived(*pPageTitle);
4027 case WEB_EVENT_LOADINGLISTENER_CANCELED:
4029 pLoadingListner->OnLoadingCanceled();
4033 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
4035 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
4036 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4038 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
4039 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4041 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
4043 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
4047 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
4049 pLoadingListner->OnLoadingCompleted();
4053 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
4055 pLoadingListner->OnHttpAuthenticationCanceled();
4059 case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
4061 std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
4062 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4066 pLoadingListner->OnFaviconReceived(*pFavicon.get());
4082 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
4084 result r = E_SUCCESS;
4086 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
4087 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4089 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4091 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
4092 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
4094 switch (pEventArg->GetEventType())
4096 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
4098 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
4099 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4101 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
4105 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
4107 pWebDownloadListener->OnWebDataDownloadCompleted();
4111 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
4113 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
4114 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4116 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
4118 pWebDownloadListener->OnWebDownloadFailed(errorType);
4133 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
4135 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4136 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4138 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4140 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4142 switch (pEventArg->GetEventType())
4144 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
4146 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4148 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4149 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4151 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4152 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4154 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4158 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
4160 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4162 __pUserUiListener->OnWebPageShowRequested(*pWeb);
4166 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
4168 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4170 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
4174 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
4176 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4178 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4179 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4181 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4196 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
4198 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4199 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4201 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4203 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4205 switch (pEventArg->GetEventType())
4207 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
4209 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4211 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4212 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4214 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4215 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4217 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4221 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
4223 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4225 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
4229 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
4231 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4233 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
4237 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
4239 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4241 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4242 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4244 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4259 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
4261 result r = E_SUCCESS;
4263 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
4264 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4266 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4268 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
4269 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
4271 switch (pEventArg->GetEventType())
4273 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4275 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4276 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4278 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4279 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4281 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4296 _WebImpl::VibrationRequested(uint64_t duration)
4298 result r = E_SUCCESS;
4300 __pVibrator.reset();
4302 std::unique_ptr<_VibratorImpl> pVibrator(new (std::nothrow) _VibratorImpl);
4303 SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4305 r = pVibrator->Construct();
4306 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4308 __pVibrator = std::move(pVibrator);
4310 IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
4312 r = __pVibrator->Start(&pattern, 1, 1);
4313 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4320 _WebImpl::VibrationCanceled(void)
4322 __pVibrator.reset();
4327 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4329 result r = E_SUCCESS;
4331 String host(ewk_auth_challenge_url_get(pChallenge));
4332 String realm(ewk_auth_challenge_realm_get(pChallenge));
4334 __pAuthChallenge.reset();
4336 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4337 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4339 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4340 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4342 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4343 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4345 __pAuthChallenge = std::move(pAuthChallenge);
4347 ewk_auth_challenge_suspend(pChallenge);
4348 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4350 __pAuthChallenge.release();
4354 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4355 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4363 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4365 result r = E_SUCCESS;
4367 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4368 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4370 r = pAuthPopup->Construct(host, realm, pAuthChallenge);
4371 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4373 __pAuthPopup = std::move(pAuthPopup);
4375 int modalResult = 0;
4377 __pAuthPopup->SetOwner(&GetPublic());
4379 r = __pAuthPopup->ShowAndWait(modalResult);
4380 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4383 __pAuthPopup.reset();
4390 _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
4392 result r = E_SUCCESS;
4394 std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
4395 SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4397 r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
4398 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4400 __pCertConfirmPopup = std::move(pCertConfirmPopup);
4402 int modalResult = 0;
4404 __pCertConfirmPopup->SetOwner(&GetPublic());
4406 r = __pCertConfirmPopup->ShowAndWait(modalResult);
4407 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4409 if (userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
4411 __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
4415 __pCertConfirmPopup.reset();
4421 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy)
4423 result r = E_SUCCESS;
4425 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4426 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4428 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, true);
4429 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4431 __pUserConfirmPopup = std::move(pUserConfirmPopup);
4433 int modalResult = 0;
4435 __pUserConfirmPopup->SetOwner(&GetPublic());
4437 r = __pUserConfirmPopup->ShowAndWait(modalResult);
4438 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4441 __pUserConfirmPopup.reset();
4447 _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4449 result r = E_SUCCESS;
4451 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4452 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4454 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, false, msg);
4455 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4457 __pUserConfirmPopup = std::move(pUserConfirmPopup);
4459 __pUserConfirmPopup->SetOwner(&GetPublic());
4461 r = __pUserConfirmPopup->ShowPopup();
4462 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4464 __pUserConfirmPopup.release();
4469 __pUserConfirmPopup.reset();
4476 _WebImpl::GetParentFormCore(_Control* pControlCore)
4479 _Form* pFormCore = null;
4481 _Control* pParentControlCore = dynamic_cast< _Control* >(pControlCore->GetParent());
4482 if (!pParentControlCore)
4487 pFormCore = dynamic_cast< _Form* >(pParentControlCore);
4493 return GetParentFormCore(pParentControlCore);
4498 _WebImpl::OnFocusGained(const _ControlImpl& source)
4505 _WebImpl::OnFocusLost(const _ControlImpl& source)
4507 if(IsKeypadVisible() == true)
4509 SetKeypadOpened(true);
4511 SetKeypadVisibleState(false);
4514 evas_object_focus_set(__pWebCore->GetWebNativeNode(), EINA_FALSE);
4521 _WebImpl::HasValidNativeNode(void) const
4523 if (__pWebCore && __pWebCore->GetWebNativeNode())
4533 _WebImpl::OnPreAttachedToMainTree(void)
4535 result r = E_SUCCESS;
4537 r = __pWebCore->InitializeWebNativeNode();
4538 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4540 r = InitializeSetting();
4541 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4543 r = _ContainerImpl::OnPreAttachedToMainTree();
4544 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4551 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
4553 _ContainerImpl::OnChangeLayout(orientation);
4555 if (__pColorPicker.get())
4557 __pColorPicker->ChangeLayout(orientation);
4560 __isOrientationChanged = true;
4565 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
4567 if (IsVisible() == true)
4569 ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
4573 ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
4579 _WebImpl::GetDownloadHandler(void) const
4581 return __pWebDownloadHandler.get();
4586 _WebImpl::HideColorPicker(void)
4588 __pColorPicker.reset();
4595 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
4597 result r = E_SUCCESS;
4599 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
4600 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4602 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
4604 r = pColorHadler->Construct(colorVal, this);
4605 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4607 __pColorPicker = std::move(pColorHadler);
4609 r = __pColorPicker->ShowPopup();
4610 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4612 color = __pColorPicker->GetColor();
4617 __pColorPicker.reset();
4624 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
4626 result r = E_SUCCESS;
4628 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
4629 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4631 r = pInputPicker->Construct(String(inputValue), inputType, this);
4632 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4634 __pDatePicker = std::move(pInputPicker);
4636 r = __pDatePicker->ShowPopup();
4637 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4639 dateStr = __pDatePicker->GetDate();
4642 __pDatePicker.reset();
4649 _WebImpl::GetInstance(Web* pWeb)
4651 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
4656 _WebImpl::GetInstance(const Web* pWeb)
4658 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
4663 _WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
4665 int checkReturn = 0;
4667 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
4670 if( checkmime == true)
4672 table = CUSTOM_CONTENT_TABLE_NAME;
4676 table = CUSTOM_PROTOCOL_TABLE_NAME;
4679 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
4680 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
4681 String target(ewk_custom_handlers_data_target_get(pHandlerData));
4683 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
4685 result r = db.Construct(handlerPath, "r+", null);
4686 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
4688 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"'"));
4689 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4693 r = pEnum->MoveNext();
4694 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
4695 r = pEnum->GetIntAt(0, checkReturn);
4696 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
4708 _WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
4712 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
4715 if( checkmime == true)
4717 table = CUSTOM_CONTENT_TABLE_NAME;
4721 table = CUSTOM_PROTOCOL_TABLE_NAME;
4724 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
4725 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
4726 String target(ewk_custom_handlers_data_target_get(pHandlerData));
4728 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
4730 result r = db.Construct(handlerPath, "r+", null);
4731 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4733 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"'"));
4734 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4738 r = pEnum->MoveNext();
4739 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4740 r = pEnum->GetIntAt(0, checkId);
4741 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4743 std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
4744 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4746 r = pDeleteStmt->BindInt(0, checkId);
4747 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4749 db.BeginTransaction();
4751 std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
4753 db.CommitTransaction();
4760 const Tizen::Base::String
4761 _WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
4763 if (originUri == L"" || currentUri == L"")
4768 result r = E_SUCCESS;
4771 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
4772 String originReplace(originUri);
4773 String table(CUSTOM_PROTOCOL_TABLE_NAME);
4777 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
4778 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4780 r = currentUri.SubString(0, found + 1, baseUri);
4781 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4783 r = db.Construct(handlerPath, "r+", null);
4784 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4786 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
4787 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
4791 while (pEnum->MoveNext() == E_SUCCESS)
4796 String originScheme;
4798 r = pEnum->GetStringAt(0, protocol);
4799 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4801 r = pEnum->GetStringAt(1, queryUrl);
4802 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4804 r = pEnum->GetIntAt(2, allow);
4805 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4812 String protocolScheme(protocol + L":");
4814 r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
4815 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4817 if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
4819 if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
4821 r = originReplace.Replace(originScheme, "");
4822 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4824 queryUrl.Replace("%s", originReplace, 0);
4825 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4837 const Tizen::Base::String
4838 _WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
4840 if (originUri == L"" || currentUri == L"" || mime == L"")
4845 result r = E_SUCCESS;
4848 String originUrlStr = originUri;
4849 const String replaceStr = L"%s";
4851 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
4852 String table(CUSTOM_CONTENT_TABLE_NAME);
4856 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
4857 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4859 r = currentUri.SubString(0, found + 1, baseUri);
4860 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4862 r = db.Construct(handlerPath, "r+", null);
4863 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4865 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
4869 r = pEnum->MoveNext();
4870 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4871 r = pEnum->GetIntAt(0, allow);
4872 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4873 r = pEnum->GetStringAt(1, contentUrl);
4874 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4882 if (contentUrl != L"")
4884 r = contentUrl.Replace(replaceStr, originUrlStr, 0);
4885 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
4896 }}} // Tizen::Web::Controls