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));
1686 if (pImpl->GetWebKeypadEventListener())
1688 if (pImpl->IsKeypadVisible() == true)
1690 if ((pImpl->GetPreviousKeypadBounds().width == rect.width) && (pImpl->GetPreviousKeypadBounds().height != rect.height))
1692 pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1697 pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1701 pImpl->SetPreviousKeypadBounds(rect);
1705 result r = pImpl->SetFullScreenKeypad();
1706 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1712 OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
1714 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1715 SysAssertf(pImpl, "Failed to request");
1717 pImpl->SetKeypadVisibleState(true);
1719 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1722 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1723 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1725 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(pImpl->GetPreviousKeypadBounds().height));
1727 if (pFormImpl->HasFooter())
1729 pFormImpl->GetCore().SetKeypadShowState(true);
1734 if (pImpl->GetWebKeypadEventListener())
1736 pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
1742 OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
1744 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1745 SysAssertf(pImpl, "Failed to request");
1747 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1750 pFormImpl->DeflateClientRectHeight(0);
1752 if (pFormImpl->HasFooter())
1754 pFormImpl->GetCore().SetKeypadShowState(false);
1759 if (pImpl->GetWebKeypadEventListener())
1761 pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1764 pImpl->SetKeypadVisibleState(false);
1769 OnWindowObjectFocusLost(void* pUserData, Evas_Object* pWin, void* pEvent_info)
1771 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1772 SysAssertf(pImpl, "Failed to request");
1774 pImpl->SetWinFocusLost(true);
1779 OnWindowObjectFocusGained(void* pUserData, Evas_Object* pWin, void* pEvent_info)
1781 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1782 SysAssertf(pImpl, "Failed to request");
1784 if (pImpl->IsVisible() == true && pImpl->IsFocused() == true)
1786 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1787 SysAssertf(pWebCore, "Failed to get Web core object");
1789 if (pImpl->IsWinFocusLost() == true)
1791 Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
1792 SysAssertf(pSettings, "Failed to get settings instance.");
1794 if (ewk_settings_clear_text_selection_automatically_get(pSettings) == EINA_FALSE)
1796 ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_TRUE);
1798 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1800 else if (pImpl->IsKeypadOpened() == true)
1802 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1807 pImpl->SetWinFocusLost(false);
1812 OnWebNativeNodeFocusGained(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
1814 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1815 SysAssertf(pImpl, "Failed to request");
1817 if (pImpl->IsKeypadOpened() == true)
1819 pImpl->SetKeypadOpened(false);
1821 else if (pImpl->IsWinFocusLost() == true && pImpl->IsFocused() == false)
1823 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1824 SysAssertf(pWebCore, "Failed to get Web core object");
1826 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_FALSE);
1832 OnWebNativeNodeFocusLost(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
1834 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1835 SysAssertf(pImpl, "Failed to request");
1837 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1838 SysAssertf(pWebCore, "Failed to get Web core object");
1840 Eina_Rectangle leftHandle;
1841 Eina_Rectangle rightHandle;
1843 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
1844 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
1846 if (pImpl->IsWinFocusLost() == true && ewk_view_text_selection_range_get(pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle))
1848 Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
1849 SysAssertf(pSettings, "Failed to get settings instance.");
1851 ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_FALSE);
1857 OnColorPickerProviderRequested(Ewk_View_Smart_Data* pSmartData, int red, int green, int blue, int alpha)
1859 SysAssertf(pSmartData, "invalid smartdata");
1860 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1861 SysAssertf(pWebImpl, "Failed to get Impl");
1863 result r = E_SUCCESS;
1865 if (pWebImpl->GetColorpicker())
1872 r = pWebImpl->ShowColorPicker(red, green, blue, alpha, color);
1873 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1875 byte r1, g1, b1, a1;
1876 color.GetColorComponents(r1, g1, b1, a1);
1877 ewk_view_color_picker_color_set(pSmartData->self, r1, g1, b1, a1);
1884 OnColorPickerProviderDismissed(Ewk_View_Smart_Data* pSmartData)
1886 SysAssertf(pSmartData, "invalid smartdata");
1888 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1889 SysAssertf(pWebImpl, "Failed to get Impl");
1891 return pWebImpl->HideColorPicker();
1896 OnDatePickerProviderRequested(Ewk_View_Smart_Data* pSmartData, Ewk_Input_Type inputType, const char* inputValue)
1898 SysAssertf(pSmartData, "Failed to request");
1899 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1900 SysAssertf(pWebImpl, "Failed to get Impl");
1902 result r = E_SUCCESS;
1904 if (pWebImpl->GetDatepicker())
1906 ewk_view_focused_input_element_value_set(pSmartData->self, inputValue);
1913 r = pWebImpl->ShowDatePicker(inputType, inputValue, dateStr);
1914 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1916 std::unique_ptr<char[]> pDateStr(_StringConverter::CopyToCharArrayN(dateStr));
1917 SysTryReturn(NID_WEB_CTRL, pDateStr.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1919 ewk_view_focused_input_element_value_set(pSmartData->self, pDateStr.get());
1926 OnSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, double pageScaleFactor, Eina_List* pItems, int selectedIndex)
1928 SysAssertf(pSmartData, "Failed to request");
1930 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1931 SysAssertf(pWebImpl, "Failed to get Impl");
1933 result r = pWebImpl->ShowSelectBoxPopup(false, L"", pItems, pSmartData->self, selectedIndex);
1934 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1941 OnMultiSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* pItems)
1943 SysAssertf(pSmartData, "Failed to request");
1945 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1946 SysAssertf(pWebImpl, "Failed to get Impl");
1948 result r = pWebImpl->ShowSelectBoxPopup(true, L"", pItems, pSmartData->self, 0);
1949 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1956 OnSelectBoxClosed(Ewk_View_Smart_Data* pSmartData)
1958 SysAssertf(pSmartData, "invalid smartdata");
1960 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1961 SysAssertf(pWebImpl, "Failed to get Impl");
1963 result r = pWebImpl->ClearSelectBoxPopup();
1964 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1971 OnSelectBoxUpdateRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, Eina_List* pItems, int selectedIndex)
1973 SysAssertf(pSmartData, "invalid smartdata");
1975 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1976 SysAssertf(pWebImpl, "Failed to get Impl");
1978 result r = pWebImpl->UpdateSelectBoxPopup(pItems, selectedIndex, false);
1979 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1986 OnFormDataCandidateShow(Ewk_View_Smart_Data *pSmartData, int x, int y, int w, int h)
1988 SysAssertf(pSmartData, "Failed to request");
1990 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1991 SysAssertf(pWebImpl, "Failed to get Impl");
1993 Rectangle windowRect(x, y, w, h);
1994 result r = pWebImpl->ShowFormDataWindow(windowRect, pSmartData->self);
1995 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
2002 OnFormDataCandidateHide(Ewk_View_Smart_Data *pSmartData)
2004 SysAssertf(pSmartData, "Failed to request");
2006 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2007 SysAssertf(pWebImpl, "Failed to get Impl");
2009 if (pWebImpl->IsFormDataWindowVisible())
2011 pWebImpl->HideFormDataWindow();
2019 OnFormDataCandidateUpdate(Ewk_View_Smart_Data *pSmartData, Eina_List *pDataList)
2021 SysAssertf(pSmartData, "Failed to request");
2023 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2024 SysAssertf(pWebImpl, "Failed to get Impl");
2026 pWebImpl->SetFormDataList(pDataList);
2033 OnFormDataCandidateIsShowing(Ewk_View_Smart_Data *pSmartData)
2035 SysAssertf(pSmartData, "Failed to request");
2037 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2038 SysAssertf(pWebImpl, "Failed to get Impl");
2040 if (pWebImpl->IsFormDataWindowVisible())
2052 OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
2054 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
2055 SysAssertf(pPresenter && !pError, "Failed to request");
2057 bool ret = EINA_TRUE;
2061 case EWK_COOKIE_ACCEPT_POLICY_ALWAYS:
2063 case EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY:
2067 case EWK_COOKIE_ACCEPT_POLICY_NEVER:
2076 SysLog(NID_WEB_CTRL, "The current value of policy is %d", ret);
2078 pPresenter->EndAsyncProcess(ret);
2083 OnScriptExecuted(Evas_Object* pView, const char* pResult, void* pUserData)
2085 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
2086 SysAssertf(pPresenter, "Failed to request");
2088 String result(pResult);
2089 SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
2091 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
2092 _WebManager* pWebManager = _WebManager::GetInstance();
2093 if (pWebManager->IsValidCallback(reinterpret_cast< int >(pImpl), reinterpret_cast< int >(pPresenter)))
2095 pPresenter->EndAsyncProcess(result);
2101 OnTextFound(void* pUserData, Evas_Object* pView, void* pEventInfo)
2103 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
2104 SysAssertf(pImpl, "Failed to request");
2106 int* pTotalCount = reinterpret_cast< int* >(pEventInfo);
2107 SysLog(NID_WEB_CTRL, "The current value of totalCount is %d", *pTotalCount);
2109 _WebPresenter* pWebPresenter = pImpl->GetSearchPresenter();
2113 pWebPresenter->EndAsyncProcess(*pTotalCount);
2117 if (pImpl->GetTextSearchListener())
2119 result r = E_SUCCESS;
2123 if (*pTotalCount > 0)
2125 ordinal = pImpl->GetAsyncSearchOrdinal();
2126 pImpl->SetAsyncSearchResult(*pTotalCount);
2129 if (pImpl->GetPendingAsyncSearchCount() > 0)
2134 std::unique_ptr<Integer> pCount(new (std::nothrow) Integer(*pTotalCount));
2135 std::unique_ptr<Integer> pOrdinal(new (std::nothrow) Integer(ordinal));
2136 std::unique_ptr<_TextSearchEventArg> pEventArg(new (std::nothrow) _TextSearchEventArg(WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND));
2137 SysTryReturnVoidResult(NID_WEB_CTRL, pCount.get() && pOrdinal.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2139 r = pEventArg->SetEventInfo(_TextSearchEventArg::TOTAL_COUNT, *pCount.get());
2140 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2143 r = pEventArg->SetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL, *pOrdinal.get());
2144 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2147 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
2148 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2149 pEventArg.release();
2155 class _JsBridgeHashCodeProvider
2156 : public Tizen::Base::Collection::IHashCodeProviderT< Tizen::Base::String >
2159 _JsBridgeHashCodeProvider(){}
2160 virtual ~_JsBridgeHashCodeProvider(void) {}
2163 int GetHashCode(const Tizen::Base::String& obj) const
2165 return obj.GetHashCode();
2171 //Comparer implementation
2172 class _JsBridgeComparer
2173 : public Tizen::Base::Collection::IComparerT< Tizen::Base::String >
2176 _JsBridgeComparer(){}
2177 virtual ~_JsBridgeComparer(void) {}
2180 result Compare(const Tizen::Base::String& obj1, const Tizen::Base::String& obj2, int& cmp) const
2197 _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
2198 : _ContainerImpl(pWeb, pCore)
2199 , __isFooterVisible(false)
2200 , __isKeypadVisible(false)
2201 , __isKeypadOpened(false)
2202 , __isWinFocusLost(false)
2203 , __isLoadingErrorOccurred(false)
2204 , __isRedirectRequested(false)
2205 , __isCertificateRequested(false)
2206 , __isCertificateConfirmed(false)
2207 , __isFormDataVisible(false)
2208 , __keypadBounds(0, 0, 0, 0)
2210 , __pUserLoadingListener(null)
2211 , __pUserUiListener(null)
2212 , __pUserUiListenerF(null)
2213 , __pUserKeypadEventListener(null)
2214 , __pTextSearchListener(null)
2216 , __pJsBridgeList(null)
2217 , __pJsProvider(null)
2218 , __pJsComparer(null)
2219 , __pWebDownloadHandler(null)
2221 , __pAuthChallenge(null)
2222 , __pAuthPopup(null)
2223 , __pUserMediaConfirmPopup(null)
2224 , __pContentHandlerConfirmPopup(null)
2225 , __pProtocolHandlerConfirmPopup(null)
2226 , __pGeolocationConfirmPopup(null)
2227 , __pNotificationConfirmPopup(null)
2228 , __pScriptAlertConfirmPopup(null)
2229 , __pScriptConfirmPopup(null)
2230 , __pBeforeUnloadConfirmPopup(null)
2231 , __pAppCacheConfirmPopup(null)
2232 , __pDbQuotaConfirmPopup(null)
2233 , __pLocalFsQuotaConfirmPopup(null)
2234 , __pIndexedDbQuotaConfirmPopup(null)
2235 , __pPromptPopup(null)
2236 , __pCertConfirmPopup(null)
2237 , __pSelectBox(null)
2238 , __pDatePicker(null)
2239 , __pColorPicker(null)
2240 , __pFormDataWindow(null)
2242 , __policy(WEB_DECISION_CONTINUE)
2243 , __defaultUserAgent(L"")
2244 , __pFormDataList(null)
2245 , __popupClosed(false)
2247 __textSearch.__searchAll = false;
2248 __textSearch.__searchForward = true;
2249 __textSearch.__caseSensitive = false;
2250 __textSearch.__pending = 0;
2251 __textSearch.__currentIndex = 1;
2252 __textSearch.__totalCount = -1;
2253 __textSearch.__text = L"";
2257 _WebImpl::~_WebImpl()
2259 _WebManager* pWebManager = _WebManager::GetInstance();
2260 SysTryCatch(NID_WEB_CTRL, pWebManager, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2262 pWebManager->RemoveWeb(reinterpret_cast< int >(this));
2263 pWebManager->RemoveActiveWeb(this);
2266 _SettingInfoImpl::RemoveSettingEventListener(*this);
2267 RemoveEventListenerCallback();
2268 ClearCertificateDb();
2273 _WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
2275 result r = E_SUCCESS;
2277 r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2278 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2280 _Web* pCore = _Web::CreateWebN();
2281 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2283 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2285 r = CheckConstruction(pCore, pImpl);
2286 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2288 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2289 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2291 r = pImpl->Construct();
2292 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2304 _WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
2306 result r = E_SUCCESS;
2308 r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2309 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2311 _Web* pCore = _Web::CreateWebN();
2312 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2314 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2316 r = CheckConstruction(pCore, pImpl);
2317 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2319 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2320 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2322 r = pImpl->Construct();
2323 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2335 _WebImpl::Construct(void)
2337 result r = E_SUCCESS;
2339 r = __mutex.Create();
2340 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2342 r = __textSearch.__searchQueue.Construct();
2343 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2345 r = __webNotificationList.Construct();
2346 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2348 r = InitJsBridgeList();
2349 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2352 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2354 __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
2355 SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
2362 _WebImpl::InitializeSetting(void)
2364 result r = E_SUCCESS;
2366 WebSetting* pWebSetting = __pWebCore->GetSetting();
2367 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(pWebSetting);
2369 SetCookieEnabled(pWebSettingImpl->IsCookieEnabled());
2370 SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
2372 __defaultUserAgent = pWebSettingImpl->GetUserAgent();
2374 r = SetSetting(*pWebSetting);
2375 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2377 SetEventListenerCallback();
2384 _WebImpl::IsLayoutable(void) const
2391 _WebImpl::InitWebEvent(void)
2393 __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
2394 SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2396 return __pWebEvent->Construct(*this);
2401 _WebImpl::GetWebEvent(void) const
2403 return __pWebEvent.get();
2408 _WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
2410 Eina_Hash* pHttpHeader = null;
2412 std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
2413 if (pFieldNameList.get())
2415 pHttpHeader = eina_hash_string_small_new(FreeCharArray);
2416 SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2418 int count = pFieldNameList->GetCount();
2420 for (int i = 0; i < count; i++)
2422 String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
2423 SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2425 std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
2426 SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2428 std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
2429 SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2431 while (pFieldValueEnum->MoveNext() == E_SUCCESS)
2433 Eina_Bool ret = false;
2435 String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
2436 SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2438 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
2439 SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2441 ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
2442 SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2449 eina_hash_free(pHttpHeader);
2456 _WebImpl::LoadUrl(const String& url) const
2458 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2459 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2461 ewk_view_url_set(__pWebCore->GetWebNativeNode(), pUrl.get());
2468 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
2470 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2471 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2473 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2475 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
2477 eina_hash_free(pHttpHeader);
2484 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
2486 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2487 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2489 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2491 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
2493 eina_hash_free(pHttpHeader);
2500 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
2502 SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
2504 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
2505 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2506 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
2507 SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2509 ewk_view_contents_set(__pWebCore->GetWebNativeNode(), reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
2516 _WebImpl::Pause(void)
2518 ewk_view_suspend(__pWebCore->GetWebNativeNode());
2523 _WebImpl::Resume(void)
2525 ewk_view_resume(__pWebCore->GetWebNativeNode());
2530 _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
2532 __pSelectBox.reset();
2534 SysTryReturnResult(NID_WEB_CTRL, eina_list_count(pItems) > 0, E_SYSTEM, "ItemCount is invalid.");
2536 result r = E_SUCCESS;
2538 std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
2539 SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2543 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT - 1, pWebView);
2547 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
2549 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2551 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2552 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2554 __pSelectBox = std::move(pSelectBox);
2556 return __pSelectBox->ShowPopup();
2561 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2563 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2565 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2570 _WebImpl::ClearSelectBoxPopup(void)
2572 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2574 __pSelectBox.reset();
2583 _WebImpl::GetDatepicker(void)
2585 _InputPickerPopup* pInputPicker =null;
2588 pInputPicker = __pDatePicker.get();
2590 return pInputPicker;
2595 _WebImpl::GetColorpicker(void)
2597 _InputPickerPopup* pInputPicker =null;
2600 pInputPicker = __pColorPicker.get();
2602 return pInputPicker;
2607 _WebImpl::CanGoBack(void) const
2609 return static_cast< bool >(ewk_view_back_possible(__pWebCore->GetWebNativeNode()));
2614 _WebImpl::CanGoForward(void) const
2616 return static_cast< bool >(ewk_view_forward_possible(__pWebCore->GetWebNativeNode()));
2621 _WebImpl::GoBack(void) const
2623 ewk_view_back(__pWebCore->GetWebNativeNode());
2628 _WebImpl::GoForward(void) const
2630 ewk_view_forward(__pWebCore->GetWebNativeNode());
2635 _WebImpl::GetUrl(void) const
2637 return ewk_view_url_get(__pWebCore->GetWebNativeNode());
2642 _WebImpl::GetTitle(void) const
2644 return ewk_view_title_get(__pWebCore->GetWebNativeNode());
2649 _WebImpl::StopLoading(void) const
2651 ewk_view_stop(__pWebCore->GetWebNativeNode());
2656 _WebImpl::Reload(void) const
2658 ewk_view_reload(__pWebCore->GetWebNativeNode());
2663 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
2665 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2671 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2672 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2674 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2675 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2677 ewk_view_script_execute(pView, pScript.get(), OnScriptExecuted, pPresenter.get());
2679 String* pResult = new (std::nothrow) String(L"");
2680 SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2682 pPresenter->WaitAsyncProcess(*pResult);
2689 _WebImpl::SetZoomLevel(float level)
2691 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);
2693 ewk_view_scale_set(__pWebCore->GetWebNativeNode(), static_cast< double >(level), 0, 0);
2700 _WebImpl::GetZoomLevel(void) const
2702 return static_cast< float >(ewk_view_scale_get(__pWebCore->GetWebNativeNode()));
2706 const PageNavigationList*
2707 _WebImpl::GetBackForwardListN(void) const
2709 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2715 result r = E_SUCCESS;
2717 _PageNavigationListImpl* pNavigationListImpl = null;
2718 _HistoryItemImpl* pHistoryItemImpl = null;
2720 std::unique_ptr<PageNavigationList> pNavigationList;
2721 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2724 int forwardCount = 0;
2729 Ewk_History* pEwkHistoryList = ewk_view_history_get(pView);
2730 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2732 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2733 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2735 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2736 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2738 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2739 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2741 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2742 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2744 r = pHistoryList->Construct();
2745 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2747 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2748 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2749 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2751 for (int i = -backCount; i < forwardCount + 1; i++)
2753 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2754 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2756 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2757 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2759 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2760 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2762 url = ewk_history_item_uri_get(pEwkItem);
2763 title = ewk_history_item_title_get(pEwkItem);
2764 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2766 pHistoryItemImpl->SetHistoryItem(url, title);
2768 r = pHistoryList->Add(*pHistoryItem.get());
2769 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2770 pHistoryItem.release();
2773 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2775 ewk_history_free(pEwkHistoryList);
2777 return pNavigationList.release();
2780 ewk_history_free(pEwkHistoryList);
2787 _WebImpl::SearchText(const String& text, bool searchForward)
2789 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2795 result r = E_SUCCESS;
2797 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2801 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2804 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2805 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2807 r = SynchronizeSearch(SEARCH_SYNC, pView, condition, text, searchForward, false, pPresenter.get());
2808 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
2811 pPresenter->WaitAsyncProcess(result);
2813 return static_cast < bool >(result);
2818 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2820 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2826 result r = E_SUCCESS;
2828 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2832 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2835 r = SynchronizeSearch(SEARCH_ALL_ASYNC, pView, condition, text, true, caseSensitive);
2836 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2843 _WebImpl::SearchNextAsync(bool searchForward)
2845 Evas_Object* pView = __pWebCore->GetWebNativeNode();
2851 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2852 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2853 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2855 result r = E_SUCCESS;
2857 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2859 if (!__textSearch.__caseSensitive)
2861 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2866 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2869 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pView, condition, __textSearch.__text, searchForward);
2870 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2877 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
2879 MutexGuard lock(__mutex);
2881 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
2882 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2887 if (__textSearch.__searchAll)
2889 DisableAsyncSearch();
2891 __textSearch.__searchQueue.Enqueue(this);
2892 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2894 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2895 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2899 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2901 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2905 case SEARCH_ALL_ASYNC:
2906 __textSearch.__searchAll = true;
2907 __textSearch.__text = text;
2908 __textSearch.__searchForward = true;
2909 __textSearch.__caseSensitive = caseSensitive;
2910 __textSearch.__totalCount = -1;
2911 __textSearch.__currentIndex = 1;
2913 __textSearch.__searchQueue.Enqueue(this);
2914 __textSearch.__searchQueue.Enqueue(this);
2916 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2917 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2920 case SEARCH_NEXT_ASYNC:
2921 __textSearch.__searchForward = searchForward;
2923 CalculateAsyncSearchOrdinal();
2925 __textSearch.__searchQueue.Enqueue(this);
2927 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2939 _WebImpl::SetAsyncSearchResult(int totalCount)
2941 __textSearch.__totalCount = totalCount;
2946 _WebImpl::GetSearchPresenter(void)
2948 MutexGuard lock(__mutex);
2950 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
2955 _WebImpl::GetPendingAsyncSearchCount(void) const
2957 return __textSearch.__searchQueue.GetCount();
2962 _WebImpl::CalculateAsyncSearchOrdinal(void)
2964 if (__textSearch.__searchForward)
2966 __textSearch.__currentIndex++;
2970 __textSearch.__currentIndex--;
2976 _WebImpl::GetAsyncSearchOrdinal(void) const
2978 return __textSearch.__currentIndex;
2983 _WebImpl::DisableAsyncSearch(void)
2985 __textSearch.__searchAll = false;
2990 _WebImpl::SetSetting(const WebSetting& setting)
2992 if (__pWebCore->GetWebNativeNode())
2994 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2995 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
2996 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
2998 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
2999 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3001 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
3003 switch (setting.GetCacheControl())
3005 case WEB_CACHE_VALIDATED:
3006 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
3009 case WEB_CACHE_IGNORE:
3010 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
3017 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
3019 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
3023 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
3026 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
3028 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
3030 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
3032 if (__defaultUserAgent != setting.GetUserAgent())
3034 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
3035 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3037 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
3040 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
3042 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
3044 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
3046 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
3049 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
3051 pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
3052 pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
3053 pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
3054 pWebSettingImpl->SetFontSize(setting.GetFontSize());
3055 pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
3056 pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
3057 pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
3058 pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
3059 pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
3060 pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
3061 pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
3062 pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
3063 pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
3070 _WebImpl::GetSetting(void) const
3072 return *__pWebCore->GetSetting();
3076 const HitElementResult*
3077 _WebImpl::GetElementByPointN(const Point& point) const
3079 return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
3083 const HitElementResult*
3084 _WebImpl::GetElementByPointN(const FloatPoint& point) const
3086 Evas_Object* pView = __pWebCore->GetWebNativeNode();
3092 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));
3094 result r = E_SUCCESS;
3096 _HitElementResultImpl* pHitElementResultImpl = null;
3098 std::unique_ptr<HitElementResult> pHitElementResult;
3099 std::unique_ptr<Bitmap> pImage;
3100 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
3102 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
3104 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pView, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3105 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
3107 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3108 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
3109 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
3110 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3111 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
3113 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
3115 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
3116 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3118 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
3119 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3121 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
3127 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
3128 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
3129 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
3130 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
3132 r = buf.Construct(imageLength);
3133 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3135 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
3136 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3140 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
3141 // webkit support types such as ico and vp8 additionally
3142 if (strcmp(pExtension, "gif") == 0)
3144 format = IMG_FORMAT_GIF;
3146 else if (strcmp(pExtension, "jpg") == 0)
3148 format = IMG_FORMAT_JPG;
3150 else if (strcmp(pExtension, "png") == 0)
3152 format = IMG_FORMAT_PNG;
3154 else if (strcmp(pExtension, "bmp") == 0)
3156 format = IMG_FORMAT_BMP;
3160 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
3164 r = image.Construct();
3165 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3167 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
3168 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3173 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
3174 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3176 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
3177 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3179 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
3180 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3183 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
3185 ewk_hit_test_free(pEwkHitTest);
3187 return pHitElementResult.release();
3190 ewk_hit_test_free(pEwkHitTest);
3197 _WebImpl::IsLoading(void) const
3199 double percent = ewk_view_load_progress_get(__pWebCore->GetWebNativeNode());
3201 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
3213 _WebImpl::GetTextFromBlock(void) const
3215 return ewk_view_text_selection_text_get(__pWebCore->GetWebNativeNode());
3220 _WebImpl::IsPrivateBrowsingEnabled(void) const
3222 if (__pWebCore->GetWebNativeNode() == null)
3224 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
3227 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3228 SysAssertf(pSettings, "Failed to get webkit instance.");
3230 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
3235 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
3237 if (__pWebCore->GetWebNativeNode() == null)
3239 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
3243 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3244 SysAssertf(pSettings, "Failed to get webkit instance.");
3246 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
3251 _WebImpl::ClearHistory(void)
3253 ewk_view_back_forward_list_clear(__pWebCore->GetWebNativeNode());
3258 _WebImpl::ClearCache(void)
3260 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3262 ewk_context_cache_clear(pContext);
3267 _WebImpl::ClearCookie(void)
3269 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3270 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3272 ewk_cookie_manager_cookies_clear(pCookieManager);
3277 _WebImpl::ClearFormData(void)
3279 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3281 ewk_context_form_candidate_data_clear(pContext);
3286 _WebImpl::ClearLoginFormData(void)
3288 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3290 ewk_context_form_password_data_clear(pContext);
3295 _WebImpl::IsCookieEnabled(void) const
3297 if (__pWebCore->GetWebNativeNode() == null)
3299 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
3302 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3303 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3304 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3306 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
3307 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3309 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, pPresenter.get());
3311 bool result = false;
3312 pPresenter->WaitAsyncProcess(result);
3319 _WebImpl::SetCookieEnabled(bool enable)
3321 if (__pWebCore->GetWebNativeNode() == null)
3323 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
3328 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3329 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3330 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3334 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
3338 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
3339 ewk_cookie_manager_cookies_clear(pCookieManager);
3345 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
3347 result r = E_SUCCESS;
3349 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
3350 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3353 String fileExtension = File::GetFileExtension(filePath);
3354 int pathLength = filePath.GetLength();
3357 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
3359 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
3360 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3361 r = filePath.SubString(0, index + 1, dirPath);
3362 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3364 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
3365 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
3369 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
3371 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), pSize->width, pSize->height, pFilePath.get());
3375 Evas_Coord contentsWidth;
3376 Evas_Coord contentsHeight;
3378 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &contentsWidth, &contentsHeight);
3379 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), contentsWidth, contentsHeight, pFilePath.get());
3387 _WebImpl::IsMimeSupported(const String& mime) const
3389 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
3390 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3392 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(__pWebCore->GetWebNativeNode()), pMime.get()));
3397 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
3399 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
3404 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
3406 __pUserUiListener = pUiEventListener;
3411 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
3413 __pUserUiListenerF = pUiEventListener;
3418 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
3420 __pUserKeypadEventListener = pKeypadEventListener;
3425 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
3427 if (__pWebDownloadHandler.get() == null)
3429 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
3430 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3433 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
3434 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
3439 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
3441 __pTextSearchListener = pTextSearchListener;
3446 _WebImpl::SetScrollEnabled(bool enable)
3448 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
3453 _WebImpl::IsScrollEnabled(void) const
3455 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
3460 _WebImpl::InitJsBridgeList(void)
3462 result r = E_SUCCESS;
3464 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
3465 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3467 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
3468 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3470 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
3471 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3473 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
3474 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3476 __pJsBridgeList = std::move(pJsBridgeList);
3483 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3485 result r = E_SUCCESS;
3487 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3488 String key(pJsBridge->GetName());
3490 r = __pJsBridgeList->Add(key, pJsBridge);
3491 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3498 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3500 result r = E_SUCCESS;
3502 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3503 String key(pJsBridge->GetName());
3505 r = __pJsBridgeList->Remove(key);
3506 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3513 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3515 result r = E_SUCCESS;
3517 IJsonValue* pJsonValue = null;
3518 IJavaScriptBridge* pJsBridge = null;
3520 String key(L"name");
3522 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3523 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));
3525 r = pJsonObject->GetValue(&key, pJsonValue);
3526 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3528 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3529 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3531 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3532 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3539 _WebImpl::GetLoadingListener(void) const
3541 return __pUserLoadingListener;
3545 IWebUiEventListener*
3546 _WebImpl::GetUiEventListener(void) const
3548 return __pUserUiListener;
3552 IWebUiEventListenerF*
3553 _WebImpl::GetUiEventListenerF(void) const
3555 return __pUserUiListenerF;
3559 IWebKeypadEventListener*
3560 _WebImpl::GetWebKeypadEventListener(void) const
3562 return __pUserKeypadEventListener;
3566 ITextSearchListener*
3567 _WebImpl::GetTextSearchListener(void) const
3569 return __pTextSearchListener;
3574 _WebImpl::SetEventListenerCallback(void) const
3576 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3579 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3580 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3582 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3583 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3585 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3586 SysAssertf(pSmartData, "Failed to request");
3588 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3589 SysAssertf(pSmart, "Failed to request");
3591 pSmart->popup_menu_show = OnSelectBoxRequested;
3592 pSmart->multiple_popup_menu_show = OnMultiSelectBoxRequested;
3593 pSmart->popup_menu_hide = OnSelectBoxClosed;
3594 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3596 pSmart->input_picker_show = OnDatePickerProviderRequested;
3597 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3598 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3600 pSmart->formdata_candidate_show = OnFormDataCandidateShow;
3601 pSmart->formdata_candidate_hide = OnFormDataCandidateHide;
3602 pSmart->formdata_candidate_update_data = OnFormDataCandidateUpdate;
3603 pSmart->formdata_candidate_is_showing = OnFormDataCandidateIsShowing;
3605 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3607 // add loading event callbacks for ILoadingListener
3608 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3609 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3611 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3612 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3613 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3614 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3615 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3616 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3617 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3618 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3619 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3621 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3623 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3624 evas_object_smart_callback_add(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3626 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3627 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3628 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3630 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3631 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3633 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3635 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3636 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3637 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3638 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, OnBeforeUnloadConfirmRequested, const_cast< _WebImpl* >(this));
3640 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3642 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3643 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3644 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3646 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3647 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3648 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3650 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3651 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3652 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3654 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3655 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3656 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3657 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3659 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3660 evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
3662 evas_object_smart_callback_add(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected, this);
3664 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
3665 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
3667 evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
3668 evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
3670 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3671 SysAssertf(pContext, "Failed to get webkit instance.");
3672 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3673 ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
3675 ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
3676 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3677 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3678 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
3680 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3681 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost, this);
3687 _WebImpl::RemoveEventListenerCallback(void) const
3689 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3692 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3693 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3695 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3696 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3698 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3699 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3701 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3702 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3703 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3704 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3705 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3706 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3707 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3708 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3709 evas_object_smart_callback_del(pWebNativeNode, "load,committed", OnLoadingCommitted);
3711 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3713 evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3714 evas_object_smart_callback_del_full(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3716 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3717 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3718 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3720 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3721 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3723 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3725 ewk_view_javascript_alert_callback_set(pWebNativeNode, null, null);
3726 ewk_view_javascript_prompt_callback_set(pWebNativeNode, null, null);
3727 ewk_view_javascript_confirm_callback_set(pWebNativeNode, null, null);
3728 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, null, null);
3730 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3732 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3733 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3734 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3736 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3737 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3738 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3739 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3740 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3741 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3743 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3744 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3745 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3747 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3749 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3750 evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
3752 evas_object_smart_callback_del(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected);
3754 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
3755 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
3757 evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
3758 evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
3760 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3761 SysAssertf(pContext, "Failed to get webkit instance.");
3762 ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
3764 ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
3765 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
3766 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
3767 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
3769 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3770 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost);
3776 _WebImpl::ClearCertificateDb(void)
3778 result r = E_SUCCESS;
3780 String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
3781 String table(CERTIFICATE_TABLE_NAME);
3784 r = db.Construct(certificatePath, "r+", null);
3785 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3787 db.BeginTransaction();
3789 r = db.ExecuteSql(L"Delete From " + table, true);
3790 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3792 db.CommitTransaction();
3797 db.RollbackTransaction();
3802 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3804 return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
3809 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
3811 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3817 Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pWebview));
3818 SysAssertf(pSmartData && pSmartData->api, "Failed to get webkit instance.");
3819 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
3821 Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3824 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3826 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3827 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
3829 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3831 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3832 char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
3833 if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
3835 ewk_view_command_execute(pWebview, "SelectWord", 0);
3836 evas_object_smart_callback_call(pWebview, "magnifier,hide", NULL);
3840 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
3847 _WebImpl::ReleaseBlock(void)
3849 ewk_view_text_selection_range_clear(__pWebCore->GetWebNativeNode());
3854 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
3856 FloatPoint tempStartPoint;
3857 FloatPoint tempEndPoint;
3859 GetBlockRange(tempStartPoint, tempEndPoint);
3861 startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
3862 endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
3867 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
3869 Eina_Rectangle leftHandle;
3870 Eina_Rectangle rightHandle;
3872 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
3873 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
3875 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
3877 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
3878 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
3879 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
3880 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
3882 if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
3884 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
3885 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
3891 _WebImpl::GetFaviconN(void) const
3893 result r = E_SUCCESS;
3895 Evas_Object* pView = __pWebCore->GetWebNativeNode();
3896 Ewk_Context* pContext = ewk_view_context_get(pView);
3897 const char* pUrl = ewk_view_url_get(pView);
3898 Evas* pEvas = evas_object_evas_get(pView);
3900 Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
3906 Tizen::Graphics::BufferInfo bufferInfo;
3908 r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
3909 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3911 const Dimension dimension(bufferInfo.width, bufferInfo.height);
3912 Tizen::Base::ByteBuffer byteBuffer;
3914 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
3915 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3917 std::unique_ptr<Bitmap> pImage(new (std::nothrow) Bitmap());
3918 SysTryReturn(NID_WEB_CTRL, pImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3920 r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
3921 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3923 return pImage.release();
3929 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
3931 ewk_view_scroll_by(__pWebCore->GetWebNativeNode(), diff.x, diff.y);
3936 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
3938 ewk_view_scroll_set(__pWebCore->GetWebNativeNode(), dest.x, dest.y);
3943 _WebImpl::GetScrollPosition(void) const
3947 ewk_view_scroll_pos_get(__pWebCore->GetWebNativeNode(), &position.x, &position.y);
3954 _WebImpl::GetPageSize(void) const
3956 Evas_Coord width = 0;
3957 Evas_Coord height = 0;
3959 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &width, &height);
3961 Dimension size(static_cast< int >(width), static_cast< int >(height));
3968 _WebImpl::AddHttpHeaderField(const String& name, const String& value)
3970 SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
3972 std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
3973 SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3975 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(value));
3977 ewk_view_custom_header_add(__pWebCore->GetWebNativeNode(), pName.get(), pValue.get());
3984 _WebImpl::RemoveHttpHeaderField(const String& name)
3986 SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
3988 std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
3989 SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3991 ewk_view_custom_header_remove(__pWebCore->GetWebNativeNode(), pName.get());
3998 _WebImpl::SetLoadingErrorOccurred(bool arg)
4000 __isLoadingErrorOccurred = arg;
4005 _WebImpl::IsLoadingErrorOccurred(void) const
4007 return __isLoadingErrorOccurred;
4012 _WebImpl::SetRedirectRequested(bool arg)
4014 __isRedirectRequested = arg;
4019 _WebImpl::IsRedirectRequested(void) const
4021 return __isRedirectRequested;
4026 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
4033 _WebImpl::GetPolicyDecision(void) const
4040 _WebImpl::SetCertificateRequested(bool arg)
4042 __isCertificateRequested = arg;
4047 _WebImpl::IsCertificateRequested(void) const
4049 return __isCertificateRequested;
4054 _WebImpl::SetCertificateConfirmed(bool arg)
4056 __isCertificateConfirmed = arg;
4061 _WebImpl::IsCertificateConfirmed(void) const
4063 return __isCertificateConfirmed;
4068 _WebImpl::SetFullScreenKeypad(void)
4070 result r = E_SUCCESS;
4072 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
4073 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4075 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
4076 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4078 String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
4079 pKeypad->SetText(text);
4081 r = pKeypad->SetShowState(true);
4082 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4084 r = pKeypad->Show();
4085 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4087 pKeypad->AddTextEventListener(*this);
4089 __pKeypad = std::move(pKeypad);
4096 _WebImpl::RemoveFullScreenKeypad(void)
4098 __pKeypad->RemoveTextEventListener(*this);
4105 _WebImpl::IsFooterVisible(void) const
4107 return __isFooterVisible;
4112 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
4114 __isFooterVisible = isFooterVisible;
4119 _WebImpl::IsKeypadVisible(void) const
4121 return __isKeypadVisible;
4126 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
4128 __isKeypadVisible = isKeypadVisible;
4133 _WebImpl::IsKeypadOpened(void) const
4135 return __isKeypadOpened;
4139 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
4141 __isKeypadOpened = isKeypadOpened;
4146 _WebImpl::IsWinFocusLost(void) const
4148 return __isWinFocusLost;
4153 _WebImpl::SetWinFocusLost(bool isWinFocusLost)
4155 __isWinFocusLost = isWinFocusLost;
4160 _WebImpl::GetPreviousKeypadBounds(void) const
4162 return __keypadBounds;
4167 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
4169 __keypadBounds = bounds;
4174 _WebImpl::OnTextValueChangeCanceled(const Control& source)
4176 RemoveFullScreenKeypad();
4181 _WebImpl::OnTextValueChanged(const Control& source)
4183 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
4185 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
4187 RemoveFullScreenKeypad();
4192 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
4194 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
4195 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
4197 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
4198 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4200 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
4201 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
4203 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
4210 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
4212 result r = E_SUCCESS;
4214 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
4215 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4217 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4219 ILoadingListener* pLoadingListner = GetLoadingListener();
4220 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
4222 switch (pEventArg->GetEventType())
4224 case WEB_EVENT_LOADINGLISTENER_STARTED:
4226 pLoadingListner->OnLoadingStarted();
4230 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
4232 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
4233 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4235 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
4239 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
4241 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
4242 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4244 pLoadingListner->OnPageTitleReceived(*pPageTitle);
4248 case WEB_EVENT_LOADINGLISTENER_CANCELED:
4250 pLoadingListner->OnLoadingCanceled();
4254 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
4256 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
4257 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4259 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
4260 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4262 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
4264 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
4268 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
4270 pLoadingListner->OnLoadingCompleted();
4274 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
4276 pLoadingListner->OnHttpAuthenticationCanceled();
4280 case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
4282 std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
4283 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4287 pLoadingListner->OnFaviconReceived(*pFavicon.get());
4303 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
4305 result r = E_SUCCESS;
4307 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
4308 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4310 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4312 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
4313 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
4315 switch (pEventArg->GetEventType())
4317 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
4319 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
4320 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4322 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
4326 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
4328 pWebDownloadListener->OnWebDataDownloadCompleted();
4332 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
4334 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
4335 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4337 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
4339 pWebDownloadListener->OnWebDownloadFailed(errorType);
4354 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
4356 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4357 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4359 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4361 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4363 switch (pEventArg->GetEventType())
4365 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
4367 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4369 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4370 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4372 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4373 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4375 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4379 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
4381 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4383 __pUserUiListener->OnWebPageShowRequested(*pWeb);
4387 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
4389 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4391 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
4395 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
4397 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4399 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4400 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4402 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4417 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
4419 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4420 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4422 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4424 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4426 switch (pEventArg->GetEventType())
4428 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
4430 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4432 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4433 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4435 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4436 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4438 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4442 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
4444 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4446 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
4450 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
4452 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4454 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
4458 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
4460 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4462 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4463 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4465 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4480 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
4482 result r = E_SUCCESS;
4484 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
4485 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4487 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4489 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
4490 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
4492 switch (pEventArg->GetEventType())
4494 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4496 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4497 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4499 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4500 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4502 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4517 _WebImpl::VibrationRequested(uint64_t duration)
4519 result r = E_SUCCESS;
4521 __pVibrator.reset();
4523 std::unique_ptr<_VibratorImpl> pVibrator(new (std::nothrow) _VibratorImpl);
4524 SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4526 r = pVibrator->Construct();
4527 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4529 __pVibrator = std::move(pVibrator);
4531 IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
4533 r = __pVibrator->Start(&pattern, 1, 1);
4534 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4541 _WebImpl::VibrationCanceled(void)
4543 __pVibrator.reset();
4548 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4550 result r = E_SUCCESS;
4552 String host(ewk_auth_challenge_url_get(pChallenge));
4553 String realm(ewk_auth_challenge_realm_get(pChallenge));
4555 __pAuthChallenge.reset();
4557 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4558 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4560 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4561 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4563 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4564 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4566 __pAuthChallenge = std::move(pAuthChallenge);
4568 ewk_auth_challenge_suspend(pChallenge);
4569 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4571 __pAuthChallenge.release();
4575 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4576 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4584 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4586 result r = E_SUCCESS;
4588 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4589 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4591 r = pAuthPopup->Construct(host, realm, pAuthChallenge);
4592 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4594 __pAuthPopup = std::move(pAuthPopup);
4596 int modalResult = 0;
4598 r = __pAuthPopup->ShowAndWait(modalResult);
4599 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4604 __pAuthPopup.reset();
4612 _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
4614 result r = E_SUCCESS;
4616 std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
4617 SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4619 r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
4620 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4622 __pCertConfirmPopup = std::move(pCertConfirmPopup);
4624 int modalResult = 0;
4626 r = __pCertConfirmPopup->ShowAndWait(modalResult);
4627 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4629 if (__pCertConfirmPopup.get() && userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
4631 __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
4635 if (__pCertConfirmPopup.get())
4637 __pCertConfirmPopup.reset();
4645 _WebImpl::ShowPromptPopup(String msg, String defVal)
4647 result r = E_SUCCESS;
4649 std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
4650 SysTryReturnResult(NID_WEB_CTRL, pPromptPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4652 r = pPromptPopup->Construct(msg, defVal, __pWebCore->GetWebNativeNode(), this);
4653 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4655 __pPromptPopup = std::move(pPromptPopup);
4657 r = __pPromptPopup->ShowPopup();
4658 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4663 __pPromptPopup.reset();
4671 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4673 result r = E_SUCCESS;
4675 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4676 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4678 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, true, msg);
4679 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4681 int modalResult = 0;
4683 switch(userConfirmMode)
4685 case USER_CONTENT_HANDLER:
4687 __pContentHandlerConfirmPopup = std::move(pUserConfirmPopup);
4689 r = __pContentHandlerConfirmPopup->ShowAndWait(modalResult);
4690 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pContentHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4692 __pContentHandlerConfirmPopup.reset();
4694 ewk_view_resume(__pWebCore->GetWebNativeNode());
4698 case USER_PROTOCOL_HANDLER:
4700 __pProtocolHandlerConfirmPopup = std::move(pUserConfirmPopup);
4702 r = __pProtocolHandlerConfirmPopup->ShowAndWait(modalResult);
4703 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pProtocolHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4705 __pProtocolHandlerConfirmPopup.reset();
4707 ewk_view_resume(__pWebCore->GetWebNativeNode());
4711 case USER_CONFIRM_APP_CACHE:
4713 __pAppCacheConfirmPopup = std::move(pUserConfirmPopup);
4715 r = __pAppCacheConfirmPopup->ShowAndWait(modalResult);
4716 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pAppCacheConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4718 __pAppCacheConfirmPopup.reset();
4720 ewk_view_resume(__pWebCore->GetWebNativeNode());
4724 case USER_CONFIRM_DB_QUOTA_EXCEDED:
4726 __pDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4728 r = __pDbQuotaConfirmPopup->ShowAndWait(modalResult);
4729 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4731 __pDbQuotaConfirmPopup.reset();
4733 ewk_view_resume(__pWebCore->GetWebNativeNode());
4737 case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
4739 __pLocalFsQuotaConfirmPopup = std::move(pUserConfirmPopup);
4741 r = __pLocalFsQuotaConfirmPopup->ShowAndWait(modalResult);
4742 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pLocalFsQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4744 __pLocalFsQuotaConfirmPopup.reset();
4746 ewk_view_resume(__pWebCore->GetWebNativeNode());
4750 case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
4752 __pIndexedDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4754 r = __pIndexedDbQuotaConfirmPopup->ShowAndWait(modalResult);
4755 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4757 __pIndexedDbQuotaConfirmPopup.reset();
4759 ewk_view_resume(__pWebCore->GetWebNativeNode());
4772 _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4774 result r = E_SUCCESS;
4776 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4777 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4779 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, false, msg);
4780 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4782 switch(userConfirmMode)
4784 case USER_CONFIRM_USERMEDIA:
4786 __pUserMediaConfirmPopup.reset();
4788 __pUserMediaConfirmPopup = std::move(pUserConfirmPopup);
4790 r = __pUserMediaConfirmPopup->ShowPopup();
4791 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pUserMediaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4795 case USER_CONFIRM_GEOLOCATION:
4797 __pGeolocationConfirmPopup.reset();
4799 __pGeolocationConfirmPopup = std::move(pUserConfirmPopup);
4801 r = __pGeolocationConfirmPopup->ShowPopup();
4802 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pGeolocationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4806 case USER_CONFIRM_NOTIFICATION:
4808 __pNotificationConfirmPopup.reset();
4810 __pNotificationConfirmPopup = std::move(pUserConfirmPopup);
4812 r = __pNotificationConfirmPopup->ShowPopup();
4813 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pNotificationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4817 case USER_SCRIPT_ALERT:
4819 __pScriptAlertConfirmPopup.reset();
4821 __pScriptAlertConfirmPopup = std::move(pUserConfirmPopup);
4823 r = __pScriptAlertConfirmPopup->ShowPopup();
4824 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptAlertConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4828 case USER_SCRIPT_CONFIRM:
4830 __pScriptConfirmPopup.reset();
4832 __pScriptConfirmPopup = std::move(pUserConfirmPopup);
4834 r = __pScriptConfirmPopup->ShowPopup();
4835 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4839 case USER_BEFORE_UNLOAD_CONFIRM:
4841 __pBeforeUnloadConfirmPopup.reset();
4843 __pBeforeUnloadConfirmPopup = std::move(pUserConfirmPopup);
4845 r = __pBeforeUnloadConfirmPopup->ShowPopup();
4846 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pBeforeUnloadConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4862 _WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl)
4865 _FormImpl* pFormImpl = null;
4867 _ControlImpl* pParentControlImpl = dynamic_cast< _ControlImpl* >(pControlImpl->GetParent());
4868 if (!pParentControlImpl)
4873 pFormImpl = dynamic_cast< _FormImpl* >(pParentControlImpl);
4879 return GetParentFormImpl(pParentControlImpl);
4884 _WebImpl::OnFocusGained(const _ControlImpl& source)
4891 _WebImpl::OnFocusLost(const _ControlImpl& source)
4893 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4899 if(IsKeypadVisible() == true)
4901 SetKeypadOpened(true);
4909 _WebImpl::HasValidNativeNode(void) const
4911 if (__pWebCore && __pWebCore->GetWebNativeNode())
4921 _WebImpl::OnPreAttachedToMainTree(void)
4923 result r = E_SUCCESS;
4925 if (IsVisible() == true)
4927 _WebManager* pWebManager = _WebManager::GetInstance();
4928 pWebManager->SetActiveWeb(this);
4931 r = _ContainerImpl::OnPreAttachedToMainTree();
4932 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4934 if (!HasValidNativeNode())
4936 r = __pWebCore->InitializeWebNativeNode();
4937 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4939 _ControlManager* pControlManager = _ControlManager::GetInstance();
4940 SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the ControlManager instance.");
4941 OnChangeLayout(pControlManager->GetScreenRotation());
4943 r = InitializeSetting();
4944 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4946 _SettingInfoImpl::AddSettingEventListener(*this);
4948 _WebManager* pWebManager = _WebManager::GetInstance();
4949 pWebManager->AddWeb(reinterpret_cast< int >(this));
4957 _WebImpl::OnDetachingFromMainTree(void)
4959 result r = E_SUCCESS;
4961 _WebManager* pWebManager = _WebManager::GetInstance();
4962 pWebManager->RemoveActiveWeb(this);
4964 r = _ContainerImpl::OnDetachingFromMainTree();
4965 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4972 _WebImpl::OnSettingChanged(String& key)
4974 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4980 if (key == L"http://tizen.org/setting/font.type")
4982 ewk_view_use_settings_font(pWebview);
4988 _WebImpl::OnChangeLayout(_ControlRotation rotation)
4990 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5000 case _CONTROL_ROTATION_0:
5003 case _CONTROL_ROTATION_90:
5006 case _CONTROL_ROTATION_180:
5009 case _CONTROL_ROTATION_270:
5015 ewk_view_orientation_send(pWebview, degree);
5020 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
5022 _ContainerImpl::OnChangeLayout(orientation);
5024 if (__pColorPicker.get())
5026 __pColorPicker->ChangeLayout(orientation);
5029 HideFormDataWindow();
5031 std::unique_ptr< IEnumerator > pEnum(__webNotificationList.GetEnumeratorN());
5032 _WebNotification* pWebNotification = null;
5034 while (pEnum->MoveNext() == E_SUCCESS)
5036 pWebNotification = static_cast< _WebNotification* >(pEnum->GetCurrent());
5037 pWebNotification->OnChangeLayout();
5040 if (IsKeypadVisible())
5042 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
5043 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
5045 _FormImpl* pFormImpl = GetParentFormImpl(dynamic_cast< _ControlImpl* >(this));
5046 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(GetPreviousKeypadBounds().height));
5052 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
5054 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5060 _WebManager* pWebManager = _WebManager::GetInstance();
5061 if (IsVisible() == true)
5063 pWebManager->SetActiveWeb(this);
5064 ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
5068 pWebManager->RemoveActiveWeb(this);
5069 ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
5075 _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
5077 _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
5081 case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
5082 __pCertConfirmPopup.reset();
5084 case ID_PROMPT_POPUP_CLOSE:
5085 __pPromptPopup.reset();
5087 case ID_USER_CONFIRM_USERMEDIA_CLOSE:
5088 __pUserMediaConfirmPopup.reset();
5090 case ID_USER_CONFIRM_GEOLOCATION_CLOSE:
5091 __pGeolocationConfirmPopup.reset();
5093 case ID_USER_CONFIRM_NOTIFICATION_CLOSE:
5094 __pNotificationConfirmPopup.reset();
5096 case ID_USER_SCRIPT_ALERT_CLOSE:
5097 __pScriptAlertConfirmPopup.reset();
5099 case ID_USER_SCRIPT_CONFIRM_CLOSE:
5100 __pScriptConfirmPopup.reset();
5103 case ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE:
5104 __pBeforeUnloadConfirmPopup.reset();
5107 case ID_USER_SCRIPT_SELECTBOX_CLOSE:
5108 __pSelectBox.reset();
5119 _WebImpl::GetDownloadHandler(void) const
5121 return __pWebDownloadHandler.get();
5126 _WebImpl::HideColorPicker(void)
5128 __pColorPicker.reset();
5137 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
5139 result r = E_SUCCESS;
5141 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
5142 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5144 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
5146 r = pColorHadler->Construct(colorVal, this);
5147 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5149 __pColorPicker = std::move(pColorHadler);
5151 r = __pColorPicker->ShowPopup();
5152 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5156 color = __pColorPicker->GetColor();
5162 __pColorPicker.reset();
5171 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
5173 result r = E_SUCCESS;
5175 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
5176 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5178 r = pInputPicker->Construct(String(inputValue), inputType, this);
5179 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5181 __pDatePicker = std::move(pInputPicker);
5183 r = __pDatePicker->ShowPopup();
5184 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5188 dateStr = __pDatePicker->GetDate();
5194 __pDatePicker.reset();
5203 _WebImpl::GetInstance(Web* pWeb)
5205 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5210 _WebImpl::GetInstance(const Web* pWeb)
5212 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5217 _WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5219 int checkReturn = 0;
5221 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5224 if( checkmime == true)
5226 table = CUSTOM_CONTENT_TABLE_NAME;
5230 table = CUSTOM_PROTOCOL_TABLE_NAME;
5233 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5234 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5235 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5237 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5239 result r = db.Construct(handlerPath, "r+", null);
5240 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5242 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"'"));
5243 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5247 r = pEnum->MoveNext();
5248 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5249 r = pEnum->GetIntAt(0, checkReturn);
5250 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5262 _WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5266 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5269 if( checkmime == true)
5271 table = CUSTOM_CONTENT_TABLE_NAME;
5275 table = CUSTOM_PROTOCOL_TABLE_NAME;
5278 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5279 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5280 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5282 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5284 result r = db.Construct(handlerPath, "r+", null);
5285 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5287 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"'"));
5288 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5292 r = pEnum->MoveNext();
5293 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5294 r = pEnum->GetIntAt(0, checkId);
5295 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5297 std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
5298 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5300 r = pDeleteStmt->BindInt(0, checkId);
5301 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5303 db.BeginTransaction();
5305 std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
5307 db.CommitTransaction();
5314 const Tizen::Base::String
5315 _WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
5317 if (originUri == L"" || currentUri == L"")
5322 result r = E_SUCCESS;
5325 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5326 String originReplace(originUri);
5327 String table(CUSTOM_PROTOCOL_TABLE_NAME);
5331 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5332 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5334 r = currentUri.SubString(0, found + 1, baseUri);
5335 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5337 r = db.Construct(handlerPath, "r+", null);
5338 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5340 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
5341 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
5345 while (pEnum->MoveNext() == E_SUCCESS)
5350 String originScheme;
5352 r = pEnum->GetStringAt(0, protocol);
5353 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5355 r = pEnum->GetStringAt(1, queryUrl);
5356 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5358 r = pEnum->GetIntAt(2, allow);
5359 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5366 String protocolScheme(protocol + L":");
5368 r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
5369 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5371 if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
5373 if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
5375 r = originReplace.Replace(originScheme, "");
5376 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5378 queryUrl.Replace("%s", originReplace, 0);
5379 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5391 const Tizen::Base::String
5392 _WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
5394 if (originUri == L"" || currentUri == L"" || mime == L"")
5399 result r = E_SUCCESS;
5402 String originUrlStr = originUri;
5403 const String replaceStr = L"%s";
5405 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5406 String table(CUSTOM_CONTENT_TABLE_NAME);
5410 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5411 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5413 r = currentUri.SubString(0, found + 1, baseUri);
5414 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5416 r = db.Construct(handlerPath, "r+", null);
5417 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5419 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
5423 r = pEnum->MoveNext();
5424 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5425 r = pEnum->GetIntAt(0, allow);
5426 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5427 r = pEnum->GetStringAt(1, contentUrl);
5428 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5436 if (contentUrl != L"")
5438 r = contentUrl.Replace(replaceStr, originUrlStr, 0);
5439 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5451 _WebImpl::SetFormDataList(Eina_List* pFormDataList)
5453 __pFormDataList = pFormDataList;
5458 _WebImpl::IsFormDataWindowVisible(void) const
5460 return __isFormDataVisible;
5465 _WebImpl::ShowFormDataWindow(const Rectangle& windowRect, Evas_Object* pWebView)
5467 Rectangle rect(_CoordinateSystemUtils::InverseTransform(Rectangle(windowRect.x, windowRect.y + windowRect.height, windowRect.width, windowRect.height)));
5469 if (__isFormDataVisible)
5471 result r = __pFormDataWindow->UpdateList(__pFormDataList, rect);
5472 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5476 __pFormDataWindow.reset();
5478 std::unique_ptr<_FormDataWindow> pFormDataWindow( new (std::nothrow) _FormDataWindow());
5479 SysTryReturnResult(NID_WEB_CTRL, pFormDataWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
5481 result r = pFormDataWindow->Construct(rect, this, pWebView);
5482 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5484 r = pFormDataWindow->UpdateList(__pFormDataList, rect);
5485 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5487 r = pFormDataWindow->LaunchFormDataWindow();
5488 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5490 __pFormDataWindow = std::move(pFormDataWindow);
5491 __isFormDataVisible = true;
5499 _WebImpl::HideFormDataWindow(bool delWindow)
5503 __pFormDataWindow.reset();
5506 __isFormDataVisible = false;
5511 _WebImpl::ClearWebNotification(_WebNotification* pWebNotification)
5513 __webNotificationList.Remove(*pWebNotification);
5518 _WebImpl::SetWebNotification(_WebNotification* pWebNotification)
5520 __webNotificationList.Add(pWebNotification);
5524 }}} // Tizen::Web::Controls