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 <FGrpColor.h>
41 #include <FGrpPoint.h>
42 #include <FGrpRectangle.h>
43 #include <FIoDbEnumerator.h>
44 #include <FIoDbStatement.h>
46 #include <FMediaImage.h>
47 #include <FMediaImageTypes.h>
48 #include <FNetHttpHttpHeader.h>
49 #include <FSysVibrator.h>
50 #include <FUiControl.h>
51 #include <FUiCtrlKeypad.h>
52 #include <FWebCtrlHitElementResult.h>
53 #include <FWebCtrlITextSearchListener.h>
54 #include <FWebCtrlIWebDownloadListener.h>
55 #include <FWebCtrlIWebUiEventListener.h>
56 #include <FWebCtrlIWebUiEventListenerF.h>
57 #include <FWebCtrlIWebKeypadEventListener.h>
58 #include <FWebCtrlIJavaScriptBridge.h>
59 #include <FWebCtrlPageNavigationList.h>
60 #include <FWebCtrlAuthenticationChallenge.h>
61 #include <FWebCtrlWeb.h>
62 #include <FWebCtrlWebSetting.h>
63 #include <FWebHistoryItem.h>
64 #include <FWebJsonJsonObject.h>
65 #include <FWebJsonJsonParser.h>
66 #include <FWebJsonJsonString.h>
67 #include <FApp_AppControlImpl.h>
68 #include <FApp_AppControlManager.h>
69 #include <FApp_AppInfo.h>
70 #include <FApp_AppManagerImpl.h>
71 #include <FBase_StringConverter.h>
72 #include <FGrp_CoordinateSystem.h>
73 #include <FGrp_Screen.h>
74 #include <FIo_DatabaseImpl.h>
75 #include <FIo_NormalFile.h>
76 #include <FSys_SettingInfoImpl.h>
77 #include <FSys_SystemResource.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_ResourceManager.h>
84 #include <FUi_ResourceSizeInfo.h>
85 #include <FUi_Window.h>
86 #include <FUiAnim_EflNode.h>
87 #include <FUiAnim_VisualElement.h>
88 #include <FUiCtrl_FooterImpl.h>
89 #include <FUiCtrl_FormImpl.h>
90 #include "FWeb_HistoryItemImpl.h"
91 #include "FWebCtrl_AppControlListener.h"
92 #include "FWebCtrl_AuthConfirmPopup.h"
93 #include "FWebCtrl_AuthenticationChallengeImpl.h"
94 #include "FWebCtrl_EflWebkit.h"
95 #include "FWebCtrl_FormDataWindow.h"
96 #include "FWebCtrl_GeolocationPermissionManagerImpl.h"
97 #include "FWebCtrl_HitElementResultImpl.h"
98 #include "FWebCtrl_InputPickerPopup.h"
99 #include "FWebCtrl_WebNotification.h"
100 #include "FWebCtrl_PageNavigationListImpl.h"
101 #include "FWebCtrl_PromptPopup.h"
102 #include "FWebCtrl_SelectBox.h"
103 #include "FWebCtrl_Utility.h"
104 #include "FWebCtrl_Web.h"
105 #include "FWebCtrl_WebDataHandler.h"
106 #include "FWebCtrl_WebEvent.h"
107 #include "FWebCtrl_WebEventArg.h"
108 #include "FWebCtrl_WebImpl.h"
109 #include "FWebCtrl_WebManager.h"
110 #include "FWebCtrl_WebPresenter.h"
111 #include "FWebCtrl_WebSettingImpl.h"
114 using namespace Tizen::App;
115 using namespace Tizen::Base;
116 using namespace Tizen::Base::Collection;
117 using namespace Tizen::Base::Runtime;
118 using namespace Tizen::Base::Utility;
119 using namespace Tizen::Content;
120 using namespace Tizen::Graphics;
121 using namespace Tizen::Io;
122 using namespace Tizen::Media;
123 using namespace Tizen::Net::Http;
124 using namespace Tizen::System;
125 using namespace Tizen::Ui;
126 using namespace Tizen::Ui::Animations;
127 using namespace Tizen::Ui::Controls;
128 using namespace Tizen::Web::Json;
131 namespace Tizen { namespace Web { namespace Controls
135 static const char WEB_CTRL[] = "webcontrol";
136 static const char PARENT_WEB_CTRL[] = "parentwebcontrol";
139 static const float MIN_ZOOM_LEVEL = 0.3;
140 static const float MAX_ZOOM_LEVEL = 2;
143 static const int REDIRECTION_HEADER_GROUP = 300;
146 static const int MAX_TEXT_MATCH = pow(2, 31) - 1;
149 static const int PORTRAIT_KEYPAD_HEIGHT = 444;
150 static const int LANDSCAPE_KEYPAD_HEIGHT = 316;
151 static const int DEFAULT_LIST_ITEM_COUNT = 5;
155 AddHttpAttributeData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
157 result r = E_SUCCESS;
159 std::unique_ptr<String> pAttrKey(new (std::nothrow) String(reinterpret_cast< char* >(const_cast< void* >(pKey))));
160 std::unique_ptr<String> pAttrValue(new (std::nothrow) String(reinterpret_cast< char* >(pValue)));
161 SysTryReturn(NID_WEB_CTRL, pAttrKey.get() && pAttrValue.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
163 SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
165 r = reinterpret_cast< HashMap* >(pUserData)->Add(*pAttrKey, *pAttrValue);
166 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
168 pAttrValue.release();
175 FreeCharArray(void* pData)
177 delete[] reinterpret_cast<char*>(pData);
182 ConvertErrorCode(int error)
184 LoadingErrorType errorCode = WEB_ERROR_UNKNOWN;
188 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
190 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE:
192 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE_PROXY:
194 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT:
196 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT_PROXY:
198 case EWK_ERROR_NETWORK_STATUS_IO_ERROR:
200 case EWK_ERROR_NETWORK_STATUS_MALFORMED:
202 case EWK_ERROR_NETWORK_STATUS_TRY_AGAIN:
204 case EWK_ERROR_NETWORK_STATUS_TOO_MANY_REDIRECTS:
206 case EWK_ERROR_NETWORK_STATUS_TLS_FAILED:
208 case EWK_ERROR_NETWORK_STATUS_INTERNAL_SERVER_ERROR:
210 case EWK_ERROR_NETWORK_STATUS_BAD_GATEWAY:
212 case EWK_ERROR_NETWORK_STATUS_SERVICE_UNAVAILABLE:
214 case EWK_ERROR_NETWORK_STATUS_GATEWAY_TIMEOUT:
215 errorCode = WEB_NO_CONNECTION;
218 case EWK_ERROR_NETWORK_STATUS_BAD_REQUEST:
220 case EWK_ERROR_NETWORK_STATUS_REQUEST_URI_TOO_LONG:
221 errorCode = WEB_BAD_URL;
224 case EWK_ERROR_NETWORK_STATUS_FORBIDDEN:
225 errorCode = WEB_FILE_ACCESS_FAILED;
228 case EWK_ERROR_NETWORK_STATUS_REQUEST_TIMEOUT:
229 errorCode = WEB_REQUEST_TIMEOUT;
232 case EWK_ERROR_NETWORK_STATUS_UNSUPPORTED_MEDIA_TYPE:
233 errorCode = WEB_MIME_NOT_SUPPORTED;
236 case EWK_ERROR_NETWORK_STATUS_INSUFFICIENT_STORAGE:
237 errorCode = WEB_OUT_OF_MEMORY;
240 case EWK_ERROR_NETWORK_STATUS_REQUEST_ENTITY_TOO_LARGE:
241 errorCode = WEB_REQUEST_MAX_EXCEEDED;
244 case EWK_ERROR_NETWORK_STATUS_CONTINUE:
246 case EWK_ERROR_NETWORK_STATUS_SWITCHING_PROTOCOLS:
248 case EWK_ERROR_NETWORK_STATUS_PROCESSING:
250 case EWK_ERROR_NETWORK_STATUS_OK:
252 case EWK_ERROR_NETWORK_STATUS_CREATED:
254 case EWK_ERROR_NETWORK_STATUS_ACCEPTED:
256 case EWK_ERROR_NETWORK_STATUS_NON_AUTHORITATIVE:
258 case EWK_ERROR_NETWORK_STATUS_NO_CONTENT:
260 case EWK_ERROR_NETWORK_STATUS_RESET_CONTENT:
262 case EWK_ERROR_NETWORK_STATUS_PARTIAL_CONTENT:
264 case EWK_ERROR_NETWORK_STATUS_MULTI_STATUS:
266 case EWK_ERROR_NETWORK_STATUS_MULTIPLE_CHOICES:
268 case EWK_ERROR_NETWORK_STATUS_MOVED_PERMANENTLY:
270 case EWK_ERROR_NETWORK_STATUS_FOUND:
272 case EWK_ERROR_NETWORK_STATUS_SEE_OTHER:
274 case EWK_ERROR_NETWORK_STATUS_NOT_MODIFIED:
276 case EWK_ERROR_NETWORK_STATUS_USE_PROXY:
278 case EWK_ERROR_NETWORK_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL:
280 case EWK_ERROR_NETWORK_STATUS_TEMPORARY_REDIRECT:
281 errorCode = WEB_HTTP_RESPONSE;
284 case EWK_ERROR_NETWORK_STATUS_SSL_FAILED:
285 errorCode = WEB_INVALID_CERTIFICATE;
289 errorCode = WEB_ERROR_UNKNOWN;
298 FireLoadingErrorOccurredEvent(_WebImpl* pImpl, int code, const char* pDescription)
300 result r = E_SUCCESS;
302 std::unique_ptr<Integer> pErrorCode(new (std::nothrow) Integer(code));
303 std::unique_ptr<String> pErrorDescription(new (std::nothrow) String(pDescription));
304 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED));
305 SysTryReturnResult(NID_WEB_CTRL, pErrorCode.get() && pErrorDescription.get() && pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
307 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_TYPE, *pErrorCode.get());
308 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
309 pErrorCode.release();
311 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_MESSAGE, *pErrorDescription.get());
312 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
313 pErrorDescription.release();
315 r = pImpl->GetWebEvent()->FireAsync(*pEventArg);
316 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
324 OnScriptAlertRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
326 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
328 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
329 String msg(pMessage);
331 result r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_ALERT, pView, msg);
332 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
336 ewk_view_javascript_alert_reply(pView);
342 OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
344 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
346 result r = E_SUCCESS;
347 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
348 String msg(pMessage);
350 r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_CONFIRM, pView, msg);
351 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
355 ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
361 OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pDefaultValue, void* pUserData)
363 SysLog(NID_WEB_CTRL, "The current value of message is %s, defaulValue is %s", pMessage, pDefaultValue);
365 result r = E_SUCCESS;
366 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
368 String msg(pMessage);
369 String defVal(pDefaultValue);
371 r = pImpl->ShowPromptPopup(msg, defVal);
372 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
377 ewk_view_javascript_prompt_reply(pView, null);
384 _WebImpl::OnBeforeUnloadConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
386 _WebImpl* pWebImpl = reinterpret_cast< _WebImpl* >(pUserData);
387 SysAssertf(pWebImpl, "Failed to request");
388 result r = E_SUCCESS;
390 String msg(pMessage);
392 r = pWebImpl->ShowUserConfirmPopupAsync(USER_BEFORE_UNLOAD_CONFIRM, pView, msg);
393 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
397 ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
403 OnCertificateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
405 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
406 Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(pEventInfo);
407 SysAssertf(pImpl && pPolicy, "Failed to request");
409 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
411 switch (pImpl->GetSetting().GetCertificateErrorHandlingMode())
413 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM:
415 if (pImpl->IsCertificateRequested())
417 ewk_certificate_policy_decision_allowed_set(pPolicy, static_cast< Eina_Bool >(pImpl->IsCertificateConfirmed()));
421 result r = E_SUCCESS;
423 std::unique_ptr<DbEnumerator> pEnum;
425 String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
426 String table(CERTIFICATE_TABLE_NAME);
429 String pem(ewk_certificate_policy_decision_certificate_pem_get(pPolicy));
431 r = db.Construct(certificatePath, "r", null);
432 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
434 pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select allow From " + table + L" Where pem = '" + pem + L"'"));
437 r = pEnum->MoveNext();
438 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
441 r = pEnum->GetIntAt(0, allow);
442 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
444 SysLog(NID_WEB_CTRL, "The current value of allow is %d", allow);
446 ewk_certificate_policy_decision_allowed_set(pPolicy, static_cast < Eina_Bool >(allow));
447 pImpl->SetCertificateConfirmed(static_cast < bool >(allow));
451 r = pImpl->ShowCertificateConfirmPopup(CERTIFICATE_POPUP_MODE_USER_CONFIRM, pPolicy);
452 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
454 ewk_view_resume(pWebCore->GetWebNativeNode());
459 pImpl->SetCertificateRequested(true);
463 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL:
464 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
466 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE :
467 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_TRUE);
476 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
477 pImpl->SetCertificateConfirmed(false);
478 pImpl->SetCertificateRequested(true);
480 ewk_view_resume(pWebCore->GetWebNativeNode());
485 OnHttpAuthenticationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
487 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
488 Ewk_Auth_Challenge* pChallenge = reinterpret_cast< Ewk_Auth_Challenge* >(pEventInfo);
489 SysAssertf(pImpl && pChallenge, "Failed to request");
491 result r = E_SUCCESS;
493 r = pImpl->HttpAuthenticationRequested(pChallenge);
494 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
498 ewk_auth_challenge_credential_cancel(pChallenge);
499 evas_object_smart_callback_call(pView, "authentication,canceled", NULL);
504 OnHttpAuthenticationCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
506 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
507 SysAssertf(pImpl , "Failed to request");
509 if (pImpl->GetLoadingListener())
511 result r = E_SUCCESS;
513 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED));
514 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
516 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
517 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
523 OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, void* pUserData)
525 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
526 SysAssertf(pImpl , "Failed to request");
528 _SystemResource* pSysResource = _SystemResource::GetInstance();
529 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
531 const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
533 result r = msg.Format(256, pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(), _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")), pHostName);
534 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
536 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_APP_CACHE, pView, msg);
537 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
544 OnIndexedDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
546 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
547 SysAssertf(pImpl , "Failed to request");
549 _SystemResource* pSysResource = _SystemResource::GetInstance();
550 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
552 const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
554 result r = msg.Format(512, pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(), _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")), pHostName);
555 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
557 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, pView, msg);
558 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
565 OnDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, const char* database_name, unsigned long long expectedQuota, void* pUserData)
567 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
568 SysAssertf(pImpl , "Failed to request");
570 _SystemResource* pSysResource = _SystemResource::GetInstance();
571 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
573 const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
575 result r = msg.Format(512, pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(), _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")), pHostName);
576 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
578 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_DB_QUOTA_EXCEDED, pView, msg);
579 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
585 Eina_Bool OnLocalFileSystemQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
587 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
588 SysAssertf(pImpl , "Failed to request");
590 _SystemResource* pSysResource = _SystemResource::GetInstance();
591 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
593 const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
595 result r = msg.Format(512, pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(), _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")), pHostName);
596 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
598 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, pView, msg);
599 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
606 OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
608 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
609 Ewk_Geolocation_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(pEventInfo);
610 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
612 if (pImpl->GetSetting().IsGeolocationEnabled())
614 result r = E_SUCCESS;
616 std::unique_ptr<DbEnumerator> pEnum;
618 String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
619 String table(GEOLOCATION_TABLE_NAME);
622 const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPermissionRequest);
623 String origin = _Utility::CreateOrigin(pSecurityOrigin);
625 r = db.Construct(geolocationPath, "r", null);
626 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
628 pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select permission From " + table + L" Where origin = '" + origin + L"'"));
631 r = pEnum->MoveNext();
632 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
635 r = pEnum->GetIntAt(0, permission);
636 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
638 SysLog(NID_WEB_CTRL, "The current value of permission is %d", permission);
640 ewk_geolocation_permission_request_set(pPermissionRequest, static_cast < Eina_Bool >(permission));
644 ewk_geolocation_permission_request_suspend(pPermissionRequest);
646 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_GEOLOCATION, pPermissionRequest);
647 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
654 ewk_geolocation_permission_request_set(pPermissionRequest, EINA_FALSE);
659 OnGetUserMediaPermissionRequsted(void* pUserData, Evas_Object* pView, void* pEventInfo)
661 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
662 Ewk_User_Media_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_User_Media_Permission_Request* >(pEventInfo);
663 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
665 result r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_USERMEDIA, pEventInfo);
666 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
670 ewk_user_media_permission_request_set(pPermissionRequest, EINA_FALSE);
675 OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
677 result r = E_SUCCESS;
678 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
680 Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(pEventInfo);
681 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
683 ewk_notification_permission_request_suspend(pPermissionRequest);
685 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_NOTIFICATION, pPermissionRequest);
686 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
690 ewk_notification_permission_request_set(pPermissionRequest, EINA_FALSE);
695 OnNotificationShow(void* pUserData, Evas_Object* pView, void* pEventInfo)
697 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
698 Ewk_Notification* pNotification = reinterpret_cast< Ewk_Notification* >(pEventInfo);
699 SysAssertf(pImpl && pNotification, "Failed to request");
701 result r = E_SUCCESS;
702 Ewk_Context* pContext = ewk_view_context_get(pView);
703 SysAssertf(pContext, "Failed to get webkit instance.");
704 uint64_t notificationId = ewk_notification_id_get(pNotification);
706 //ewk_notification_security_origin_get(pNotification)
708 const char* text = ewk_notification_body_get(pNotification);
709 SysSecureLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
711 std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification());
712 SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
714 r = pNotificationWindow->Construct(pContext, notificationId, pImpl);
715 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error propogated.", GetErrorMessage(r));
717 pNotificationWindow->SetText(String(text));
718 pNotificationWindow->LaunchNotification();
719 pImpl->SetWebNotification(pNotificationWindow.release());
721 ewk_notification_showed(pContext, notificationId);
726 OnNotificationCancel(void* pUserData, Evas_Object* pView, void* pEventInfo)
728 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
729 uint64_t* pNotificationID = reinterpret_cast< uint64_t* >(pEventInfo);
730 SysAssertf(pImpl && pNotificationID, "Failed to request");
732 //ToDo : Where is ewk API for cancel operation?
737 OnProtocolHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
739 result r = E_SUCCESS;
740 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
741 SysAssertf(pImpl, "Failed to request");
743 r = pImpl->ShowUserConfirmPopup(USER_PROTOCOL_HANDLER, pEventInfo);
744 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
749 OnIsProtocolHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
751 int checkHandler = 0;
752 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
753 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
754 SysAssertf(pImpl && pHandlerData, "Failed to request");
756 checkHandler = pImpl->SearchHandler(pHandlerData, false);
757 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
758 switch (checkHandler)
763 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
766 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
769 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
777 OnProtocolHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
779 result r = E_SUCCESS;
780 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
781 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
782 SysAssertf(pImpl && pHandlerData, "Failed to request");
784 r = pImpl->UnregistrationHandler(pHandlerData, false);
785 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
790 OnContentHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
792 result r = E_SUCCESS;
793 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
794 SysAssertf(pImpl, "Failed to request");
796 r = pImpl->ShowUserConfirmPopup(USER_CONTENT_HANDLER, pEventInfo);
797 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
802 OnIsContentHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
804 int checkHandler = 0;
805 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
806 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
807 SysAssertf(pImpl && pHandlerData, "Failed to request");
809 checkHandler = pImpl->SearchHandler(pHandlerData, true);
810 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
812 switch (checkHandler)
817 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
820 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
823 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
832 OnContentHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
834 result r = E_SUCCESS;
835 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
836 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
837 SysAssertf(pImpl && pHandlerData, "Failed to request");
839 r = pImpl->UnregistrationHandler(pHandlerData, true);
840 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
845 OnFullScreenEntered(void* pUserData, Evas_Object* pView, void* pEventInfo)
847 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
848 bool* pIsHandleNeeded = reinterpret_cast< bool* >(pEventInfo);
849 SysAssertf(pImpl, "Failed to request");
851 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
852 SysAssertf(pWebCore, "Failed to get Web core object");
854 if (pIsHandleNeeded && *pIsHandleNeeded)
856 pWebCore->SetFullScreenEntered(true);
862 OnFullScreenExited(void* pUserData, Evas_Object* pView, void* pEventInfo)
864 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
865 SysAssertf(pImpl, "Failed to request");
867 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
868 SysAssertf(pWebCore, "Failed to get Web core object");
870 pWebCore->SetFullScreenEntered(false);
875 OnFocusDownRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
877 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
878 SysAssertf(pImpl, "Failed to request");
880 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
881 pWebCore->SetFocusEnd(true);
886 OnFocusUpRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
888 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
889 SysAssertf(pImpl, "Failed to request");
891 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
892 pWebCore->SetFocusEnd(true);
897 OnVibrationRequested(uint64_t duration, void* pUserData)
899 result r = E_SUCCESS;
901 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
902 SysAssertf(pImpl, "Failed to request");
904 r = pImpl->VibrationRequested(duration);
905 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
910 OnVibrationCanceled(void* pUserData)
912 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
913 SysAssertf(pImpl, "Failed to request");
915 pImpl->VibrationCanceled();
920 OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
922 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
923 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
924 SysAssertf(pImpl && pPolicy, "Failed to request");
926 String url(ewk_policy_decision_url_get(pPolicy));
927 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
929 if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
930 && !pImpl->IsRedirectRequested())
932 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
933 SysAssertf(pWebCore, "Failed to get Web core object");
935 pWebCore->SetFullScreenEntered(false);
937 pImpl->SetCertificateRequested(false);
939 if (pImpl->GetTextSearchListener())
941 pImpl->DisableAsyncSearch();
944 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
945 if (pLoadingListener)
947 WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
948 Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
950 switch (ewkNavigationType)
952 case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
953 navigationType = WEB_NAVIGATION_LINK_CLICKED;
955 case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
956 navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
958 case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
959 navigationType = WEB_NAVIGATION_BACKFORWARD;
961 case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
962 navigationType = WEB_NAVIGATION_RELOAD;
964 case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
965 navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
967 case EWK_POLICY_NAVIGATION_TYPE_OTHER:
968 navigationType = WEB_NAVIGATION_OTHER;
974 if (pLoadingListener->OnLoadingRequested(url, navigationType))
976 ewk_policy_decision_ignore(pPolicy);
983 if (url == L"about:blank")
985 ewk_policy_decision_use(pPolicy);
990 String currentUrl(pImpl->GetUrl());
991 String redirectUrl(pImpl->GetProtocolFromUri(url, currentUrl));
992 if (redirectUrl != L"")
994 ewk_policy_decision_ignore(pPolicy);
996 pImpl->LoadUrl(redirectUrl);
1004 String uriScheme(uri.GetScheme());
1005 SysSecureLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
1007 if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file") && (uriScheme != L""))
1009 result r = E_SUCCESS;
1011 if (uriScheme == L"tel")
1013 String operationId(L"http://tizen.org/appcontrol/operation/dial");
1014 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1016 else if (uriScheme == L"mailto" || uriScheme == L"sms" || uriScheme == L"smsto" || uriScheme == L"mms" || uriScheme == L"mmsto" )
1018 String operationId(L"http://tizen.org/appcontrol/operation/compose");
1019 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1023 String operationId(L"http://tizen.org/appcontrol/operation/view");
1024 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1029 ewk_policy_decision_ignore(pPolicy);
1035 ewk_policy_decision_use(pPolicy);
1040 OnLoadingStarted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1042 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1043 SysAssertf(pImpl, "Failed to request");
1045 if (pImpl->GetLoadingListener())
1047 result r = E_SUCCESS;
1049 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_STARTED));
1050 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1052 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1053 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1054 pEventArg.release();
1060 OnPageTitleReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1062 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1063 char* pTitle = reinterpret_cast< char* >(pEventInfo);
1064 SysAssertf(pImpl, "Failed to request");
1066 SysLog(NID_WEB_CTRL, "The current value of title is %s", pTitle);
1068 if (pImpl->GetLoadingListener())
1070 result r = E_SUCCESS;
1072 std::unique_ptr<String> pPageTitle(new (std::nothrow) String(pTitle));
1073 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED));
1074 SysTryReturnVoidResult(NID_WEB_CTRL, pPageTitle.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1076 r = pEventArg->SetEventInfo(_LoadingEventArg::PAGE_TITLE, *pPageTitle.get());
1077 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1078 pPageTitle.release();
1080 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1081 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1082 pEventArg.release();
1088 OnEstimatedProgress(void* pUserData, Evas_Object* pView, void* pEventInfo)
1090 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1091 double* pProgress = reinterpret_cast< double* >(pEventInfo);
1092 SysAssertf(pImpl, "Failed to request");
1094 SysLog(NID_WEB_CTRL, "The current value of progress is %lf", *pProgress);
1096 if (pImpl->GetLoadingListener())
1098 result r = E_SUCCESS;
1100 std::unique_ptr<Integer> pProgressPercentage(new (std::nothrow) Integer(static_cast< int >(*pProgress * 100)));
1101 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PROGRESS));
1102 SysTryReturnVoidResult(NID_WEB_CTRL, pProgressPercentage.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1104 r = pEventArg->SetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS, *pProgressPercentage.get());
1105 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1106 pProgressPercentage.release();
1108 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1109 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1110 pEventArg.release();
1116 OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1118 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1119 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
1120 SysAssertf(pImpl && pPolicy, "Failed to request");
1122 result r = E_SUCCESS;
1124 int code = ewk_policy_decision_response_status_code_get(pPolicy);
1125 String url(ewk_policy_decision_url_get(pPolicy));
1126 String mime(ewk_policy_decision_response_mime_get(pPolicy));
1127 SysSecureLog(NID_WEB_CTRL, "code : %d, url : %ls, mime : %ls", code, url.GetPointer(), mime.GetPointer());
1129 if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
1131 if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
1133 pImpl->SetRedirectRequested(true);
1136 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
1137 if (pLoadingListener)
1139 HttpHeader httpHeader;
1141 Eina_Iterator* iterator = eina_hash_iterator_tuple_new(ewk_policy_decision_response_headers_get(pPolicy));
1144 Eina_Hash_Tuple *tuple = null;
1146 EINA_ITERATOR_FOREACH(iterator, tuple)
1148 String key(reinterpret_cast< const char* >(tuple->key));
1149 String value(reinterpret_cast< char* >(tuple->data));
1151 SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
1153 r = httpHeader.AddField(key, value);
1154 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, eina_iterator_free(iterator), r, "[%s] Propagating.", GetErrorMessage(r));
1157 eina_iterator_free(iterator);
1160 pImpl->SetPolicyDecision(pLoadingListener->OnWebDataReceived(mime, httpHeader));
1164 pImpl->SetPolicyDecision(WEB_DECISION_CONTINUE);
1168 switch (pImpl->GetPolicyDecision())
1170 case WEB_DECISION_CONTINUE:
1172 String currentUrl(pImpl->GetUrl());
1173 String redirectUrl(pImpl->GetRedirectUri(url, currentUrl, mime));
1174 if (redirectUrl != L"")
1176 ewk_policy_decision_ignore(pPolicy);
1178 pImpl->LoadUrl(redirectUrl);
1183 if (ewk_policy_decision_type_get(pPolicy) == EWK_POLICY_DECISION_USE)
1189 ewk_policy_decision_ignore(pPolicy);
1191 String operationId(L"http://tizen.org/appcontrol/operation/view");
1193 r = _AppControlImpl::FindAndStart(operationId, &url, &mime, null, null, null);
1194 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS || r == E_OBJ_NOT_FOUND, r, "[%s] Propagating.", GetErrorMessage(r));
1195 if (r == E_OBJ_NOT_FOUND)
1197 String operationId(L"http://tizen.org/appcontrol/operation/download");
1199 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1200 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1208 case WEB_DECISION_DOWNLOAD:
1210 ewk_policy_decision_ignore(pPolicy);
1212 _WebDataHandler* pDownloadHandler = pImpl->GetDownloadHandler();
1213 SysTryReturnVoidResult(NID_WEB_CTRL, pDownloadHandler, E_SYSTEM, "[%s] A system error has been occurred. Failed to get DownloadHandler.", GetErrorMessage(E_SYSTEM));
1215 Ewk_Context* pContext = ewk_view_context_get(pView);
1216 SysAssertf(pContext, "Failed to get webkit instance.");
1218 pDownloadHandler->StartDownload(url);
1223 case WEB_DECISION_IGNORE:
1225 ewk_policy_decision_ignore(pPolicy);
1236 ewk_policy_decision_use(pPolicy);
1241 ewk_policy_decision_ignore(pPolicy);
1246 OnProgressCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1248 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1249 SysAssertf(pImpl, "Failed to request");
1251 if (pImpl->IsRedirectRequested())
1253 pImpl->SetRedirectRequested(false);
1256 if (pImpl->IsLoadingErrorOccurred())
1258 pImpl->SetLoadingErrorOccurred(false);
1259 evas_object_smart_callback_call(pView, "load,finished", NULL);
1265 OnLoadingErrorOccurred(void* pUserData, Evas_Object* pView, void* pEventInfo)
1267 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1268 Ewk_Error* pErrorData = reinterpret_cast< Ewk_Error* >(pEventInfo);
1269 SysAssertf(pImpl && pErrorData, "Failed to request");
1271 int code = ewk_error_code_get(pErrorData);
1272 const char* pDescription = ewk_error_description_get(pErrorData);
1274 SysLog(NID_WEB_CTRL, "The current value of code is %d, description is %s", code, pDescription);
1278 case EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE:
1279 pImpl->SetLoadingErrorOccurred(true);
1282 case EWK_ERROR_CODE_PLUGINWILLHANDLELOAD:
1283 evas_object_smart_callback_call(pView, "load,finished", NULL);
1286 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
1287 pImpl->SetLoadingErrorOccurred(true);
1288 evas_object_smart_callback_call(pView, "load,stop", NULL);
1292 pImpl->SetLoadingErrorOccurred(true);
1293 if (pImpl->GetLoadingListener())
1295 result r = E_SUCCESS;
1297 r = FireLoadingErrorOccurredEvent(pImpl, code, pDescription);
1298 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1306 OnLoadingCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
1308 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1309 SysAssertf(pImpl, "Failed to request");
1311 if (pImpl->GetLoadingListener())
1313 result r = E_SUCCESS;
1315 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_CANCELED));
1316 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1318 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1319 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1320 pEventArg.release();
1327 OnLoadingCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1329 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1330 SysAssertf(pImpl, "Failed to request");
1332 if (pImpl->GetLoadingListener())
1334 result r = E_SUCCESS;
1336 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_COMPLETED));
1337 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1339 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1340 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1341 pEventArg.release();
1347 OnLoadingCommitted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1349 evas_object_focus_set(pView, EINA_FALSE);
1354 OnFaviconReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1356 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1357 SysAssertf(pImpl, "Failed to request");
1359 if (pImpl->GetLoadingListener())
1361 result r = E_SUCCESS;
1363 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED));
1364 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1366 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1367 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1368 pEventArg.release();
1375 OnDidStartDownloadCallback(const char* pUrl, void* pUserData)
1377 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1378 SysAssertf(pUrl && pImpl != null, "Failed to request");
1380 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s", pUrl);
1385 FireWebPageShowRequestedEvent(_WebImpl* pImpl, int event)
1387 result r = E_SUCCESS;
1389 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1390 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1392 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1393 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1394 pEventArg.release();
1401 OnWebPageShowRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1403 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1404 SysAssertf(pImpl, "Failed to request");
1406 if (pImpl->GetUiEventListener())
1408 result r = E_SUCCESS;
1410 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED);
1411 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1413 if (pImpl->GetUiEventListenerF())
1415 result r = E_SUCCESS;
1417 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT);
1418 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1424 OnWebWindowCreateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1426 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(pUserData);
1427 Evas_Object** pChildView = reinterpret_cast< Evas_Object** >(pEventInfo);
1428 SysAssertf(pParentImpl && pChildView, "Failed to request");
1430 IWebUiEventListener* pUserUiListener = pParentImpl->GetUiEventListener();
1431 IWebUiEventListenerF* pUserUiListenerF = pParentImpl->GetUiEventListenerF();
1432 if (pUserUiListener)
1434 Web* pWeb = pUserUiListener->OnWebWindowCreateRequested();
1437 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1438 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1440 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1441 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1444 if (pUserUiListenerF)
1446 Web* pWeb = pUserUiListenerF->OnWebWindowCreateRequested();
1449 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1450 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1452 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1453 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1460 FireWebWindowClosedRequestedEvent(_WebImpl* pImpl, int event)
1462 result r = E_SUCCESS;
1464 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1465 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1467 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1468 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1469 pEventArg.release();
1476 OnWebWindowClosedRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1478 _WebImpl* pChildImpl = reinterpret_cast< _WebImpl* >(pUserData);
1479 SysAssertf(pChildImpl, "Failed to request");
1481 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, PARENT_WEB_CTRL));
1482 if (pParentImpl == null)
1487 if (pParentImpl->GetUiEventListener())
1489 result r = E_SUCCESS;
1491 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED);
1492 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1494 if (pParentImpl->GetUiEventListenerF())
1496 result r = E_SUCCESS;
1498 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT);
1499 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1505 FireWebPreventDefaultTriggeredEvent(_WebImpl* pImpl, int event, bool trigger)
1507 result r = E_SUCCESS;
1509 std::unique_ptr<Boolean> pPreventTrigger(new (std::nothrow) Boolean(trigger));
1510 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1511 SysTryReturnResult(NID_WEB_CTRL, pPreventTrigger.get() && pEventArg.get(), E_OUT_OF_MEMORY, " Memory allocation failed." );
1513 r = pEventArg->SetEventInfo(_WebUiEventArg::PREVENT_DEFAULT, *pPreventTrigger.get());
1514 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1515 pPreventTrigger.release();
1517 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1518 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1519 pEventArg.release();
1526 OnWebPreventDefaultTriggered(void* pUserData, Evas_Object* pView, void* pEventInfo)
1528 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1529 Eina_Bool* pTrigger = reinterpret_cast< Eina_Bool* >(pEventInfo);
1530 SysAssertf(pImpl && pTrigger, "Failed to request");
1532 if (pImpl->GetUiEventListener())
1534 result r = E_SUCCESS;
1536 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED, static_cast< bool >(*pTrigger));
1537 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1539 if (pImpl->GetUiEventListenerF())
1541 result r = E_SUCCESS;
1543 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT, static_cast< bool >(*pTrigger));
1544 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1550 FireWebPageBlockSelectedEvent(_WebImpl* pImpl)
1552 result r = E_SUCCESS;
1554 std::unique_ptr<Point> startPoint(new (std::nothrow) Point());
1555 std::unique_ptr<Point> endPoint(new (std::nothrow) Point());
1556 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1558 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1560 if ((endPoint->x != 0) && (endPoint->y != 0))
1562 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED));
1563 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1565 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1566 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1567 startPoint.release();
1569 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1570 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1573 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1574 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1575 pEventArg.release();
1583 FireWebPageBlockSelectedEventF(_WebImpl* pImpl)
1585 result r = E_SUCCESS;
1587 std::unique_ptr<FloatPoint> startPoint(new (std::nothrow) FloatPoint());
1588 std::unique_ptr<FloatPoint> endPoint(new (std::nothrow) FloatPoint());
1590 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1592 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1593 if ((endPoint->x != 0.0f) && (endPoint->y != 0.0f))
1595 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT));
1596 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1598 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1599 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1600 startPoint.release();
1602 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1603 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1606 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1607 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1608 pEventArg.release();
1616 OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
1618 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1619 SysAssertf(pImpl, "Failed to request");
1621 if (pImpl->GetUiEventListener())
1623 result r = E_SUCCESS;
1625 r = FireWebPageBlockSelectedEvent(pImpl);
1626 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1628 if (pImpl->GetUiEventListenerF())
1630 result r = E_SUCCESS;
1632 r = FireWebPageBlockSelectedEventF(pImpl);
1633 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1639 OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
1641 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1642 char* pJsonText = reinterpret_cast< char* >(pEventInfo);
1643 SysAssertf(pImpl && pJsonText, "Failed to request");
1645 result r = E_SUCCESS;
1647 SysLog(NID_WEB_CTRL, "The current value of jsontext is %s", pJsonText);
1649 std::unique_ptr<_JsBridgeArg> pEventArg(new (std::nothrow) _JsBridgeArg());
1650 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1652 r = pEventArg->Construct(pJsonText);
1653 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1655 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1656 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1657 pEventArg.release();
1662 OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
1664 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1665 Eina_Rectangle* pEinaRect = reinterpret_cast< Eina_Rectangle* >(pEventInfo);
1666 SysAssertf(pImpl && pEinaRect, "Failed to request");
1668 if (pImpl->GetSetting().GetInputStyle() == INPUT_STYLE_OVERLAY)
1670 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1671 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1673 Rectangle rect(pEinaRect->x, pEinaRect->y, pEinaRect->w, pEinaRect->h);
1675 if (rect.height == 0)
1680 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1683 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
1685 pFormImpl->Invalidate(false);
1688 if (pImpl->GetWebKeypadEventListener())
1690 if (pImpl->IsKeypadVisible() == true)
1692 if ((pImpl->GetPreviousKeypadBounds().width == rect.width) && (pImpl->GetPreviousKeypadBounds().height != rect.height))
1694 pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1699 pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1703 pImpl->SetPreviousKeypadBounds(rect);
1707 result r = pImpl->SetFullScreenKeypad();
1708 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1714 OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
1716 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1717 SysAssertf(pImpl, "Failed to request");
1719 pImpl->SetKeypadVisibleState(true);
1721 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1724 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1725 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1727 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(pImpl->GetPreviousKeypadBounds().height));
1729 if (pFormImpl->HasFooter())
1731 pFormImpl->GetCore().SetKeypadShowState(true);
1736 if (pImpl->GetWebKeypadEventListener())
1738 pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
1744 OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
1746 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1747 SysAssertf(pImpl, "Failed to request");
1749 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1752 pFormImpl->DeflateClientRectHeight(0);
1754 pFormImpl->Invalidate(false);
1756 if (pFormImpl->HasFooter())
1758 pFormImpl->GetCore().SetKeypadShowState(false);
1763 if (pImpl->GetWebKeypadEventListener())
1765 pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1768 pImpl->SetKeypadVisibleState(false);
1773 OnWindowObjectFocusLost(void* pUserData, Evas_Object* pWin, void* pEvent_info)
1775 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1776 SysAssertf(pImpl, "Failed to request");
1778 pImpl->SetWinFocusLost(true);
1783 OnWindowObjectFocusGained(void* pUserData, Evas_Object* pWin, void* pEvent_info)
1785 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1786 SysAssertf(pImpl, "Failed to request");
1788 if (pImpl->IsVisible() == true && pImpl->IsFocused() == true)
1790 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1791 SysAssertf(pWebCore, "Failed to get Web core object");
1793 if (pImpl->IsWinFocusLost() == true)
1795 Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
1796 SysAssertf(pSettings, "Failed to get settings instance.");
1798 if (ewk_settings_clear_text_selection_automatically_get(pSettings) == EINA_FALSE)
1800 ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_TRUE);
1802 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1804 else if (pImpl->IsKeypadOpened() == true)
1806 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1811 pImpl->SetWinFocusLost(false);
1816 OnWebNativeNodeFocusGained(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
1818 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1819 SysAssertf(pImpl, "Failed to request");
1821 if (pImpl->IsKeypadOpened() == true)
1823 pImpl->SetKeypadOpened(false);
1825 else if (pImpl->IsWinFocusLost() == true && pImpl->IsFocused() == false)
1827 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1828 SysAssertf(pWebCore, "Failed to get Web core object");
1830 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_FALSE);
1836 OnWebNativeNodeFocusLost(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
1838 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1839 SysAssertf(pImpl, "Failed to request");
1841 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1842 SysAssertf(pWebCore, "Failed to get Web core object");
1844 Eina_Rectangle leftHandle;
1845 Eina_Rectangle rightHandle;
1847 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
1848 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
1850 if (pImpl->IsWinFocusLost() == true && ewk_view_text_selection_range_get(pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle))
1852 Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
1853 SysAssertf(pSettings, "Failed to get settings instance.");
1855 ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_FALSE);
1861 OnColorPickerProviderRequested(Ewk_View_Smart_Data* pSmartData, int red, int green, int blue, int alpha)
1863 SysAssertf(pSmartData, "invalid smartdata");
1864 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1865 SysAssertf(pWebImpl, "Failed to get Impl");
1867 result r = E_SUCCESS;
1869 if (pWebImpl->GetColorpicker())
1876 r = pWebImpl->ShowColorPicker(red, green, blue, alpha, color);
1877 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1879 byte r1, g1, b1, a1;
1880 color.GetColorComponents(r1, g1, b1, a1);
1881 ewk_view_color_picker_color_set(pSmartData->self, r1, g1, b1, a1);
1888 OnColorPickerProviderDismissed(Ewk_View_Smart_Data* pSmartData)
1890 SysAssertf(pSmartData, "invalid smartdata");
1892 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1893 SysAssertf(pWebImpl, "Failed to get Impl");
1895 return pWebImpl->HideColorPicker();
1900 OnDatePickerProviderRequested(Ewk_View_Smart_Data* pSmartData, Ewk_Input_Type inputType, const char* inputValue)
1902 SysAssertf(pSmartData, "Failed to request");
1903 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1904 SysAssertf(pWebImpl, "Failed to get Impl");
1906 result r = E_SUCCESS;
1908 if (pWebImpl->GetDatepicker())
1910 ewk_view_focused_input_element_value_set(pSmartData->self, inputValue);
1917 r = pWebImpl->ShowDatePicker(inputType, inputValue, dateStr);
1918 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1920 std::unique_ptr<char[]> pDateStr(_StringConverter::CopyToCharArrayN(dateStr));
1921 SysTryReturn(NID_WEB_CTRL, pDateStr.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1923 ewk_view_focused_input_element_value_set(pSmartData->self, pDateStr.get());
1930 OnSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, double pageScaleFactor, Eina_List* pItems, int selectedIndex)
1932 SysAssertf(pSmartData, "Failed to request");
1934 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1935 SysAssertf(pWebImpl, "Failed to get Impl");
1937 result r = pWebImpl->ShowSelectBoxPopup(false, L"", pItems, pSmartData->self, selectedIndex);
1938 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1945 OnMultiSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* pItems)
1947 SysAssertf(pSmartData, "Failed to request");
1949 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1950 SysAssertf(pWebImpl, "Failed to get Impl");
1952 result r = pWebImpl->ShowSelectBoxPopup(true, L"", pItems, pSmartData->self, 0);
1953 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1960 OnSelectBoxClosed(Ewk_View_Smart_Data* pSmartData)
1962 SysAssertf(pSmartData, "invalid smartdata");
1964 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1965 SysAssertf(pWebImpl, "Failed to get Impl");
1967 result r = pWebImpl->ClearSelectBoxPopup();
1968 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1975 OnSelectBoxUpdateRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, Eina_List* pItems, int selectedIndex)
1977 SysAssertf(pSmartData, "invalid smartdata");
1979 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1980 SysAssertf(pWebImpl, "Failed to get Impl");
1982 result r = pWebImpl->UpdateSelectBoxPopup(pItems, selectedIndex, false);
1983 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1990 OnFormDataCandidateShow(Ewk_View_Smart_Data *pSmartData, int x, int y, int w, int h)
1992 SysAssertf(pSmartData, "Failed to request");
1994 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1995 SysAssertf(pWebImpl, "Failed to get Impl");
1997 Rectangle windowRect(x, y, w, h);
1998 result r = pWebImpl->ShowFormDataWindow(windowRect, pSmartData->self);
1999 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
2006 OnFormDataCandidateHide(Ewk_View_Smart_Data *pSmartData)
2008 SysAssertf(pSmartData, "Failed to request");
2010 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2011 SysAssertf(pWebImpl, "Failed to get Impl");
2013 if (pWebImpl->IsFormDataWindowVisible())
2015 pWebImpl->HideFormDataWindow();
2023 OnFormDataCandidateUpdate(Ewk_View_Smart_Data *pSmartData, Eina_List *pDataList)
2025 SysAssertf(pSmartData, "Failed to request");
2027 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2028 SysAssertf(pWebImpl, "Failed to get Impl");
2030 pWebImpl->SetFormDataList(pDataList);
2037 OnFormDataCandidateIsShowing(Ewk_View_Smart_Data *pSmartData)
2039 SysAssertf(pSmartData, "Failed to request");
2041 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2042 SysAssertf(pWebImpl, "Failed to get Impl");
2044 if (pWebImpl->IsFormDataWindowVisible())
2056 OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
2058 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
2059 SysAssertf(pPresenter && !pError, "Failed to request");
2061 bool ret = EINA_TRUE;
2065 case EWK_COOKIE_ACCEPT_POLICY_ALWAYS:
2067 case EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY:
2071 case EWK_COOKIE_ACCEPT_POLICY_NEVER:
2080 SysLog(NID_WEB_CTRL, "The current value of policy is %d", ret);
2082 pPresenter->EndAsyncProcess(ret);
2087 OnScriptExecuted(Evas_Object* pView, const char* pResult, void* pUserData)
2089 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
2090 SysAssertf(pPresenter, "Failed to request");
2092 String result(pResult);
2093 SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
2095 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
2096 _WebManager* pWebManager = _WebManager::GetInstance();
2097 if (pWebManager->IsValidCallback(reinterpret_cast< int >(pImpl), reinterpret_cast< int >(pPresenter)))
2099 pPresenter->EndAsyncProcess(result);
2105 OnTextFound(void* pUserData, Evas_Object* pView, void* pEventInfo)
2107 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
2108 SysAssertf(pImpl, "Failed to request");
2110 int* pTotalCount = reinterpret_cast< int* >(pEventInfo);
2111 SysLog(NID_WEB_CTRL, "The current value of totalCount is %d", *pTotalCount);
2113 _WebPresenter* pWebPresenter = pImpl->GetSearchPresenter();
2117 pWebPresenter->EndAsyncProcess(*pTotalCount);
2121 if (pImpl->GetTextSearchListener())
2123 result r = E_SUCCESS;
2127 if (*pTotalCount > 0)
2129 ordinal = pImpl->GetAsyncSearchOrdinal();
2130 pImpl->SetAsyncSearchResult(*pTotalCount);
2133 if (pImpl->GetPendingAsyncSearchCount() > 0)
2138 std::unique_ptr<Integer> pCount(new (std::nothrow) Integer(*pTotalCount));
2139 std::unique_ptr<Integer> pOrdinal(new (std::nothrow) Integer(ordinal));
2140 std::unique_ptr<_TextSearchEventArg> pEventArg(new (std::nothrow) _TextSearchEventArg(WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND));
2141 SysTryReturnVoidResult(NID_WEB_CTRL, pCount.get() && pOrdinal.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2143 r = pEventArg->SetEventInfo(_TextSearchEventArg::TOTAL_COUNT, *pCount.get());
2144 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2147 r = pEventArg->SetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL, *pOrdinal.get());
2148 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2151 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
2152 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2153 pEventArg.release();
2159 class _JsBridgeHashCodeProvider
2160 : public Tizen::Base::Collection::IHashCodeProviderT< Tizen::Base::String >
2163 _JsBridgeHashCodeProvider(){}
2164 virtual ~_JsBridgeHashCodeProvider(void) {}
2167 int GetHashCode(const Tizen::Base::String& obj) const
2169 return obj.GetHashCode();
2175 //Comparer implementation
2176 class _JsBridgeComparer
2177 : public Tizen::Base::Collection::IComparerT< Tizen::Base::String >
2180 _JsBridgeComparer(){}
2181 virtual ~_JsBridgeComparer(void) {}
2184 result Compare(const Tizen::Base::String& obj1, const Tizen::Base::String& obj2, int& cmp) const
2201 _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
2202 : _ContainerImpl(pWeb, pCore)
2203 , __isFooterVisible(false)
2204 , __isKeypadVisible(false)
2205 , __isKeypadOpened(false)
2206 , __isWinFocusLost(false)
2207 , __isLoadingErrorOccurred(false)
2208 , __isRedirectRequested(false)
2209 , __isCertificateRequested(false)
2210 , __isCertificateConfirmed(false)
2211 , __isFormDataVisible(false)
2212 , __keypadBounds(0, 0, 0, 0)
2214 , __pUserLoadingListener(null)
2215 , __pUserUiListener(null)
2216 , __pUserUiListenerF(null)
2217 , __pUserKeypadEventListener(null)
2218 , __pTextSearchListener(null)
2220 , __pJsBridgeList(null)
2221 , __pJsProvider(null)
2222 , __pJsComparer(null)
2223 , __pWebDownloadHandler(null)
2225 , __pAuthChallenge(null)
2226 , __pAuthPopup(null)
2227 , __pUserMediaConfirmPopup(null)
2228 , __pContentHandlerConfirmPopup(null)
2229 , __pProtocolHandlerConfirmPopup(null)
2230 , __pGeolocationConfirmPopup(null)
2231 , __pNotificationConfirmPopup(null)
2232 , __pScriptAlertConfirmPopup(null)
2233 , __pScriptConfirmPopup(null)
2234 , __pBeforeUnloadConfirmPopup(null)
2235 , __pAppCacheConfirmPopup(null)
2236 , __pDbQuotaConfirmPopup(null)
2237 , __pLocalFsQuotaConfirmPopup(null)
2238 , __pIndexedDbQuotaConfirmPopup(null)
2239 , __pPromptPopup(null)
2240 , __pCertConfirmPopup(null)
2241 , __pSelectBox(null)
2242 , __pDatePicker(null)
2243 , __pColorPicker(null)
2244 , __pFormDataWindow(null)
2246 , __policy(WEB_DECISION_CONTINUE)
2247 , __defaultUserAgent(L"")
2248 , __pFormDataList(null)
2249 , __popupClosed(false)
2251 __textSearch.__searchAll = false;
2252 __textSearch.__searchForward = true;
2253 __textSearch.__caseSensitive = false;
2254 __textSearch.__pending = 0;
2255 __textSearch.__currentIndex = 1;
2256 __textSearch.__totalCount = -1;
2257 __textSearch.__text = L"";
2261 _WebImpl::~_WebImpl()
2263 _WebManager* pWebManager = _WebManager::GetInstance();
2264 SysTryCatch(NID_WEB_CTRL, pWebManager, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2266 pWebManager->RemoveWeb(reinterpret_cast< int >(this));
2267 pWebManager->RemoveActiveWeb(this);
2270 _SettingInfoImpl::RemoveSettingEventListener(*this);
2271 RemoveEventListenerCallback();
2272 ClearCertificateDb();
2277 _WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
2279 result r = E_SUCCESS;
2281 r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2282 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2284 _Web* pCore = _Web::CreateWebN();
2285 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2287 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2289 r = CheckConstruction(pCore, pImpl);
2290 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2292 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2293 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2295 r = pImpl->Construct();
2296 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2308 _WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
2310 result r = E_SUCCESS;
2312 r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2313 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2315 _Web* pCore = _Web::CreateWebN();
2316 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2318 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2320 r = CheckConstruction(pCore, pImpl);
2321 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2323 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2324 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2326 r = pImpl->Construct();
2327 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2339 _WebImpl::Construct(void)
2341 result r = E_SUCCESS;
2343 r = __mutex.Create();
2344 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2346 r = __textSearch.__searchQueue.Construct();
2347 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2349 r = __webNotificationList.Construct();
2350 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2352 r = InitJsBridgeList();
2353 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2356 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2358 __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
2359 SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
2366 _WebImpl::InitializeSetting(void)
2368 result r = E_SUCCESS;
2370 WebSetting* pWebSetting = __pWebCore->GetSetting();
2371 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(pWebSetting);
2373 SetCookieEnabled(pWebSettingImpl->IsCookieEnabled());
2374 SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
2376 __defaultUserAgent = pWebSettingImpl->GetUserAgent();
2378 r = SetSetting(*pWebSetting);
2379 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2381 SetEventListenerCallback();
2388 _WebImpl::IsLayoutable(void) const
2395 _WebImpl::InitWebEvent(void)
2397 __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
2398 SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2400 return __pWebEvent->Construct(*this);
2405 _WebImpl::GetWebEvent(void) const
2407 return __pWebEvent.get();
2412 _WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
2414 Eina_Hash* pHttpHeader = null;
2416 std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
2417 if (pFieldNameList.get())
2419 pHttpHeader = eina_hash_string_small_new(FreeCharArray);
2420 SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2422 int count = pFieldNameList->GetCount();
2424 for (int i = 0; i < count; i++)
2426 String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
2427 SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2429 std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
2430 SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2432 std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
2433 SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2435 while (pFieldValueEnum->MoveNext() == E_SUCCESS)
2437 Eina_Bool ret = false;
2439 String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
2440 SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2442 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
2443 SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2445 ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
2446 SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2453 eina_hash_free(pHttpHeader);
2460 _WebImpl::LoadUrl(const String& url) const
2462 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2463 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2465 ewk_view_url_set(__pWebCore->GetWebNativeNode(), pUrl.get());
2472 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
2474 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2475 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2477 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2479 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
2481 eina_hash_free(pHttpHeader);
2488 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
2490 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2491 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2493 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2495 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
2497 eina_hash_free(pHttpHeader);
2504 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
2506 SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
2508 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
2509 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2510 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
2511 SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2513 ewk_view_contents_set(__pWebCore->GetWebNativeNode(), reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
2520 _WebImpl::Pause(void)
2522 ewk_view_suspend(__pWebCore->GetWebNativeNode());
2527 _WebImpl::Resume(void)
2529 ewk_view_resume(__pWebCore->GetWebNativeNode());
2534 _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
2536 __pSelectBox.reset();
2538 SysTryReturnResult(NID_WEB_CTRL, eina_list_count(pItems) > 0, E_SYSTEM, "ItemCount is invalid.");
2540 result r = E_SUCCESS;
2542 std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
2543 SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2547 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT - 1, pWebView);
2551 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
2553 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2555 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2556 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2558 __pSelectBox = std::move(pSelectBox);
2560 return __pSelectBox->ShowPopup();
2565 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2567 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2569 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2574 _WebImpl::ClearSelectBoxPopup(void)
2576 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2578 __pSelectBox.reset();
2587 _WebImpl::GetDatepicker(void)
2589 _InputPickerPopup* pInputPicker =null;
2592 pInputPicker = __pDatePicker.get();
2594 return pInputPicker;
2599 _WebImpl::GetColorpicker(void)
2601 _InputPickerPopup* pInputPicker =null;
2604 pInputPicker = __pColorPicker.get();
2606 return pInputPicker;
2611 _WebImpl::CanGoBack(void) const
2613 return static_cast< bool >(ewk_view_back_possible(__pWebCore->GetWebNativeNode()));
2618 _WebImpl::CanGoForward(void) const
2620 return static_cast< bool >(ewk_view_forward_possible(__pWebCore->GetWebNativeNode()));
2625 _WebImpl::GoBack(void) const
2627 ewk_view_back(__pWebCore->GetWebNativeNode());
2632 _WebImpl::GoForward(void) const
2634 ewk_view_forward(__pWebCore->GetWebNativeNode());
2639 _WebImpl::GetUrl(void) const
2641 return ewk_view_url_get(__pWebCore->GetWebNativeNode());
2646 _WebImpl::GetTitle(void) const
2648 return ewk_view_title_get(__pWebCore->GetWebNativeNode());
2653 _WebImpl::StopLoading(void) const
2655 ewk_view_stop(__pWebCore->GetWebNativeNode());
2660 _WebImpl::Reload(void) const
2662 ewk_view_reload(__pWebCore->GetWebNativeNode());
2667 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
2669 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2675 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2676 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2678 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2679 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2681 ewk_view_script_execute(pView, pScript.get(), OnScriptExecuted, pPresenter.get());
2683 String* pResult = new (std::nothrow) String(L"");
2684 SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2686 pPresenter->WaitAsyncProcess(*pResult);
2693 _WebImpl::SetZoomLevel(float level)
2695 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);
2697 ewk_view_scale_set(__pWebCore->GetWebNativeNode(), static_cast< double >(level), 0, 0);
2704 _WebImpl::GetZoomLevel(void) const
2706 return static_cast< float >(ewk_view_scale_get(__pWebCore->GetWebNativeNode()));
2710 const PageNavigationList*
2711 _WebImpl::GetBackForwardListN(void) const
2713 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2719 result r = E_SUCCESS;
2721 _PageNavigationListImpl* pNavigationListImpl = null;
2722 _HistoryItemImpl* pHistoryItemImpl = null;
2724 std::unique_ptr<PageNavigationList> pNavigationList;
2725 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2728 int forwardCount = 0;
2733 Ewk_History* pEwkHistoryList = ewk_view_history_get(pView);
2734 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2736 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2737 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2739 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2740 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2742 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2743 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2745 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2746 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2748 r = pHistoryList->Construct();
2749 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2751 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2752 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2753 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2755 for (int i = -backCount; i < forwardCount + 1; i++)
2757 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2758 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2760 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2761 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2763 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2764 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2766 url = ewk_history_item_uri_get(pEwkItem);
2767 title = ewk_history_item_title_get(pEwkItem);
2768 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2770 pHistoryItemImpl->SetHistoryItem(url, title);
2772 r = pHistoryList->Add(*pHistoryItem.get());
2773 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2774 pHistoryItem.release();
2777 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2779 ewk_history_free(pEwkHistoryList);
2781 return pNavigationList.release();
2784 ewk_history_free(pEwkHistoryList);
2791 _WebImpl::SearchText(const String& text, bool searchForward)
2793 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2799 result r = E_SUCCESS;
2801 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2805 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2808 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2809 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2811 r = SynchronizeSearch(SEARCH_SYNC, pView, condition, text, searchForward, false, pPresenter.get());
2812 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
2815 pPresenter->WaitAsyncProcess(result);
2817 return static_cast < bool >(result);
2822 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2824 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2830 result r = E_SUCCESS;
2832 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2836 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2839 r = SynchronizeSearch(SEARCH_ALL_ASYNC, pView, condition, text, true, caseSensitive);
2840 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2847 _WebImpl::SearchNextAsync(bool searchForward)
2849 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2855 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2856 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2857 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2859 result r = E_SUCCESS;
2861 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2863 if (!__textSearch.__caseSensitive)
2865 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2870 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2873 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pView, condition, __textSearch.__text, searchForward);
2874 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2881 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
2883 MutexGuard lock(__mutex);
2885 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
2886 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2891 if (__textSearch.__searchAll)
2893 DisableAsyncSearch();
2895 __textSearch.__searchQueue.Enqueue(this);
2896 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2898 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2899 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2903 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2905 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2909 case SEARCH_ALL_ASYNC:
2910 __textSearch.__searchAll = true;
2911 __textSearch.__text = text;
2912 __textSearch.__searchForward = true;
2913 __textSearch.__caseSensitive = caseSensitive;
2914 __textSearch.__totalCount = -1;
2915 __textSearch.__currentIndex = 1;
2917 __textSearch.__searchQueue.Enqueue(this);
2918 __textSearch.__searchQueue.Enqueue(this);
2920 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2921 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2924 case SEARCH_NEXT_ASYNC:
2925 __textSearch.__searchForward = searchForward;
2927 CalculateAsyncSearchOrdinal();
2929 __textSearch.__searchQueue.Enqueue(this);
2931 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2943 _WebImpl::SetAsyncSearchResult(int totalCount)
2945 __textSearch.__totalCount = totalCount;
2950 _WebImpl::GetSearchPresenter(void)
2952 MutexGuard lock(__mutex);
2954 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
2959 _WebImpl::GetPendingAsyncSearchCount(void) const
2961 return __textSearch.__searchQueue.GetCount();
2966 _WebImpl::CalculateAsyncSearchOrdinal(void)
2968 if (__textSearch.__searchForward)
2970 __textSearch.__currentIndex++;
2974 __textSearch.__currentIndex--;
2980 _WebImpl::GetAsyncSearchOrdinal(void) const
2982 return __textSearch.__currentIndex;
2987 _WebImpl::DisableAsyncSearch(void)
2989 __textSearch.__searchAll = false;
2994 _WebImpl::SetSetting(const WebSetting& setting)
2996 if (__pWebCore->GetWebNativeNode())
2998 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2999 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3000 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
3002 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
3003 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3005 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
3007 switch (setting.GetCacheControl())
3009 case WEB_CACHE_VALIDATED:
3010 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
3013 case WEB_CACHE_IGNORE:
3014 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
3021 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
3023 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
3027 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
3030 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
3032 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
3034 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
3036 if (__defaultUserAgent != setting.GetUserAgent())
3038 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
3039 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3041 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
3044 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
3046 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
3048 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
3050 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
3053 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
3055 pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
3056 pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
3057 pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
3058 pWebSettingImpl->SetFontSize(setting.GetFontSize());
3059 pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
3060 pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
3061 pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
3062 pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
3063 pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
3064 pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
3065 pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
3066 pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
3067 pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
3074 _WebImpl::GetSetting(void) const
3076 return *__pWebCore->GetSetting();
3080 const HitElementResult*
3081 _WebImpl::GetElementByPointN(const Point& point) const
3083 return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
3087 const HitElementResult*
3088 _WebImpl::GetElementByPointN(const FloatPoint& point) const
3090 Evas_Object* pView = __pWebCore->GetWebNativeNode();
3096 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));
3098 result r = E_SUCCESS;
3100 _HitElementResultImpl* pHitElementResultImpl = null;
3102 std::unique_ptr<HitElementResult> pHitElementResult;
3103 std::unique_ptr<Bitmap> pImage;
3104 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
3106 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
3108 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pView, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3109 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
3111 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3112 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
3113 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
3114 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3115 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
3117 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
3119 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
3120 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3122 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
3123 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3125 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
3131 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
3132 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
3133 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
3134 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
3136 r = buf.Construct(imageLength);
3137 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3139 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
3140 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3144 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
3145 // webkit support types such as ico and vp8 additionally
3146 if (strcmp(pExtension, "gif") == 0)
3148 format = IMG_FORMAT_GIF;
3150 else if (strcmp(pExtension, "jpg") == 0)
3152 format = IMG_FORMAT_JPG;
3154 else if (strcmp(pExtension, "png") == 0)
3156 format = IMG_FORMAT_PNG;
3158 else if (strcmp(pExtension, "bmp") == 0)
3160 format = IMG_FORMAT_BMP;
3164 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
3168 r = image.Construct();
3169 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3171 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
3172 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3177 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
3178 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3180 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
3181 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3183 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
3184 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3187 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
3189 ewk_hit_test_free(pEwkHitTest);
3191 return pHitElementResult.release();
3194 ewk_hit_test_free(pEwkHitTest);
3201 _WebImpl::IsLoading(void) const
3203 double percent = ewk_view_load_progress_get(__pWebCore->GetWebNativeNode());
3205 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
3217 _WebImpl::GetTextFromBlock(void) const
3219 return ewk_view_text_selection_text_get(__pWebCore->GetWebNativeNode());
3224 _WebImpl::IsPrivateBrowsingEnabled(void) const
3226 if (__pWebCore->GetWebNativeNode() == null)
3228 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
3231 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3232 SysAssertf(pSettings, "Failed to get webkit instance.");
3234 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
3239 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
3241 if (__pWebCore->GetWebNativeNode() == null)
3243 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
3247 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3248 SysAssertf(pSettings, "Failed to get webkit instance.");
3250 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
3255 _WebImpl::ClearHistory(void)
3257 ewk_view_back_forward_list_clear(__pWebCore->GetWebNativeNode());
3262 _WebImpl::ClearCache(void)
3264 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3266 ewk_context_cache_clear(pContext);
3271 _WebImpl::ClearCookie(void)
3273 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3274 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3276 ewk_cookie_manager_cookies_clear(pCookieManager);
3281 _WebImpl::ClearFormData(void)
3283 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3285 ewk_context_form_candidate_data_clear(pContext);
3290 _WebImpl::ClearLoginFormData(void)
3292 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3294 ewk_context_form_password_data_clear(pContext);
3299 _WebImpl::IsCookieEnabled(void) const
3301 if (__pWebCore->GetWebNativeNode() == null)
3303 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
3306 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3307 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3308 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3310 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
3311 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3313 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, pPresenter.get());
3315 bool result = false;
3316 pPresenter->WaitAsyncProcess(result);
3323 _WebImpl::SetCookieEnabled(bool enable)
3325 if (__pWebCore->GetWebNativeNode() == null)
3327 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
3332 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3333 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3334 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3338 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
3342 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
3343 ewk_cookie_manager_cookies_clear(pCookieManager);
3349 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
3351 result r = E_SUCCESS;
3353 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
3354 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3357 String fileExtension = File::GetFileExtension(filePath);
3358 int pathLength = filePath.GetLength();
3361 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
3363 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
3364 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3365 r = filePath.SubString(0, index + 1, dirPath);
3366 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3368 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
3369 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
3373 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
3375 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), pSize->width, pSize->height, pFilePath.get());
3379 Evas_Coord contentsWidth;
3380 Evas_Coord contentsHeight;
3382 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &contentsWidth, &contentsHeight);
3383 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), contentsWidth, contentsHeight, pFilePath.get());
3391 _WebImpl::IsMimeSupported(const String& mime) const
3393 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
3394 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3396 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(__pWebCore->GetWebNativeNode()), pMime.get()));
3401 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
3403 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
3408 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
3410 __pUserUiListener = pUiEventListener;
3415 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
3417 __pUserUiListenerF = pUiEventListener;
3422 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
3424 __pUserKeypadEventListener = pKeypadEventListener;
3429 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
3431 if (__pWebDownloadHandler.get() == null)
3433 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
3434 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3437 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
3438 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
3443 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
3445 __pTextSearchListener = pTextSearchListener;
3450 _WebImpl::SetScrollEnabled(bool enable)
3452 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
3457 _WebImpl::IsScrollEnabled(void) const
3459 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
3464 _WebImpl::InitJsBridgeList(void)
3466 result r = E_SUCCESS;
3468 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
3469 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3471 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
3472 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3474 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
3475 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3477 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
3478 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3480 __pJsBridgeList = std::move(pJsBridgeList);
3487 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3489 result r = E_SUCCESS;
3491 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3492 String key(pJsBridge->GetName());
3494 r = __pJsBridgeList->Add(key, pJsBridge);
3495 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3502 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3504 result r = E_SUCCESS;
3506 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3507 String key(pJsBridge->GetName());
3509 r = __pJsBridgeList->Remove(key);
3510 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3517 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3519 result r = E_SUCCESS;
3521 IJsonValue* pJsonValue = null;
3522 IJavaScriptBridge* pJsBridge = null;
3524 String key(L"name");
3526 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3527 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));
3529 r = pJsonObject->GetValue(&key, pJsonValue);
3530 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3532 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3533 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3535 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3536 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3543 _WebImpl::GetLoadingListener(void) const
3545 return __pUserLoadingListener;
3549 IWebUiEventListener*
3550 _WebImpl::GetUiEventListener(void) const
3552 return __pUserUiListener;
3556 IWebUiEventListenerF*
3557 _WebImpl::GetUiEventListenerF(void) const
3559 return __pUserUiListenerF;
3563 IWebKeypadEventListener*
3564 _WebImpl::GetWebKeypadEventListener(void) const
3566 return __pUserKeypadEventListener;
3570 ITextSearchListener*
3571 _WebImpl::GetTextSearchListener(void) const
3573 return __pTextSearchListener;
3578 _WebImpl::SetEventListenerCallback(void) const
3580 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3583 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3584 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3586 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3587 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3589 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3590 SysAssertf(pSmartData, "Failed to request");
3592 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3593 SysAssertf(pSmart, "Failed to request");
3595 pSmart->popup_menu_show = OnSelectBoxRequested;
3596 pSmart->multiple_popup_menu_show = OnMultiSelectBoxRequested;
3597 pSmart->popup_menu_hide = OnSelectBoxClosed;
3598 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3600 pSmart->input_picker_show = OnDatePickerProviderRequested;
3601 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3602 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3604 pSmart->formdata_candidate_show = OnFormDataCandidateShow;
3605 pSmart->formdata_candidate_hide = OnFormDataCandidateHide;
3606 pSmart->formdata_candidate_update_data = OnFormDataCandidateUpdate;
3607 pSmart->formdata_candidate_is_showing = OnFormDataCandidateIsShowing;
3609 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3611 // add loading event callbacks for ILoadingListener
3612 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3613 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3615 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3616 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3617 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3618 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3619 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3620 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3621 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3622 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3623 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3625 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3627 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3628 evas_object_smart_callback_add(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3630 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3631 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3632 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3634 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3635 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3637 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3639 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3640 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3641 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3642 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, OnBeforeUnloadConfirmRequested, const_cast< _WebImpl* >(this));
3644 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3646 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3647 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3648 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3650 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3651 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3652 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3654 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3655 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3656 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3658 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3659 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3660 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3661 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3663 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3664 evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
3666 evas_object_smart_callback_add(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected, this);
3668 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
3669 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
3671 evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
3672 evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
3674 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3675 SysAssertf(pContext, "Failed to get webkit instance.");
3676 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3677 ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
3679 ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
3680 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3681 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3682 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
3684 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3685 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost, this);
3691 _WebImpl::RemoveEventListenerCallback(void) const
3693 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3696 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3697 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3699 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3700 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3702 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3703 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3705 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3706 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3707 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3708 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3709 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3710 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3711 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3712 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3713 evas_object_smart_callback_del(pWebNativeNode, "load,committed", OnLoadingCommitted);
3715 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3717 evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3718 evas_object_smart_callback_del_full(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3720 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3721 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3722 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3724 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3725 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3727 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3729 ewk_view_javascript_alert_callback_set(pWebNativeNode, null, null);
3730 ewk_view_javascript_prompt_callback_set(pWebNativeNode, null, null);
3731 ewk_view_javascript_confirm_callback_set(pWebNativeNode, null, null);
3732 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, null, null);
3734 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3736 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3737 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3738 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3740 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3741 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3742 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3743 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3744 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3745 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3747 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3748 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3749 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3751 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3753 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3754 evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
3756 evas_object_smart_callback_del(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected);
3758 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
3759 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
3761 evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
3762 evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
3764 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3765 SysAssertf(pContext, "Failed to get webkit instance.");
3766 ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
3768 ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
3769 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
3770 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
3771 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
3773 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3774 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost);
3780 _WebImpl::ClearCertificateDb(void)
3782 result r = E_SUCCESS;
3784 String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
3785 String table(CERTIFICATE_TABLE_NAME);
3788 r = db.Construct(certificatePath, "r+", null);
3789 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3791 db.BeginTransaction();
3793 r = db.ExecuteSql(L"Delete From " + table, true);
3794 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3796 db.CommitTransaction();
3801 db.RollbackTransaction();
3806 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3808 return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
3813 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
3815 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3821 Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pWebview));
3822 SysAssertf(pSmartData && pSmartData->api, "Failed to get webkit instance.");
3823 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
3825 Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3828 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3830 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3831 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
3833 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3835 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3836 char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
3837 if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
3839 ewk_view_command_execute(pWebview, "SelectWord", 0);
3840 evas_object_smart_callback_call(pWebview, "magnifier,hide", NULL);
3844 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
3851 _WebImpl::ReleaseBlock(void)
3853 ewk_view_text_selection_range_clear(__pWebCore->GetWebNativeNode());
3858 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
3860 FloatPoint tempStartPoint;
3861 FloatPoint tempEndPoint;
3863 GetBlockRange(tempStartPoint, tempEndPoint);
3865 startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
3866 endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
3871 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
3873 Eina_Rectangle leftHandle;
3874 Eina_Rectangle rightHandle;
3876 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
3877 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
3879 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
3881 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
3882 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
3883 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
3884 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
3886 if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
3888 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
3889 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
3895 _WebImpl::GetFaviconN(void) const
3897 result r = E_SUCCESS;
3899 Evas_Object* pView = __pWebCore->GetWebNativeNode();
3900 Ewk_Context* pContext = ewk_view_context_get(pView);
3901 const char* pUrl = ewk_view_url_get(pView);
3902 Evas* pEvas = evas_object_evas_get(pView);
3904 Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
3910 Tizen::Graphics::BufferInfo bufferInfo;
3912 r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
3913 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3915 const Dimension dimension(bufferInfo.width, bufferInfo.height);
3916 Tizen::Base::ByteBuffer byteBuffer;
3918 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
3919 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3921 std::unique_ptr<Bitmap> pImage(new (std::nothrow) Bitmap());
3922 SysTryReturn(NID_WEB_CTRL, pImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3924 r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
3925 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3927 return pImage.release();
3933 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
3935 ewk_view_scroll_by(__pWebCore->GetWebNativeNode(), diff.x, diff.y);
3940 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
3942 ewk_view_scroll_set(__pWebCore->GetWebNativeNode(), dest.x, dest.y);
3947 _WebImpl::GetScrollPosition(void) const
3951 ewk_view_scroll_pos_get(__pWebCore->GetWebNativeNode(), &position.x, &position.y);
3958 _WebImpl::GetPageSize(void) const
3960 Evas_Coord width = 0;
3961 Evas_Coord height = 0;
3963 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &width, &height);
3965 Dimension size(static_cast< int >(width), static_cast< int >(height));
3972 _WebImpl::AddHttpHeaderField(const String& name, const String& value)
3974 SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
3976 std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
3977 SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3979 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(value));
3981 ewk_view_custom_header_add(__pWebCore->GetWebNativeNode(), pName.get(), pValue.get());
3988 _WebImpl::RemoveHttpHeaderField(const String& name)
3990 SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
3992 std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
3993 SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3995 ewk_view_custom_header_remove(__pWebCore->GetWebNativeNode(), pName.get());
4002 _WebImpl::SetLoadingErrorOccurred(bool arg)
4004 __isLoadingErrorOccurred = arg;
4009 _WebImpl::IsLoadingErrorOccurred(void) const
4011 return __isLoadingErrorOccurred;
4016 _WebImpl::SetRedirectRequested(bool arg)
4018 __isRedirectRequested = arg;
4023 _WebImpl::IsRedirectRequested(void) const
4025 return __isRedirectRequested;
4030 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
4037 _WebImpl::GetPolicyDecision(void) const
4044 _WebImpl::SetCertificateRequested(bool arg)
4046 __isCertificateRequested = arg;
4051 _WebImpl::IsCertificateRequested(void) const
4053 return __isCertificateRequested;
4058 _WebImpl::SetCertificateConfirmed(bool arg)
4060 __isCertificateConfirmed = arg;
4065 _WebImpl::IsCertificateConfirmed(void) const
4067 return __isCertificateConfirmed;
4072 _WebImpl::SetFullScreenKeypad(void)
4074 result r = E_SUCCESS;
4076 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
4077 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4079 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
4080 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4082 String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
4083 pKeypad->SetText(text);
4085 r = pKeypad->SetShowState(true);
4086 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4088 r = pKeypad->Show();
4089 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4091 pKeypad->AddTextEventListener(*this);
4093 __pKeypad = std::move(pKeypad);
4100 _WebImpl::RemoveFullScreenKeypad(void)
4102 __pKeypad->RemoveTextEventListener(*this);
4109 _WebImpl::IsFooterVisible(void) const
4111 return __isFooterVisible;
4116 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
4118 __isFooterVisible = isFooterVisible;
4123 _WebImpl::IsKeypadVisible(void) const
4125 return __isKeypadVisible;
4130 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
4132 __isKeypadVisible = isKeypadVisible;
4137 _WebImpl::IsKeypadOpened(void) const
4139 return __isKeypadOpened;
4143 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
4145 __isKeypadOpened = isKeypadOpened;
4150 _WebImpl::IsWinFocusLost(void) const
4152 return __isWinFocusLost;
4157 _WebImpl::SetWinFocusLost(bool isWinFocusLost)
4159 __isWinFocusLost = isWinFocusLost;
4164 _WebImpl::GetPreviousKeypadBounds(void) const
4166 return __keypadBounds;
4171 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
4173 __keypadBounds = bounds;
4178 _WebImpl::OnTextValueChangeCanceled(const Control& source)
4180 RemoveFullScreenKeypad();
4185 _WebImpl::OnTextValueChanged(const Control& source)
4187 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
4189 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
4191 RemoveFullScreenKeypad();
4196 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
4198 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
4199 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
4201 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
4202 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4204 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
4205 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
4207 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
4214 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
4216 result r = E_SUCCESS;
4218 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
4219 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4221 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4223 ILoadingListener* pLoadingListner = GetLoadingListener();
4224 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
4226 switch (pEventArg->GetEventType())
4228 case WEB_EVENT_LOADINGLISTENER_STARTED:
4230 pLoadingListner->OnLoadingStarted();
4234 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
4236 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
4237 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4239 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
4243 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
4245 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
4246 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4248 pLoadingListner->OnPageTitleReceived(*pPageTitle);
4252 case WEB_EVENT_LOADINGLISTENER_CANCELED:
4254 pLoadingListner->OnLoadingCanceled();
4258 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
4260 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
4261 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4263 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
4264 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4266 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
4268 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
4272 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
4274 pLoadingListner->OnLoadingCompleted();
4278 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
4280 pLoadingListner->OnHttpAuthenticationCanceled();
4284 case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
4286 std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
4287 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4291 pLoadingListner->OnFaviconReceived(*pFavicon.get());
4307 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
4309 result r = E_SUCCESS;
4311 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
4312 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4314 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4316 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
4317 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
4319 switch (pEventArg->GetEventType())
4321 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
4323 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
4324 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4326 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
4330 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
4332 pWebDownloadListener->OnWebDataDownloadCompleted();
4336 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
4338 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
4339 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4341 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
4343 pWebDownloadListener->OnWebDownloadFailed(errorType);
4358 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
4360 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4361 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4363 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4365 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4367 switch (pEventArg->GetEventType())
4369 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
4371 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4373 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4374 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4376 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4377 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4379 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4383 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
4385 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4387 __pUserUiListener->OnWebPageShowRequested(*pWeb);
4391 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
4393 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4395 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
4399 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
4401 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4403 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4404 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4406 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4421 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
4423 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4424 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4426 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4428 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4430 switch (pEventArg->GetEventType())
4432 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
4434 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4436 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4437 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4439 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4440 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4442 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4446 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
4448 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4450 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
4454 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
4456 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4458 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
4462 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
4464 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4466 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4467 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4469 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4484 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
4486 result r = E_SUCCESS;
4488 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
4489 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4491 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4493 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
4494 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
4496 switch (pEventArg->GetEventType())
4498 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4500 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4501 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4503 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4504 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4506 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4521 _WebImpl::VibrationRequested(uint64_t duration)
4523 result r = E_SUCCESS;
4525 __pVibrator.reset();
4527 std::unique_ptr<_VibratorImpl> pVibrator(new (std::nothrow) _VibratorImpl);
4528 SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4530 r = pVibrator->Construct();
4531 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4533 __pVibrator = std::move(pVibrator);
4535 IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
4537 r = __pVibrator->Start(&pattern, 1, 1);
4538 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4545 _WebImpl::VibrationCanceled(void)
4547 __pVibrator.reset();
4552 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4554 result r = E_SUCCESS;
4556 String host(ewk_auth_challenge_url_get(pChallenge));
4557 String realm(ewk_auth_challenge_realm_get(pChallenge));
4559 __pAuthChallenge.reset();
4561 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4562 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4564 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4565 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4567 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4568 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4570 __pAuthChallenge = std::move(pAuthChallenge);
4572 ewk_auth_challenge_suspend(pChallenge);
4573 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4575 __pAuthChallenge.release();
4579 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4580 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4588 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4590 result r = E_SUCCESS;
4592 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4593 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4595 r = pAuthPopup->Construct(host, realm, pAuthChallenge);
4596 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4598 __pAuthPopup = std::move(pAuthPopup);
4600 int modalResult = 0;
4602 r = __pAuthPopup->ShowAndWait(modalResult);
4603 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4608 __pAuthPopup.reset();
4616 _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
4618 result r = E_SUCCESS;
4620 std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
4621 SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4623 r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
4624 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4626 __pCertConfirmPopup = std::move(pCertConfirmPopup);
4628 int modalResult = 0;
4630 r = __pCertConfirmPopup->ShowAndWait(modalResult);
4631 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4633 if (__pCertConfirmPopup.get() && userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
4635 __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
4639 if (__pCertConfirmPopup.get())
4641 __pCertConfirmPopup.reset();
4649 _WebImpl::ShowPromptPopup(String msg, String defVal)
4651 result r = E_SUCCESS;
4653 std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
4654 SysTryReturnResult(NID_WEB_CTRL, pPromptPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4656 r = pPromptPopup->Construct(msg, defVal, __pWebCore->GetWebNativeNode(), this);
4657 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4659 __pPromptPopup = std::move(pPromptPopup);
4661 r = __pPromptPopup->ShowPopup();
4662 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4667 __pPromptPopup.reset();
4675 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4677 result r = E_SUCCESS;
4679 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4680 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4682 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, true, msg);
4683 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4685 int modalResult = 0;
4687 switch(userConfirmMode)
4689 case USER_CONTENT_HANDLER:
4691 __pContentHandlerConfirmPopup = std::move(pUserConfirmPopup);
4693 r = __pContentHandlerConfirmPopup->ShowAndWait(modalResult);
4694 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pContentHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4696 __pContentHandlerConfirmPopup.reset();
4698 ewk_view_resume(__pWebCore->GetWebNativeNode());
4702 case USER_PROTOCOL_HANDLER:
4704 __pProtocolHandlerConfirmPopup = std::move(pUserConfirmPopup);
4706 r = __pProtocolHandlerConfirmPopup->ShowAndWait(modalResult);
4707 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pProtocolHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4709 __pProtocolHandlerConfirmPopup.reset();
4711 ewk_view_resume(__pWebCore->GetWebNativeNode());
4715 case USER_CONFIRM_APP_CACHE:
4717 __pAppCacheConfirmPopup = std::move(pUserConfirmPopup);
4719 r = __pAppCacheConfirmPopup->ShowAndWait(modalResult);
4720 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pAppCacheConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4722 __pAppCacheConfirmPopup.reset();
4724 ewk_view_resume(__pWebCore->GetWebNativeNode());
4728 case USER_CONFIRM_DB_QUOTA_EXCEDED:
4730 __pDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4732 r = __pDbQuotaConfirmPopup->ShowAndWait(modalResult);
4733 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4735 __pDbQuotaConfirmPopup.reset();
4737 ewk_view_resume(__pWebCore->GetWebNativeNode());
4741 case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
4743 __pLocalFsQuotaConfirmPopup = std::move(pUserConfirmPopup);
4745 r = __pLocalFsQuotaConfirmPopup->ShowAndWait(modalResult);
4746 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pLocalFsQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4748 __pLocalFsQuotaConfirmPopup.reset();
4750 ewk_view_resume(__pWebCore->GetWebNativeNode());
4754 case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
4756 __pIndexedDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4758 r = __pIndexedDbQuotaConfirmPopup->ShowAndWait(modalResult);
4759 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4761 __pIndexedDbQuotaConfirmPopup.reset();
4763 ewk_view_resume(__pWebCore->GetWebNativeNode());
4776 _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4778 result r = E_SUCCESS;
4780 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4781 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4783 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, false, msg);
4784 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4786 switch(userConfirmMode)
4788 case USER_CONFIRM_USERMEDIA:
4790 __pUserMediaConfirmPopup.reset();
4792 __pUserMediaConfirmPopup = std::move(pUserConfirmPopup);
4794 r = __pUserMediaConfirmPopup->ShowPopup();
4795 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pUserMediaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4799 case USER_CONFIRM_GEOLOCATION:
4801 __pGeolocationConfirmPopup.reset();
4803 __pGeolocationConfirmPopup = std::move(pUserConfirmPopup);
4805 r = __pGeolocationConfirmPopup->ShowPopup();
4806 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pGeolocationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4810 case USER_CONFIRM_NOTIFICATION:
4812 __pNotificationConfirmPopup.reset();
4814 __pNotificationConfirmPopup = std::move(pUserConfirmPopup);
4816 r = __pNotificationConfirmPopup->ShowPopup();
4817 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pNotificationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4821 case USER_SCRIPT_ALERT:
4823 __pScriptAlertConfirmPopup.reset();
4825 __pScriptAlertConfirmPopup = std::move(pUserConfirmPopup);
4827 r = __pScriptAlertConfirmPopup->ShowPopup();
4828 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptAlertConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4832 case USER_SCRIPT_CONFIRM:
4834 __pScriptConfirmPopup.reset();
4836 __pScriptConfirmPopup = std::move(pUserConfirmPopup);
4838 r = __pScriptConfirmPopup->ShowPopup();
4839 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4843 case USER_BEFORE_UNLOAD_CONFIRM:
4845 __pBeforeUnloadConfirmPopup.reset();
4847 __pBeforeUnloadConfirmPopup = std::move(pUserConfirmPopup);
4849 r = __pBeforeUnloadConfirmPopup->ShowPopup();
4850 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pBeforeUnloadConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4866 _WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl)
4869 _FormImpl* pFormImpl = null;
4871 _ControlImpl* pParentControlImpl = dynamic_cast< _ControlImpl* >(pControlImpl->GetParent());
4872 if (!pParentControlImpl)
4877 pFormImpl = dynamic_cast< _FormImpl* >(pParentControlImpl);
4883 return GetParentFormImpl(pParentControlImpl);
4888 _WebImpl::OnFocusGained(const _ControlImpl& source)
4895 _WebImpl::OnFocusLost(const _ControlImpl& source)
4897 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4903 if(IsKeypadVisible() == true)
4905 SetKeypadOpened(true);
4913 _WebImpl::HasValidNativeNode(void) const
4915 if (__pWebCore && __pWebCore->GetWebNativeNode())
4925 _WebImpl::OnPreAttachedToMainTree(void)
4927 result r = E_SUCCESS;
4929 if (IsVisible() == true)
4931 _WebManager* pWebManager = _WebManager::GetInstance();
4932 pWebManager->SetActiveWeb(this);
4935 r = _ContainerImpl::OnPreAttachedToMainTree();
4936 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4938 if (!HasValidNativeNode())
4940 r = __pWebCore->InitializeWebNativeNode();
4941 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4943 _ControlManager* pControlManager = _ControlManager::GetInstance();
4944 SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the ControlManager instance.");
4945 OnChangeLayout(pControlManager->GetScreenRotation());
4947 r = InitializeSetting();
4948 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4950 _SettingInfoImpl::AddSettingEventListener(*this);
4952 _WebManager* pWebManager = _WebManager::GetInstance();
4953 pWebManager->AddWeb(reinterpret_cast< int >(this));
4961 _WebImpl::OnDetachingFromMainTree(void)
4963 result r = E_SUCCESS;
4965 _WebManager* pWebManager = _WebManager::GetInstance();
4966 pWebManager->RemoveActiveWeb(this);
4968 r = _ContainerImpl::OnDetachingFromMainTree();
4969 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4976 _WebImpl::OnSettingChanged(String& key)
4978 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4984 if (key == L"http://tizen.org/setting/font.type")
4986 ewk_view_use_settings_font(pWebview);
4992 _WebImpl::OnChangeLayout(_ControlRotation rotation)
4994 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5004 case _CONTROL_ROTATION_0:
5007 case _CONTROL_ROTATION_90:
5010 case _CONTROL_ROTATION_180:
5013 case _CONTROL_ROTATION_270:
5019 ewk_view_orientation_send(pWebview, degree);
5024 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
5026 _ContainerImpl::OnChangeLayout(orientation);
5028 if (__pColorPicker.get())
5030 __pColorPicker->ChangeLayout(orientation);
5033 HideFormDataWindow();
5035 std::unique_ptr< IEnumerator > pEnum(__webNotificationList.GetEnumeratorN());
5036 _WebNotification* pWebNotification = null;
5038 while (pEnum->MoveNext() == E_SUCCESS)
5040 pWebNotification = static_cast< _WebNotification* >(pEnum->GetCurrent());
5041 pWebNotification->OnChangeLayout();
5044 if (IsKeypadVisible())
5046 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
5047 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
5049 _FormImpl* pFormImpl = GetParentFormImpl(dynamic_cast< _ControlImpl* >(this));
5050 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(GetPreviousKeypadBounds().height));
5056 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
5058 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5064 _WebManager* pWebManager = _WebManager::GetInstance();
5065 if (IsVisible() == true)
5067 pWebManager->SetActiveWeb(this);
5068 ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
5072 pWebManager->RemoveActiveWeb(this);
5073 ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
5079 _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
5081 _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
5085 case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
5086 __pCertConfirmPopup.reset();
5088 case ID_PROMPT_POPUP_CLOSE:
5089 __pPromptPopup.reset();
5091 case ID_USER_CONFIRM_USERMEDIA_CLOSE:
5092 __pUserMediaConfirmPopup.reset();
5094 case ID_USER_CONFIRM_GEOLOCATION_CLOSE:
5095 __pGeolocationConfirmPopup.reset();
5097 case ID_USER_CONFIRM_NOTIFICATION_CLOSE:
5098 __pNotificationConfirmPopup.reset();
5100 case ID_USER_SCRIPT_ALERT_CLOSE:
5101 __pScriptAlertConfirmPopup.reset();
5103 case ID_USER_SCRIPT_CONFIRM_CLOSE:
5104 __pScriptConfirmPopup.reset();
5107 case ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE:
5108 __pBeforeUnloadConfirmPopup.reset();
5111 case ID_USER_SCRIPT_SELECTBOX_CLOSE:
5112 __pSelectBox.reset();
5123 _WebImpl::GetDownloadHandler(void) const
5125 return __pWebDownloadHandler.get();
5130 _WebImpl::HideColorPicker(void)
5132 __pColorPicker.reset();
5141 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
5143 result r = E_SUCCESS;
5145 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
5146 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5148 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
5150 r = pColorHadler->Construct(colorVal, this);
5151 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5153 __pColorPicker = std::move(pColorHadler);
5155 r = __pColorPicker->ShowPopup();
5156 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5160 color = __pColorPicker->GetColor();
5166 __pColorPicker.reset();
5175 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
5177 result r = E_SUCCESS;
5179 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
5180 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5182 r = pInputPicker->Construct(String(inputValue), inputType, this);
5183 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5185 __pDatePicker = std::move(pInputPicker);
5187 r = __pDatePicker->ShowPopup();
5188 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5192 dateStr = __pDatePicker->GetDate();
5198 __pDatePicker.reset();
5207 _WebImpl::GetInstance(Web* pWeb)
5209 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5214 _WebImpl::GetInstance(const Web* pWeb)
5216 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5221 _WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5223 int checkReturn = 0;
5225 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5228 if( checkmime == true)
5230 table = CUSTOM_CONTENT_TABLE_NAME;
5234 table = CUSTOM_PROTOCOL_TABLE_NAME;
5237 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5238 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5239 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5241 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5243 result r = db.Construct(handlerPath, "r+", null);
5244 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5246 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"'"));
5247 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5251 r = pEnum->MoveNext();
5252 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5253 r = pEnum->GetIntAt(0, checkReturn);
5254 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5266 _WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5270 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5273 if( checkmime == true)
5275 table = CUSTOM_CONTENT_TABLE_NAME;
5279 table = CUSTOM_PROTOCOL_TABLE_NAME;
5282 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5283 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5284 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5286 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5288 result r = db.Construct(handlerPath, "r+", null);
5289 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5291 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"'"));
5292 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5296 r = pEnum->MoveNext();
5297 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5298 r = pEnum->GetIntAt(0, checkId);
5299 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5301 std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
5302 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5304 r = pDeleteStmt->BindInt(0, checkId);
5305 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5307 db.BeginTransaction();
5309 std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
5311 db.CommitTransaction();
5318 const Tizen::Base::String
5319 _WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
5321 if (originUri == L"" || currentUri == L"")
5326 result r = E_SUCCESS;
5329 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5330 String originReplace(originUri);
5331 String table(CUSTOM_PROTOCOL_TABLE_NAME);
5335 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5336 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5338 r = currentUri.SubString(0, found + 1, baseUri);
5339 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5341 r = db.Construct(handlerPath, "r+", null);
5342 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5344 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
5345 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
5349 while (pEnum->MoveNext() == E_SUCCESS)
5354 String originScheme;
5356 r = pEnum->GetStringAt(0, protocol);
5357 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5359 r = pEnum->GetStringAt(1, queryUrl);
5360 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5362 r = pEnum->GetIntAt(2, allow);
5363 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5370 String protocolScheme(protocol + L":");
5372 r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
5373 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5375 if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
5377 if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
5379 r = originReplace.Replace(originScheme, "");
5380 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5382 queryUrl.Replace("%s", originReplace, 0);
5383 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5395 const Tizen::Base::String
5396 _WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
5398 if (originUri == L"" || currentUri == L"" || mime == L"")
5403 result r = E_SUCCESS;
5406 String originUrlStr = originUri;
5407 const String replaceStr = L"%s";
5409 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5410 String table(CUSTOM_CONTENT_TABLE_NAME);
5414 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5415 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5417 r = currentUri.SubString(0, found + 1, baseUri);
5418 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5420 r = db.Construct(handlerPath, "r+", null);
5421 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5423 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
5427 r = pEnum->MoveNext();
5428 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5429 r = pEnum->GetIntAt(0, allow);
5430 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5431 r = pEnum->GetStringAt(1, contentUrl);
5432 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5440 if (contentUrl != L"")
5442 r = contentUrl.Replace(replaceStr, originUrlStr, 0);
5443 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5455 _WebImpl::SetFormDataList(Eina_List* pFormDataList)
5457 __pFormDataList = pFormDataList;
5462 _WebImpl::IsFormDataWindowVisible(void) const
5464 return __isFormDataVisible;
5469 _WebImpl::ShowFormDataWindow(const Rectangle& windowRect, Evas_Object* pWebView)
5471 Rectangle rect(_CoordinateSystemUtils::InverseTransform(Rectangle(windowRect.x, windowRect.y + windowRect.height, windowRect.width, windowRect.height)));
5473 if (__isFormDataVisible)
5475 result r = __pFormDataWindow->UpdateList(__pFormDataList, rect);
5476 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5480 __pFormDataWindow.reset();
5482 std::unique_ptr<_FormDataWindow> pFormDataWindow( new (std::nothrow) _FormDataWindow());
5483 SysTryReturnResult(NID_WEB_CTRL, pFormDataWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
5485 result r = pFormDataWindow->Construct(rect, this, pWebView);
5486 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5488 r = pFormDataWindow->UpdateList(__pFormDataList, rect);
5489 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5491 r = pFormDataWindow->LaunchFormDataWindow();
5492 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5494 __pFormDataWindow = std::move(pFormDataWindow);
5495 __isFormDataVisible = true;
5503 _WebImpl::HideFormDataWindow(bool delWindow)
5507 __pFormDataWindow.reset();
5510 __isFormDataVisible = false;
5515 _WebImpl::ClearWebNotification(_WebNotification* pWebNotification)
5517 __webNotificationList.Remove(*pWebNotification);
5522 _WebImpl::SetWebNotification(_WebNotification* pWebNotification)
5524 __webNotificationList.Add(pWebNotification);
5528 }}} // Tizen::Web::Controls