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 <FUi_Control.h>
79 #include <FUi_CoordinateSystemUtils.h>
80 #include <FUi_EcoreEvasMgr.h>
81 #include <FUi_EcoreEvas.h>
82 #include <FUi_ResourceManager.h>
83 #include <FUi_ResourceSizeInfo.h>
84 #include <FUi_Window.h>
85 #include <FUiAnim_EflNode.h>
86 #include <FUiAnim_VisualElement.h>
87 #include <FUiCtrl_FooterImpl.h>
88 #include <FUiCtrl_FormImpl.h>
89 #include "FWeb_HistoryItemImpl.h"
90 #include "FWebCtrl_AppControlListener.h"
91 #include "FWebCtrl_AuthConfirmPopup.h"
92 #include "FWebCtrl_AuthenticationChallengeImpl.h"
93 #include "FWebCtrl_EflWebkit.h"
94 #include "FWebCtrl_FormDataWindow.h"
95 #include "FWebCtrl_GeolocationPermissionManagerImpl.h"
96 #include "FWebCtrl_HitElementResultImpl.h"
97 #include "FWebCtrl_InputPickerPopup.h"
98 #include "FWebCtrl_WebNotification.h"
99 #include "FWebCtrl_PageNavigationListImpl.h"
100 #include "FWebCtrl_PromptPopup.h"
101 #include "FWebCtrl_SelectBox.h"
102 #include "FWebCtrl_Utility.h"
103 #include "FWebCtrl_Web.h"
104 #include "FWebCtrl_WebDataHandler.h"
105 #include "FWebCtrl_WebEvent.h"
106 #include "FWebCtrl_WebEventArg.h"
107 #include "FWebCtrl_WebImpl.h"
108 #include "FWebCtrl_WebManager.h"
109 #include "FWebCtrl_WebPresenter.h"
110 #include "FWebCtrl_WebSettingImpl.h"
113 using namespace Tizen::App;
114 using namespace Tizen::Base;
115 using namespace Tizen::Base::Collection;
116 using namespace Tizen::Base::Runtime;
117 using namespace Tizen::Base::Utility;
118 using namespace Tizen::Content;
119 using namespace Tizen::Graphics;
120 using namespace Tizen::Io;
121 using namespace Tizen::Media;
122 using namespace Tizen::Net::Http;
123 using namespace Tizen::System;
124 using namespace Tizen::Ui;
125 using namespace Tizen::Ui::Animations;
126 using namespace Tizen::Ui::Controls;
127 using namespace Tizen::Web::Json;
130 namespace Tizen { namespace Web { namespace Controls
134 static const char WEB_CTRL[] = "webcontrol";
135 static const char PARENT_WEB_CTRL[] = "parentwebcontrol";
138 static const float MIN_ZOOM_LEVEL = 0.3;
139 static const float MAX_ZOOM_LEVEL = 2;
142 static const int REDIRECTION_HEADER_GROUP = 300;
145 static const int MAX_TEXT_MATCH = pow(2, 31) - 1;
148 static const int PORTRAIT_KEYPAD_HEIGHT = 444;
149 static const int LANDSCAPE_KEYPAD_HEIGHT = 316;
150 static const int DEFAULT_LIST_ITEM_COUNT = 5;
154 AddHttpAttributeData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
156 result r = E_SUCCESS;
158 std::unique_ptr<String> pAttrKey(new (std::nothrow) String(reinterpret_cast< char* >(const_cast< void* >(pKey))));
159 std::unique_ptr<String> pAttrValue(new (std::nothrow) String(reinterpret_cast< char* >(pValue)));
160 SysTryReturn(NID_WEB_CTRL, pAttrKey.get() && pAttrValue.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
162 SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
164 r = reinterpret_cast< HashMap* >(pUserData)->Add(*pAttrKey, *pAttrValue);
165 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
167 pAttrValue.release();
174 FreeCharArray(void* pData)
176 delete[] reinterpret_cast<char*>(pData);
181 ConvertErrorCode(int error)
183 LoadingErrorType errorCode = WEB_ERROR_UNKNOWN;
187 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
189 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE:
191 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE_PROXY:
193 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT:
195 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT_PROXY:
197 case EWK_ERROR_NETWORK_STATUS_IO_ERROR:
199 case EWK_ERROR_NETWORK_STATUS_MALFORMED:
201 case EWK_ERROR_NETWORK_STATUS_TRY_AGAIN:
203 case EWK_ERROR_NETWORK_STATUS_TOO_MANY_REDIRECTS:
205 case EWK_ERROR_NETWORK_STATUS_TLS_FAILED:
207 case EWK_ERROR_NETWORK_STATUS_INTERNAL_SERVER_ERROR:
209 case EWK_ERROR_NETWORK_STATUS_BAD_GATEWAY:
211 case EWK_ERROR_NETWORK_STATUS_SERVICE_UNAVAILABLE:
213 case EWK_ERROR_NETWORK_STATUS_GATEWAY_TIMEOUT:
214 errorCode = WEB_NO_CONNECTION;
217 case EWK_ERROR_NETWORK_STATUS_BAD_REQUEST:
219 case EWK_ERROR_NETWORK_STATUS_REQUEST_URI_TOO_LONG:
220 errorCode = WEB_BAD_URL;
223 case EWK_ERROR_NETWORK_STATUS_FORBIDDEN:
224 errorCode = WEB_FILE_ACCESS_FAILED;
227 case EWK_ERROR_NETWORK_STATUS_REQUEST_TIMEOUT:
228 errorCode = WEB_REQUEST_TIMEOUT;
231 case EWK_ERROR_NETWORK_STATUS_UNSUPPORTED_MEDIA_TYPE:
232 errorCode = WEB_MIME_NOT_SUPPORTED;
235 case EWK_ERROR_NETWORK_STATUS_INSUFFICIENT_STORAGE:
236 errorCode = WEB_OUT_OF_MEMORY;
239 case EWK_ERROR_NETWORK_STATUS_REQUEST_ENTITY_TOO_LARGE:
240 errorCode = WEB_REQUEST_MAX_EXCEEDED;
243 case EWK_ERROR_NETWORK_STATUS_CONTINUE:
245 case EWK_ERROR_NETWORK_STATUS_SWITCHING_PROTOCOLS:
247 case EWK_ERROR_NETWORK_STATUS_PROCESSING:
249 case EWK_ERROR_NETWORK_STATUS_OK:
251 case EWK_ERROR_NETWORK_STATUS_CREATED:
253 case EWK_ERROR_NETWORK_STATUS_ACCEPTED:
255 case EWK_ERROR_NETWORK_STATUS_NON_AUTHORITATIVE:
257 case EWK_ERROR_NETWORK_STATUS_NO_CONTENT:
259 case EWK_ERROR_NETWORK_STATUS_RESET_CONTENT:
261 case EWK_ERROR_NETWORK_STATUS_PARTIAL_CONTENT:
263 case EWK_ERROR_NETWORK_STATUS_MULTI_STATUS:
265 case EWK_ERROR_NETWORK_STATUS_MULTIPLE_CHOICES:
267 case EWK_ERROR_NETWORK_STATUS_MOVED_PERMANENTLY:
269 case EWK_ERROR_NETWORK_STATUS_FOUND:
271 case EWK_ERROR_NETWORK_STATUS_SEE_OTHER:
273 case EWK_ERROR_NETWORK_STATUS_NOT_MODIFIED:
275 case EWK_ERROR_NETWORK_STATUS_USE_PROXY:
277 case EWK_ERROR_NETWORK_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL:
279 case EWK_ERROR_NETWORK_STATUS_TEMPORARY_REDIRECT:
280 errorCode = WEB_HTTP_RESPONSE;
283 case EWK_ERROR_NETWORK_STATUS_SSL_FAILED:
284 errorCode = WEB_INVALID_CERTIFICATE;
288 errorCode = WEB_ERROR_UNKNOWN;
297 FireLoadingErrorOccurredEvent(_WebImpl* pImpl, int code, const char* pDescription)
299 result r = E_SUCCESS;
301 std::unique_ptr<Integer> pErrorCode(new (std::nothrow) Integer(code));
302 std::unique_ptr<String> pErrorDescription(new (std::nothrow) String(pDescription));
303 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED));
304 SysTryReturnResult(NID_WEB_CTRL, pErrorCode.get() && pErrorDescription.get() && pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
306 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_TYPE, *pErrorCode.get());
307 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
308 pErrorCode.release();
310 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_MESSAGE, *pErrorDescription.get());
311 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
312 pErrorDescription.release();
314 r = pImpl->GetWebEvent()->FireAsync(*pEventArg);
315 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
323 OnScriptAlertRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
325 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
327 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
328 String msg(pMessage);
330 result r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_ALERT, pView, msg);
331 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
335 ewk_view_javascript_alert_reply(pView);
341 OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
343 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
345 result r = E_SUCCESS;
346 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
347 String msg(pMessage);
349 r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_CONFIRM, pView, msg);
350 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
354 ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
360 OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pDefaultValue, void* pUserData)
362 SysLog(NID_WEB_CTRL, "The current value of message is %s, defaulValue is %s", pMessage, pDefaultValue);
364 result r = E_SUCCESS;
365 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
367 String msg(pMessage);
368 String defVal(pDefaultValue);
370 r = pImpl->ShowPromptPopup(msg, defVal);
371 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
376 ewk_view_javascript_prompt_reply(pView, null);
383 _WebImpl::OnBeforeUnloadConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
385 _WebImpl* pWebImpl = reinterpret_cast< _WebImpl* >(pUserData);
386 SysAssertf(pWebImpl, "Failed to request");
387 result r = E_SUCCESS;
389 String msg(pMessage);
391 r = pWebImpl->ShowUserConfirmPopupAsync(USER_BEFORE_UNLOAD_CONFIRM, pView, msg);
392 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
396 ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
402 OnCertificateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
404 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
405 Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(pEventInfo);
406 SysAssertf(pImpl && pPolicy, "Failed to request");
408 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
410 switch (pImpl->GetSetting().GetCertificateErrorHandlingMode())
412 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM:
414 if (pImpl->IsCertificateRequested())
416 ewk_certificate_policy_decision_allowed_set(pPolicy, static_cast< Eina_Bool >(pImpl->IsCertificateConfirmed()));
420 result r = E_SUCCESS;
422 std::unique_ptr<DbEnumerator> pEnum;
424 String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
425 String table(CERTIFICATE_TABLE_NAME);
428 String pem(ewk_certificate_policy_decision_certificate_pem_get(pPolicy));
430 r = db.Construct(certificatePath, "r", null);
431 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
433 pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select allow From " + table + L" Where pem = '" + pem + L"'"));
436 r = pEnum->MoveNext();
437 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
440 r = pEnum->GetIntAt(0, allow);
441 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
443 SysLog(NID_WEB_CTRL, "The current value of allow is %d", allow);
445 ewk_certificate_policy_decision_allowed_set(pPolicy, static_cast < Eina_Bool >(allow));
446 pImpl->SetCertificateConfirmed(static_cast < bool >(allow));
450 r = pImpl->ShowCertificateConfirmPopup(CERTIFICATE_POPUP_MODE_USER_CONFIRM, pPolicy);
451 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
453 ewk_view_resume(pWebCore->GetWebNativeNode());
458 pImpl->SetCertificateRequested(true);
462 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL:
463 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
465 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE :
466 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_TRUE);
475 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
476 pImpl->SetCertificateConfirmed(false);
477 pImpl->SetCertificateRequested(true);
479 ewk_view_resume(pWebCore->GetWebNativeNode());
484 OnHttpAuthenticationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
486 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
487 Ewk_Auth_Challenge* pChallenge = reinterpret_cast< Ewk_Auth_Challenge* >(pEventInfo);
488 SysAssertf(pImpl && pChallenge, "Failed to request");
490 result r = E_SUCCESS;
492 r = pImpl->HttpAuthenticationRequested(pChallenge);
493 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
497 ewk_auth_challenge_credential_cancel(pChallenge);
498 evas_object_smart_callback_call(pView, "authentication,canceled", NULL);
503 OnHttpAuthenticationCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
505 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
506 SysAssertf(pImpl , "Failed to request");
508 if (pImpl->GetLoadingListener())
510 result r = E_SUCCESS;
512 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED));
513 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
515 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
516 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
522 OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, void* pUserData)
524 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
525 SysAssertf(pImpl , "Failed to request");
527 _SystemResource* pSysResource = _SystemResource::GetInstance();
528 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
530 result r = E_SUCCESS;
532 String host(ewk_security_origin_host_get(pSecOrigin));
533 const String& body1 = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE");
534 const String& body2 = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE");
537 r = message.Format(256, body1.GetPointer(), body2.GetPointer(), host.GetPointer());
538 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
540 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_APP_CACHE, pView, message);
541 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
546 ewk_view_application_cache_permission_reply(pView, EINA_FALSE);
552 OnIndexedDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
554 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
555 SysAssertf(pImpl , "Failed to request");
557 _SystemResource* pSysResource = _SystemResource::GetInstance();
558 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
560 result r = E_SUCCESS;
562 String host(ewk_security_origin_host_get(pSecOrigin));
563 const String& body1 = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE");
564 const String& body2 = 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");
567 r = message.Format(512, body1.GetPointer(), body2.GetPointer(), host.GetPointer());
568 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
570 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, pView, message);
571 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
576 ewk_view_exceeded_indexed_database_quota_reply(pView, EINA_FALSE);
582 OnDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, const char* database_name, unsigned long long expectedQuota, void* pUserData)
584 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
585 SysAssertf(pImpl , "Failed to request");
587 _SystemResource* pSysResource = _SystemResource::GetInstance();
588 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
590 result r = E_SUCCESS;
592 String host(ewk_security_origin_host_get(pSecOrigin));
593 const String& body1 = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE");
594 const String& body2 = 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");
597 r = message.Format(512, body1.GetPointer(), body2.GetPointer(), host.GetPointer());
598 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
600 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_DB_QUOTA_EXCEDED, pView, message);
601 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
606 ewk_view_exceeded_database_quota_reply(pView, EINA_FALSE);
612 OnLocalFileSystemQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
614 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
615 SysAssertf(pImpl , "Failed to request");
617 _SystemResource* pSysResource = _SystemResource::GetInstance();
618 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
620 result r = E_SUCCESS;
622 String host(ewk_security_origin_host_get(pSecOrigin));
623 const String& body1 = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE");
624 const String& body2 = 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");
627 r = message.Format(512, body1.GetPointer(), body2.GetPointer(), host.GetPointer());
628 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
630 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, pView, message);
631 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
636 ewk_view_exceeded_local_file_system_quota_reply(pView, EINA_FALSE);
642 OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
644 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
645 Ewk_Geolocation_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(pEventInfo);
646 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
648 if (pImpl->GetSetting().IsGeolocationEnabled())
650 result r = E_SUCCESS;
652 std::unique_ptr<DbEnumerator> pEnum;
654 String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
655 String table(GEOLOCATION_TABLE_NAME);
658 const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPermissionRequest);
659 String origin = _Utility::CreateOrigin(pSecurityOrigin);
661 r = db.Construct(geolocationPath, "r", null);
662 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
664 pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select permission From " + table + L" Where origin = '" + origin + L"'"));
667 r = pEnum->MoveNext();
668 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
671 r = pEnum->GetIntAt(0, permission);
672 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
674 SysLog(NID_WEB_CTRL, "The current value of permission is %d", permission);
676 ewk_geolocation_permission_request_set(pPermissionRequest, static_cast < Eina_Bool >(permission));
680 ewk_geolocation_permission_request_suspend(pPermissionRequest);
682 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_GEOLOCATION, pPermissionRequest);
683 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
690 ewk_geolocation_permission_request_set(pPermissionRequest, EINA_FALSE);
695 OnGetUserMediaPermissionRequsted(void* pUserData, Evas_Object* pView, void* pEventInfo)
697 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
698 Ewk_User_Media_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_User_Media_Permission_Request* >(pEventInfo);
699 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
701 result r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_USERMEDIA, pEventInfo);
702 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
706 ewk_user_media_permission_request_set(pPermissionRequest, EINA_FALSE);
711 OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
713 result r = E_SUCCESS;
714 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
716 Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(pEventInfo);
717 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
719 ewk_notification_permission_request_suspend(pPermissionRequest);
721 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_NOTIFICATION, pPermissionRequest);
722 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
726 ewk_notification_permission_request_set(pPermissionRequest, EINA_FALSE);
731 OnNotificationShow(void* pUserData, Evas_Object* pView, void* pEventInfo)
733 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
734 Ewk_Notification* pNotification = reinterpret_cast< Ewk_Notification* >(pEventInfo);
735 SysAssertf(pImpl && pNotification, "Failed to request");
737 result r = E_SUCCESS;
738 Ewk_Context* pContext = ewk_view_context_get(pView);
739 SysAssertf(pContext, "Failed to get webkit instance.");
740 uint64_t notificationId = ewk_notification_id_get(pNotification);
742 //ewk_notification_security_origin_get(pNotification)
744 const char* text = ewk_notification_body_get(pNotification);
745 SysSecureLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
747 std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification());
748 SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
750 r = pNotificationWindow->Construct(pContext, notificationId, pImpl);
751 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error propogated.", GetErrorMessage(r));
753 pNotificationWindow->SetText(String(text));
754 pNotificationWindow->LaunchNotification();
755 pImpl->SetWebNotification(pNotificationWindow.release());
757 ewk_notification_showed(pContext, notificationId);
762 OnNotificationCancel(void* pUserData, Evas_Object* pView, void* pEventInfo)
764 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
765 uint64_t* pNotificationID = reinterpret_cast< uint64_t* >(pEventInfo);
766 SysAssertf(pImpl && pNotificationID, "Failed to request");
768 //ToDo : Where is ewk API for cancel operation?
773 OnProtocolHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
775 result r = E_SUCCESS;
776 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
777 SysAssertf(pImpl, "Failed to request");
779 r = pImpl->ShowUserConfirmPopup(USER_PROTOCOL_HANDLER, pEventInfo);
780 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
785 OnIsProtocolHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
787 int checkHandler = 0;
788 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
789 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
790 SysAssertf(pImpl && pHandlerData, "Failed to request");
792 checkHandler = pImpl->SearchHandler(pHandlerData, false);
793 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
794 switch (checkHandler)
799 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
802 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
805 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
813 OnProtocolHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
815 result r = E_SUCCESS;
816 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
817 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
818 SysAssertf(pImpl && pHandlerData, "Failed to request");
820 r = pImpl->UnregistrationHandler(pHandlerData, false);
821 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
826 OnContentHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
828 result r = E_SUCCESS;
829 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
830 SysAssertf(pImpl, "Failed to request");
832 r = pImpl->ShowUserConfirmPopup(USER_CONTENT_HANDLER, pEventInfo);
833 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
838 OnIsContentHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
840 int checkHandler = 0;
841 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
842 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
843 SysAssertf(pImpl && pHandlerData, "Failed to request");
845 checkHandler = pImpl->SearchHandler(pHandlerData, true);
846 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
848 switch (checkHandler)
853 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
856 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
859 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
868 OnContentHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
870 result r = E_SUCCESS;
871 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
872 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
873 SysAssertf(pImpl && pHandlerData, "Failed to request");
875 r = pImpl->UnregistrationHandler(pHandlerData, true);
876 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
881 OnFullScreenEntered(void* pUserData, Evas_Object* pView, void* pEventInfo)
883 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
884 SysAssertf(pImpl, "Failed to request");
886 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
887 SysAssertf(pWebCore, "Failed to get Web core object");
889 pWebCore->SetFullScreenEntered(true);
894 OnFullScreenExited(void* pUserData, Evas_Object* pView, void* pEventInfo)
896 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
897 SysAssertf(pImpl, "Failed to request");
899 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
900 SysAssertf(pWebCore, "Failed to get Web core object");
902 pWebCore->SetFullScreenEntered(false);
907 OnFocusDownRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
909 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
910 SysAssertf(pImpl, "Failed to request");
912 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
913 pWebCore->SetFocusEnd(true);
918 OnFocusUpRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
920 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
921 SysAssertf(pImpl, "Failed to request");
923 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
924 pWebCore->SetFocusEnd(true);
929 OnVibrationRequested(uint64_t duration, void* pUserData)
931 result r = E_SUCCESS;
933 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
934 SysAssertf(pImpl, "Failed to request");
936 r = pImpl->VibrationRequested(duration);
937 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
942 OnVibrationCanceled(void* pUserData)
944 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
945 SysAssertf(pImpl, "Failed to request");
947 pImpl->VibrationCanceled();
952 OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
954 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
955 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
956 SysAssertf(pImpl && pPolicy, "Failed to request");
958 String url(ewk_policy_decision_url_get(pPolicy));
959 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
961 if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
962 && !pImpl->IsRedirectRequested())
964 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
965 SysAssertf(pWebCore, "Failed to get Web core object");
967 pWebCore->SetFullScreenEntered(false);
969 pImpl->SetCertificateRequested(false);
971 if (pImpl->GetTextSearchListener())
973 pImpl->DisableAsyncSearch();
976 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
977 if (pLoadingListener)
979 WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
980 Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
982 switch (ewkNavigationType)
984 case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
985 navigationType = WEB_NAVIGATION_LINK_CLICKED;
987 case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
988 navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
990 case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
991 navigationType = WEB_NAVIGATION_BACKFORWARD;
993 case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
994 navigationType = WEB_NAVIGATION_RELOAD;
996 case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
997 navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
999 case EWK_POLICY_NAVIGATION_TYPE_OTHER:
1000 navigationType = WEB_NAVIGATION_OTHER;
1006 if (pLoadingListener->OnLoadingRequested(url, navigationType))
1008 ewk_policy_decision_ignore(pPolicy);
1015 if (url == L"about:blank")
1017 ewk_policy_decision_use(pPolicy);
1022 String currentUrl(pImpl->GetUrl());
1023 String redirectUrl(pImpl->GetProtocolFromUri(url, currentUrl));
1024 if (redirectUrl != L"")
1026 ewk_policy_decision_ignore(pPolicy);
1028 pImpl->LoadUrl(redirectUrl);
1036 String uriScheme(uri.GetScheme());
1037 SysSecureLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
1039 if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file") && (uriScheme != L""))
1041 result r = E_SUCCESS;
1043 if (uriScheme == L"tel")
1045 String operationId(L"http://tizen.org/appcontrol/operation/dial");
1046 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1048 else if (uriScheme == L"mailto" || uriScheme == L"sms" || uriScheme == L"smsto" || uriScheme == L"mms" || uriScheme == L"mmsto" )
1050 String operationId(L"http://tizen.org/appcontrol/operation/compose");
1051 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1055 String operationId(L"http://tizen.org/appcontrol/operation/view");
1056 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1061 ewk_policy_decision_ignore(pPolicy);
1067 ewk_policy_decision_use(pPolicy);
1072 OnLoadingStarted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1074 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1075 SysAssertf(pImpl, "Failed to request");
1077 if (pImpl->GetLoadingListener())
1079 result r = E_SUCCESS;
1081 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_STARTED));
1082 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1084 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1085 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1086 pEventArg.release();
1092 OnPageTitleReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1094 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1095 char* pTitle = reinterpret_cast< char* >(pEventInfo);
1096 SysAssertf(pImpl, "Failed to request");
1098 SysLog(NID_WEB_CTRL, "The current value of title is %s", pTitle);
1100 if (pImpl->GetLoadingListener())
1102 result r = E_SUCCESS;
1104 std::unique_ptr<String> pPageTitle(new (std::nothrow) String(pTitle));
1105 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED));
1106 SysTryReturnVoidResult(NID_WEB_CTRL, pPageTitle.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1108 r = pEventArg->SetEventInfo(_LoadingEventArg::PAGE_TITLE, *pPageTitle.get());
1109 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1110 pPageTitle.release();
1112 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1113 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1114 pEventArg.release();
1120 OnEstimatedProgress(void* pUserData, Evas_Object* pView, void* pEventInfo)
1122 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1123 double* pProgress = reinterpret_cast< double* >(pEventInfo);
1124 SysAssertf(pImpl, "Failed to request");
1126 SysLog(NID_WEB_CTRL, "The current value of progress is %lf", *pProgress);
1128 if (pImpl->GetLoadingListener())
1130 result r = E_SUCCESS;
1132 std::unique_ptr<Integer> pProgressPercentage(new (std::nothrow) Integer(static_cast< int >(*pProgress * 100)));
1133 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PROGRESS));
1134 SysTryReturnVoidResult(NID_WEB_CTRL, pProgressPercentage.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1136 r = pEventArg->SetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS, *pProgressPercentage.get());
1137 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1138 pProgressPercentage.release();
1140 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1141 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1142 pEventArg.release();
1148 OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1150 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1151 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
1152 SysAssertf(pImpl && pPolicy, "Failed to request");
1154 result r = E_SUCCESS;
1156 int code = ewk_policy_decision_response_status_code_get(pPolicy);
1157 String url(ewk_policy_decision_url_get(pPolicy));
1158 String mime(ewk_policy_decision_response_mime_get(pPolicy));
1159 SysSecureLog(NID_WEB_CTRL, "code : %d, url : %ls, mime : %ls", code, url.GetPointer(), mime.GetPointer());
1161 if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
1163 if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
1165 pImpl->SetRedirectRequested(true);
1168 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
1169 if (pLoadingListener)
1171 HttpHeader httpHeader;
1173 Eina_Iterator* iterator = eina_hash_iterator_tuple_new(ewk_policy_decision_response_headers_get(pPolicy));
1176 Eina_Hash_Tuple *tuple = null;
1178 EINA_ITERATOR_FOREACH(iterator, tuple)
1180 String key(reinterpret_cast< const char* >(tuple->key));
1181 String value(reinterpret_cast< char* >(tuple->data));
1183 SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
1185 r = httpHeader.AddField(key, value);
1186 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, eina_iterator_free(iterator), r, "[%s] Propagating.", GetErrorMessage(r));
1189 eina_iterator_free(iterator);
1192 pImpl->SetPolicyDecision(pLoadingListener->OnWebDataReceived(mime, httpHeader));
1196 pImpl->SetPolicyDecision(WEB_DECISION_CONTINUE);
1200 switch (pImpl->GetPolicyDecision())
1202 case WEB_DECISION_CONTINUE:
1204 String currentUrl(pImpl->GetUrl());
1205 String redirectUrl(pImpl->GetRedirectUri(url, currentUrl, mime));
1206 if (redirectUrl != L"")
1208 ewk_policy_decision_ignore(pPolicy);
1210 pImpl->LoadUrl(redirectUrl);
1215 if (ewk_policy_decision_type_get(pPolicy) == EWK_POLICY_DECISION_USE)
1221 ewk_policy_decision_ignore(pPolicy);
1223 String operationId(L"http://tizen.org/appcontrol/operation/view");
1225 r = _AppControlImpl::FindAndStart(operationId, &url, &mime, null, null, null);
1226 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS || r == E_OBJ_NOT_FOUND, r, "[%s] Propagating.", GetErrorMessage(r));
1227 if (r == E_OBJ_NOT_FOUND)
1229 String operationId(L"http://tizen.org/appcontrol/operation/download");
1231 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1232 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1240 case WEB_DECISION_DOWNLOAD:
1242 ewk_policy_decision_ignore(pPolicy);
1244 _WebDataHandler* pDownloadHandler = pImpl->GetDownloadHandler();
1245 SysTryReturnVoidResult(NID_WEB_CTRL, pDownloadHandler, E_SYSTEM, "[%s] A system error has been occurred. Failed to get DownloadHandler.", GetErrorMessage(E_SYSTEM));
1247 Ewk_Context* pContext = ewk_view_context_get(pView);
1248 SysAssertf(pContext, "Failed to get webkit instance.");
1250 pDownloadHandler->StartDownload(url);
1255 case WEB_DECISION_IGNORE:
1257 ewk_policy_decision_ignore(pPolicy);
1268 ewk_policy_decision_use(pPolicy);
1273 ewk_policy_decision_ignore(pPolicy);
1278 OnProgressCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1280 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1281 SysAssertf(pImpl, "Failed to request");
1283 if (pImpl->IsRedirectRequested())
1285 pImpl->SetRedirectRequested(false);
1288 if (pImpl->IsLoadingErrorOccurred())
1290 pImpl->SetLoadingErrorOccurred(false);
1291 evas_object_smart_callback_call(pView, "load,finished", NULL);
1297 OnLoadingErrorOccurred(void* pUserData, Evas_Object* pView, void* pEventInfo)
1299 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1300 Ewk_Error* pErrorData = reinterpret_cast< Ewk_Error* >(pEventInfo);
1301 SysAssertf(pImpl && pErrorData, "Failed to request");
1303 int code = ewk_error_code_get(pErrorData);
1304 const char* pDescription = ewk_error_description_get(pErrorData);
1306 SysLog(NID_WEB_CTRL, "The current value of code is %d, description is %s", code, pDescription);
1310 case EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE:
1311 pImpl->SetLoadingErrorOccurred(true);
1314 case EWK_ERROR_CODE_PLUGINWILLHANDLELOAD:
1315 evas_object_smart_callback_call(pView, "load,finished", NULL);
1318 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
1319 pImpl->SetLoadingErrorOccurred(true);
1320 evas_object_smart_callback_call(pView, "load,stop", NULL);
1324 pImpl->SetLoadingErrorOccurred(true);
1325 if (pImpl->GetLoadingListener())
1327 result r = E_SUCCESS;
1329 r = FireLoadingErrorOccurredEvent(pImpl, code, pDescription);
1330 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1338 OnLoadingCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
1340 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1341 SysAssertf(pImpl, "Failed to request");
1343 if (pImpl->GetLoadingListener())
1345 result r = E_SUCCESS;
1347 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_CANCELED));
1348 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1350 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1351 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1352 pEventArg.release();
1359 OnLoadingCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1361 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1362 SysAssertf(pImpl, "Failed to request");
1364 if (pImpl->GetLoadingListener())
1366 result r = E_SUCCESS;
1368 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_COMPLETED));
1369 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1371 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1372 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1373 pEventArg.release();
1379 OnLoadingCommitted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1381 evas_object_focus_set(pView, EINA_FALSE);
1386 OnFaviconReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1388 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1389 SysAssertf(pImpl, "Failed to request");
1391 if (pImpl->GetLoadingListener())
1393 result r = E_SUCCESS;
1395 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED));
1396 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1398 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1399 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1400 pEventArg.release();
1407 OnDidStartDownloadCallback(const char* pUrl, void* pUserData)
1409 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1410 SysAssertf(pUrl && pImpl != null, "Failed to request");
1412 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s", pUrl);
1417 FireWebPageShowRequestedEvent(_WebImpl* pImpl, int event)
1419 result r = E_SUCCESS;
1421 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1422 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1424 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1425 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1426 pEventArg.release();
1433 OnWebPageShowRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1435 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1436 SysAssertf(pImpl, "Failed to request");
1438 if (pImpl->GetUiEventListener())
1440 result r = E_SUCCESS;
1442 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED);
1443 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1445 if (pImpl->GetUiEventListenerF())
1447 result r = E_SUCCESS;
1449 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT);
1450 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1456 OnWebWindowCreateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1458 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(pUserData);
1459 Evas_Object** pChildView = reinterpret_cast< Evas_Object** >(pEventInfo);
1460 SysAssertf(pParentImpl && pChildView, "Failed to request");
1462 IWebUiEventListener* pUserUiListener = pParentImpl->GetUiEventListener();
1463 IWebUiEventListenerF* pUserUiListenerF = pParentImpl->GetUiEventListenerF();
1464 if (pUserUiListener)
1466 Web* pWeb = pUserUiListener->OnWebWindowCreateRequested();
1469 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1470 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1472 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1473 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1476 if (pUserUiListenerF)
1478 Web* pWeb = pUserUiListenerF->OnWebWindowCreateRequested();
1481 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1482 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1484 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1485 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1492 FireWebWindowClosedRequestedEvent(_WebImpl* pImpl, int event)
1494 result r = E_SUCCESS;
1496 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1497 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1499 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1500 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1501 pEventArg.release();
1508 OnWebWindowClosedRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1510 _WebImpl* pChildImpl = reinterpret_cast< _WebImpl* >(pUserData);
1511 SysAssertf(pChildImpl, "Failed to request");
1513 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, PARENT_WEB_CTRL));
1514 if (pParentImpl == null)
1519 if (pParentImpl->GetUiEventListener())
1521 result r = E_SUCCESS;
1523 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED);
1524 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1526 if (pParentImpl->GetUiEventListenerF())
1528 result r = E_SUCCESS;
1530 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT);
1531 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1537 FireWebPreventDefaultTriggeredEvent(_WebImpl* pImpl, int event, bool trigger)
1539 result r = E_SUCCESS;
1541 std::unique_ptr<Boolean> pPreventTrigger(new (std::nothrow) Boolean(trigger));
1542 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1543 SysTryReturnResult(NID_WEB_CTRL, pPreventTrigger.get() && pEventArg.get(), E_OUT_OF_MEMORY, " Memory allocation failed." );
1545 r = pEventArg->SetEventInfo(_WebUiEventArg::PREVENT_DEFAULT, *pPreventTrigger.get());
1546 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1547 pPreventTrigger.release();
1549 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1550 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1551 pEventArg.release();
1558 OnWebPreventDefaultTriggered(void* pUserData, Evas_Object* pView, void* pEventInfo)
1560 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1561 Eina_Bool* pTrigger = reinterpret_cast< Eina_Bool* >(pEventInfo);
1562 SysAssertf(pImpl && pTrigger, "Failed to request");
1564 if (pImpl->GetUiEventListener())
1566 result r = E_SUCCESS;
1568 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED, static_cast< bool >(*pTrigger));
1569 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1571 if (pImpl->GetUiEventListenerF())
1573 result r = E_SUCCESS;
1575 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT, static_cast< bool >(*pTrigger));
1576 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1582 FireWebPageBlockSelectedEvent(_WebImpl* pImpl)
1584 result r = E_SUCCESS;
1586 std::unique_ptr<Point> startPoint(new (std::nothrow) Point());
1587 std::unique_ptr<Point> endPoint(new (std::nothrow) Point());
1588 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1590 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1592 if ((endPoint->x != 0) && (endPoint->y != 0))
1594 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED));
1595 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1597 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1598 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1599 startPoint.release();
1601 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1602 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1605 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1606 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1607 pEventArg.release();
1615 FireWebPageBlockSelectedEventF(_WebImpl* pImpl)
1617 result r = E_SUCCESS;
1619 std::unique_ptr<FloatPoint> startPoint(new (std::nothrow) FloatPoint());
1620 std::unique_ptr<FloatPoint> endPoint(new (std::nothrow) FloatPoint());
1622 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1624 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1625 if ((endPoint->x != 0.0f) && (endPoint->y != 0.0f))
1627 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT));
1628 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1630 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1631 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1632 startPoint.release();
1634 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1635 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1638 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1639 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1640 pEventArg.release();
1648 OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
1650 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1651 SysAssertf(pImpl, "Failed to request");
1653 if (pImpl->GetUiEventListener())
1655 result r = E_SUCCESS;
1657 r = FireWebPageBlockSelectedEvent(pImpl);
1658 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1660 if (pImpl->GetUiEventListenerF())
1662 result r = E_SUCCESS;
1664 r = FireWebPageBlockSelectedEventF(pImpl);
1665 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1671 OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
1673 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1674 char* pJsonText = reinterpret_cast< char* >(pEventInfo);
1675 SysAssertf(pImpl && pJsonText, "Failed to request");
1677 result r = E_SUCCESS;
1679 SysLog(NID_WEB_CTRL, "The current value of jsontext is %s", pJsonText);
1681 std::unique_ptr<_JsBridgeArg> pEventArg(new (std::nothrow) _JsBridgeArg());
1682 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1684 r = pEventArg->Construct(pJsonText);
1685 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1687 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1688 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1689 pEventArg.release();
1694 OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
1696 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1697 Eina_Rectangle* pEinaRect = reinterpret_cast< Eina_Rectangle* >(pEventInfo);
1698 SysAssertf(pImpl && pEinaRect, "Failed to request");
1700 if (pImpl->GetSetting().GetInputStyle() == INPUT_STYLE_OVERLAY)
1702 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1703 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1705 Rectangle rect(pEinaRect->x, pEinaRect->y, pEinaRect->w, pEinaRect->h);
1707 if (rect.height == 0)
1712 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1715 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
1717 pFormImpl->Invalidate(false);
1720 if (pImpl->GetWebKeypadEventListener())
1722 if (pImpl->IsKeypadVisible() == true)
1724 if ((pImpl->GetPreviousKeypadBounds().width == rect.width) && (pImpl->GetPreviousKeypadBounds().height != rect.height))
1726 pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1731 pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1735 pImpl->SetPreviousKeypadBounds(rect);
1739 result r = pImpl->SetFullScreenKeypad();
1740 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1746 OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
1748 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1749 SysAssertf(pImpl, "Failed to request");
1751 pImpl->SetKeypadVisibleState(true);
1753 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1756 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1757 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1759 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(pImpl->GetPreviousKeypadBounds().height));
1761 if (pFormImpl->HasFooter())
1763 pFormImpl->GetCore().SetKeypadShowState(true);
1768 if (pImpl->GetWebKeypadEventListener())
1770 pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
1776 OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
1778 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1779 SysAssertf(pImpl, "Failed to request");
1781 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1784 pFormImpl->DeflateClientRectHeight(0);
1786 pFormImpl->Invalidate(false);
1788 if (pFormImpl->HasFooter())
1790 pFormImpl->GetCore().SetKeypadShowState(false);
1795 if (pImpl->GetWebKeypadEventListener())
1797 pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1800 pImpl->SetKeypadVisibleState(false);
1805 OnWindowObjectFocusLost(void* pUserData, Evas_Object* pWin, void* pEvent_info)
1807 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1808 SysAssertf(pImpl, "Failed to request");
1810 pImpl->SetWinFocusLost(true);
1815 OnWindowObjectFocusGained(void* pUserData, Evas_Object* pWin, void* pEvent_info)
1817 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1818 SysAssertf(pImpl, "Failed to request");
1820 if (pImpl->IsVisible() == true && pImpl->IsFocused() == true)
1822 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1823 SysAssertf(pWebCore, "Failed to get Web core object");
1825 if (pImpl->IsWinFocusLost() == true)
1827 Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
1828 SysAssertf(pSettings, "Failed to get settings instance.");
1830 if (ewk_settings_clear_text_selection_automatically_get(pSettings) == EINA_FALSE)
1832 ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_TRUE);
1834 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1836 else if (pImpl->IsKeypadOpened() == true)
1838 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1843 pImpl->SetWinFocusLost(false);
1848 OnWebNativeNodeFocusGained(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
1850 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1851 SysAssertf(pImpl, "Failed to request");
1853 if (pImpl->IsKeypadOpened() == true)
1855 pImpl->SetKeypadOpened(false);
1857 else if (pImpl->IsWinFocusLost() == true && pImpl->IsFocused() == false)
1859 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1860 SysAssertf(pWebCore, "Failed to get Web core object");
1862 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_FALSE);
1868 OnWebNativeNodeFocusLost(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
1870 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1871 SysAssertf(pImpl, "Failed to request");
1873 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1874 SysAssertf(pWebCore, "Failed to get Web core object");
1876 Eina_Rectangle leftHandle;
1877 Eina_Rectangle rightHandle;
1879 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
1880 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
1882 if (pImpl->IsWinFocusLost() == true && ewk_view_text_selection_range_get(pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle))
1884 Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
1885 SysAssertf(pSettings, "Failed to get settings instance.");
1887 ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_FALSE);
1893 OnColorPickerProviderRequested(Ewk_View_Smart_Data* pSmartData, int red, int green, int blue, int alpha)
1895 SysAssertf(pSmartData, "invalid smartdata");
1896 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1897 SysAssertf(pWebImpl, "Failed to get Impl");
1899 result r = E_SUCCESS;
1901 if (pWebImpl->GetColorpicker())
1908 r = pWebImpl->ShowColorPicker(red, green, blue, alpha, color);
1909 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1911 byte r1, g1, b1, a1;
1912 color.GetColorComponents(r1, g1, b1, a1);
1913 ewk_view_color_picker_color_set(pSmartData->self, r1, g1, b1, a1);
1920 OnColorPickerProviderDismissed(Ewk_View_Smart_Data* pSmartData)
1922 SysAssertf(pSmartData, "invalid smartdata");
1924 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1925 SysAssertf(pWebImpl, "Failed to get Impl");
1927 return pWebImpl->HideColorPicker();
1932 OnDatePickerProviderRequested(Ewk_View_Smart_Data* pSmartData, Ewk_Input_Type inputType, const char* inputValue)
1934 SysAssertf(pSmartData, "Failed to request");
1935 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1936 SysAssertf(pWebImpl, "Failed to get Impl");
1938 result r = E_SUCCESS;
1940 if (pWebImpl->GetDatepicker())
1942 ewk_view_focused_input_element_value_set(pSmartData->self, inputValue);
1949 r = pWebImpl->ShowDatePicker(inputType, inputValue, dateStr);
1950 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1952 std::unique_ptr<char[]> pDateStr(_StringConverter::CopyToCharArrayN(dateStr));
1953 SysTryReturn(NID_WEB_CTRL, pDateStr.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1955 ewk_view_focused_input_element_value_set(pSmartData->self, pDateStr.get());
1962 OnSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, double pageScaleFactor, Eina_List* pItems, int selectedIndex)
1964 SysAssertf(pSmartData, "Failed to request");
1966 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1967 SysAssertf(pWebImpl, "Failed to get Impl");
1969 result r = pWebImpl->ShowSelectBoxPopup(false, L"", pItems, pSmartData->self, selectedIndex);
1970 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1977 OnMultiSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* pItems)
1979 SysAssertf(pSmartData, "Failed to request");
1981 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1982 SysAssertf(pWebImpl, "Failed to get Impl");
1984 result r = pWebImpl->ShowSelectBoxPopup(true, L"", pItems, pSmartData->self, 0);
1985 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1992 OnSelectBoxClosed(Ewk_View_Smart_Data* pSmartData)
1994 SysAssertf(pSmartData, "invalid smartdata");
1996 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1997 SysAssertf(pWebImpl, "Failed to get Impl");
1999 result r = pWebImpl->ClearSelectBoxPopup();
2000 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
2007 OnSelectBoxUpdateRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, Eina_List* pItems, int selectedIndex)
2009 SysAssertf(pSmartData, "invalid smartdata");
2011 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2012 SysAssertf(pWebImpl, "Failed to get Impl");
2014 result r = pWebImpl->UpdateSelectBoxPopup(pItems, selectedIndex, false);
2015 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
2022 OnFormDataCandidateShow(Ewk_View_Smart_Data *pSmartData, int x, int y, int w, int h)
2024 SysAssertf(pSmartData, "Failed to request");
2026 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2027 SysAssertf(pWebImpl, "Failed to get Impl");
2029 Rectangle windowRect(x, y, w, h);
2030 result r = pWebImpl->ShowFormDataWindow(windowRect, pSmartData->self);
2031 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
2038 OnFormDataCandidateHide(Ewk_View_Smart_Data *pSmartData)
2040 SysAssertf(pSmartData, "Failed to request");
2042 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2043 SysAssertf(pWebImpl, "Failed to get Impl");
2045 if (pWebImpl->IsFormDataWindowVisible())
2047 pWebImpl->HideFormDataWindow();
2055 OnFormDataCandidateUpdate(Ewk_View_Smart_Data *pSmartData, Eina_List *pDataList)
2057 SysAssertf(pSmartData, "Failed to request");
2059 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2060 SysAssertf(pWebImpl, "Failed to get Impl");
2062 pWebImpl->SetFormDataList(pDataList);
2069 OnFormDataCandidateIsShowing(Ewk_View_Smart_Data *pSmartData)
2071 SysAssertf(pSmartData, "Failed to request");
2073 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2074 SysAssertf(pWebImpl, "Failed to get Impl");
2076 if (pWebImpl->IsFormDataWindowVisible())
2088 OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
2090 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
2091 SysAssertf(pPresenter && !pError, "Failed to request");
2093 bool ret = EINA_TRUE;
2097 case EWK_COOKIE_ACCEPT_POLICY_ALWAYS:
2099 case EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY:
2103 case EWK_COOKIE_ACCEPT_POLICY_NEVER:
2112 SysLog(NID_WEB_CTRL, "The current value of policy is %d", ret);
2114 pPresenter->EndAsyncProcess(ret);
2119 OnScriptExecuted(Evas_Object* pView, const char* pResult, void* pUserData)
2121 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
2122 SysAssertf(pPresenter, "Failed to request");
2124 String result(pResult);
2125 SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
2127 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
2128 _WebManager* pWebManager = _WebManager::GetInstance();
2129 if (pWebManager->IsValidCallback(reinterpret_cast< int >(pImpl), reinterpret_cast< int >(pPresenter)))
2131 pPresenter->EndAsyncProcess(result);
2137 OnTextFound(void* pUserData, Evas_Object* pView, void* pEventInfo)
2139 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
2140 SysAssertf(pImpl, "Failed to request");
2142 int* pTotalCount = reinterpret_cast< int* >(pEventInfo);
2143 SysLog(NID_WEB_CTRL, "The current value of totalCount is %d", *pTotalCount);
2145 _WebPresenter* pWebPresenter = pImpl->GetSearchPresenter();
2149 pWebPresenter->EndAsyncProcess(*pTotalCount);
2153 if (pImpl->GetTextSearchListener())
2155 result r = E_SUCCESS;
2159 if (*pTotalCount > 0)
2161 ordinal = pImpl->GetAsyncSearchOrdinal();
2162 pImpl->SetAsyncSearchResult(*pTotalCount);
2165 if (pImpl->GetPendingAsyncSearchCount() > 0)
2170 std::unique_ptr<Integer> pCount(new (std::nothrow) Integer(*pTotalCount));
2171 std::unique_ptr<Integer> pOrdinal(new (std::nothrow) Integer(ordinal));
2172 std::unique_ptr<_TextSearchEventArg> pEventArg(new (std::nothrow) _TextSearchEventArg(WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND));
2173 SysTryReturnVoidResult(NID_WEB_CTRL, pCount.get() && pOrdinal.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2175 r = pEventArg->SetEventInfo(_TextSearchEventArg::TOTAL_COUNT, *pCount.get());
2176 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2179 r = pEventArg->SetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL, *pOrdinal.get());
2180 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2183 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
2184 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2185 pEventArg.release();
2191 class _JsBridgeHashCodeProvider
2192 : public Tizen::Base::Collection::IHashCodeProviderT< Tizen::Base::String >
2195 _JsBridgeHashCodeProvider(){}
2196 virtual ~_JsBridgeHashCodeProvider(void) {}
2199 int GetHashCode(const Tizen::Base::String& obj) const
2201 return obj.GetHashCode();
2207 //Comparer implementation
2208 class _JsBridgeComparer
2209 : public Tizen::Base::Collection::IComparerT< Tizen::Base::String >
2212 _JsBridgeComparer(){}
2213 virtual ~_JsBridgeComparer(void) {}
2216 result Compare(const Tizen::Base::String& obj1, const Tizen::Base::String& obj2, int& cmp) const
2233 _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
2234 : _ContainerImpl(pWeb, pCore)
2235 , __isFooterVisible(false)
2236 , __isKeypadVisible(false)
2237 , __isKeypadOpened(false)
2238 , __isWinFocusLost(false)
2239 , __isLoadingErrorOccurred(false)
2240 , __isRedirectRequested(false)
2241 , __isCertificateRequested(false)
2242 , __isCertificateConfirmed(false)
2243 , __isFormDataVisible(false)
2244 , __keypadBounds(0, 0, 0, 0)
2246 , __pUserLoadingListener(null)
2247 , __pUserUiListener(null)
2248 , __pUserUiListenerF(null)
2249 , __pUserKeypadEventListener(null)
2250 , __pTextSearchListener(null)
2252 , __pJsBridgeList(null)
2253 , __pJsProvider(null)
2254 , __pJsComparer(null)
2255 , __pWebDownloadHandler(null)
2257 , __pAuthChallenge(null)
2258 , __pAuthPopup(null)
2259 , __pUserMediaConfirmPopup(null)
2260 , __pContentHandlerConfirmPopup(null)
2261 , __pProtocolHandlerConfirmPopup(null)
2262 , __pGeolocationConfirmPopup(null)
2263 , __pNotificationConfirmPopup(null)
2264 , __pScriptAlertConfirmPopup(null)
2265 , __pScriptConfirmPopup(null)
2266 , __pBeforeUnloadConfirmPopup(null)
2267 , __pAppCacheConfirmPopup(null)
2268 , __pDbQuotaConfirmPopup(null)
2269 , __pLocalFsQuotaConfirmPopup(null)
2270 , __pIndexedDbQuotaConfirmPopup(null)
2271 , __pPromptPopup(null)
2272 , __pCertConfirmPopup(null)
2273 , __pSelectBox(null)
2274 , __pDatePicker(null)
2275 , __pColorPicker(null)
2276 , __pFormDataWindow(null)
2278 , __policy(WEB_DECISION_CONTINUE)
2279 , __defaultUserAgent(L"")
2280 , __pFormDataList(null)
2281 , __popupClosed(false)
2283 __textSearch.__searchAll = false;
2284 __textSearch.__searchForward = true;
2285 __textSearch.__caseSensitive = false;
2286 __textSearch.__pending = 0;
2287 __textSearch.__currentIndex = 1;
2288 __textSearch.__totalCount = -1;
2289 __textSearch.__text = L"";
2293 _WebImpl::~_WebImpl()
2295 _WebManager* pWebManager = _WebManager::GetInstance();
2296 SysTryCatch(NID_WEB_CTRL, pWebManager, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2297 pWebManager->RemoveWeb(reinterpret_cast< int >(this));
2300 _SettingInfoImpl::RemoveSettingEventListener(*this);
2301 RemoveEventListenerCallback();
2302 ClearCertificateDb();
2307 _WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
2309 result r = E_SUCCESS;
2311 r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2312 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2314 _Web* pCore = _Web::CreateWebN();
2315 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2317 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2319 r = CheckConstruction(pCore, pImpl);
2320 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2322 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2323 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2325 r = pImpl->Construct();
2326 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2338 _WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
2340 result r = E_SUCCESS;
2342 r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2343 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2345 _Web* pCore = _Web::CreateWebN();
2346 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2348 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2350 r = CheckConstruction(pCore, pImpl);
2351 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2353 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2354 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2356 r = pImpl->Construct();
2357 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2369 _WebImpl::Construct(void)
2371 result r = E_SUCCESS;
2373 r = __mutex.Create();
2374 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2376 r = __textSearch.__searchQueue.Construct();
2377 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2379 r = __webNotificationList.Construct();
2380 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2382 r = InitJsBridgeList();
2383 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2386 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2388 __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
2389 SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
2396 _WebImpl::InitializeSetting(void)
2398 result r = E_SUCCESS;
2400 WebSetting* pWebSetting = __pWebCore->GetSetting();
2401 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(pWebSetting);
2403 SetCookieEnabled(pWebSettingImpl->IsCookieEnabled());
2404 SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
2406 __defaultUserAgent = pWebSettingImpl->GetUserAgent();
2408 r = SetSetting(*pWebSetting);
2409 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2411 SetEventListenerCallback();
2418 _WebImpl::IsLayoutable(void) const
2425 _WebImpl::InitWebEvent(void)
2427 __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
2428 SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2430 return __pWebEvent->Construct(*this);
2435 _WebImpl::GetWebEvent(void) const
2437 return __pWebEvent.get();
2442 _WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
2444 Eina_Hash* pHttpHeader = null;
2446 std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
2447 if (pFieldNameList.get())
2449 pHttpHeader = eina_hash_string_small_new(FreeCharArray);
2450 SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2452 int count = pFieldNameList->GetCount();
2454 for (int i = 0; i < count; i++)
2456 String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
2457 SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2459 std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
2460 SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2462 std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
2463 SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2465 while (pFieldValueEnum->MoveNext() == E_SUCCESS)
2467 Eina_Bool ret = false;
2469 String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
2470 SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2472 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
2473 SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2475 ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
2476 SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2483 eina_hash_free(pHttpHeader);
2490 _WebImpl::LoadUrl(const String& url) const
2492 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2498 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2499 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2501 ewk_view_url_set(pWebview, pUrl.get());
2508 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
2510 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2516 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2517 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2519 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2521 ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
2523 eina_hash_free(pHttpHeader);
2530 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
2532 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2538 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2539 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2541 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2543 ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
2545 eina_hash_free(pHttpHeader);
2552 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
2554 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2560 SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
2562 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
2563 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2564 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
2565 SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2567 ewk_view_contents_set(pWebview, reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
2574 _WebImpl::Pause(void)
2576 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2582 ewk_view_suspend(pWebview);
2587 _WebImpl::Resume(void)
2589 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2595 ewk_view_resume(pWebview);
2600 _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
2602 __pSelectBox.reset();
2604 SysTryReturnResult(NID_WEB_CTRL, eina_list_count(pItems) > 0, E_SYSTEM, "ItemCount is invalid.");
2606 result r = E_SUCCESS;
2608 std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
2609 SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2613 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT - 1, pWebView);
2617 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
2619 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2621 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2622 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2624 __pSelectBox = std::move(pSelectBox);
2626 return __pSelectBox->ShowPopup();
2631 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2633 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2635 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2640 _WebImpl::ClearSelectBoxPopup(void)
2642 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2644 __pSelectBox.reset();
2653 _WebImpl::GetDatepicker(void)
2655 _InputPickerPopup* pInputPicker =null;
2658 pInputPicker = __pDatePicker.get();
2660 return pInputPicker;
2665 _WebImpl::GetColorpicker(void)
2667 _InputPickerPopup* pInputPicker =null;
2670 pInputPicker = __pColorPicker.get();
2672 return pInputPicker;
2677 _WebImpl::CanGoBack(void) const
2679 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2685 return static_cast< bool >(ewk_view_back_possible(pWebview));
2690 _WebImpl::CanGoForward(void) const
2692 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2698 return static_cast< bool >(ewk_view_forward_possible(pWebview));
2703 _WebImpl::GoBack(void) const
2705 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2711 ewk_view_back(pWebview);
2716 _WebImpl::GoForward(void) const
2718 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2724 ewk_view_forward(pWebview);
2729 _WebImpl::GetUrl(void) const
2731 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2737 return ewk_view_url_get(pWebview);
2742 _WebImpl::GetTitle(void) const
2744 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2750 return ewk_view_title_get(pWebview);
2755 _WebImpl::StopLoading(void) const
2757 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2763 ewk_view_stop(pWebview);
2768 _WebImpl::Reload(void) const
2770 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2776 ewk_view_reload(pWebview);
2781 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
2783 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2789 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2790 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2792 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2793 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2795 ewk_view_script_execute(pWebview, pScript.get(), OnScriptExecuted, pPresenter.get());
2797 String* pResult = new (std::nothrow) String(L"");
2798 SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2800 pPresenter->WaitAsyncProcess(*pResult);
2807 _WebImpl::SetZoomLevel(float level)
2809 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2815 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);
2817 ewk_view_scale_set(pWebview, static_cast< double >(level), 0, 0);
2824 _WebImpl::GetZoomLevel(void) const
2826 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2832 return static_cast< float >(ewk_view_scale_get(pWebview));
2836 const PageNavigationList*
2837 _WebImpl::GetBackForwardListN(void) const
2839 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2845 result r = E_SUCCESS;
2847 _PageNavigationListImpl* pNavigationListImpl = null;
2848 _HistoryItemImpl* pHistoryItemImpl = null;
2850 std::unique_ptr<PageNavigationList> pNavigationList;
2851 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2854 int forwardCount = 0;
2859 Ewk_History* pEwkHistoryList = ewk_view_history_get(pWebview);
2860 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2862 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2863 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2865 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2866 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2868 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2869 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2871 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2872 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2874 r = pHistoryList->Construct();
2875 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2877 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2878 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2879 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2881 for (int i = -backCount; i < forwardCount + 1; i++)
2883 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2884 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2886 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2887 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2889 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2890 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2892 url = ewk_history_item_uri_get(pEwkItem);
2893 title = ewk_history_item_title_get(pEwkItem);
2894 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2896 pHistoryItemImpl->SetHistoryItem(url, title);
2898 r = pHistoryList->Add(*pHistoryItem.get());
2899 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2900 pHistoryItem.release();
2903 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2905 ewk_history_free(pEwkHistoryList);
2907 return pNavigationList.release();
2910 ewk_history_free(pEwkHistoryList);
2917 _WebImpl::SearchText(const String& text, bool searchForward)
2919 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2925 result r = E_SUCCESS;
2927 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2931 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2934 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2935 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2937 r = SynchronizeSearch(SEARCH_SYNC, pWebview, condition, text, searchForward, false, pPresenter.get());
2938 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
2941 pPresenter->WaitAsyncProcess(result);
2943 return static_cast < bool >(result);
2948 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2950 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2956 result r = E_SUCCESS;
2958 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2962 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2965 r = SynchronizeSearch(SEARCH_ALL_ASYNC, pWebview, condition, text, true, caseSensitive);
2966 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2973 _WebImpl::SearchNextAsync(bool searchForward)
2975 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2981 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2982 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2983 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2985 result r = E_SUCCESS;
2987 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2989 if (!__textSearch.__caseSensitive)
2991 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2996 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2999 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pWebview, condition, __textSearch.__text, searchForward);
3000 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3007 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
3009 MutexGuard lock(__mutex);
3011 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
3012 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3017 if (__textSearch.__searchAll)
3019 DisableAsyncSearch();
3021 __textSearch.__searchQueue.Enqueue(this);
3022 __textSearch.__searchQueue.Enqueue(pWebPresenter);
3024 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
3025 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3029 __textSearch.__searchQueue.Enqueue(pWebPresenter);
3031 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3035 case SEARCH_ALL_ASYNC:
3036 __textSearch.__searchAll = true;
3037 __textSearch.__text = text;
3038 __textSearch.__searchForward = true;
3039 __textSearch.__caseSensitive = caseSensitive;
3040 __textSearch.__totalCount = -1;
3041 __textSearch.__currentIndex = 1;
3043 __textSearch.__searchQueue.Enqueue(this);
3044 __textSearch.__searchQueue.Enqueue(this);
3046 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
3047 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3050 case SEARCH_NEXT_ASYNC:
3051 __textSearch.__searchForward = searchForward;
3053 CalculateAsyncSearchOrdinal();
3055 __textSearch.__searchQueue.Enqueue(this);
3057 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3069 _WebImpl::SetAsyncSearchResult(int totalCount)
3071 __textSearch.__totalCount = totalCount;
3076 _WebImpl::GetSearchPresenter(void)
3078 MutexGuard lock(__mutex);
3080 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
3085 _WebImpl::GetPendingAsyncSearchCount(void) const
3087 return __textSearch.__searchQueue.GetCount();
3092 _WebImpl::CalculateAsyncSearchOrdinal(void)
3094 if (__textSearch.__searchForward)
3096 __textSearch.__currentIndex++;
3100 __textSearch.__currentIndex--;
3106 _WebImpl::GetAsyncSearchOrdinal(void) const
3108 return __textSearch.__currentIndex;
3113 _WebImpl::DisableAsyncSearch(void)
3115 __textSearch.__searchAll = false;
3120 _WebImpl::SetSetting(const WebSetting& setting)
3122 if (__pWebCore->GetWebNativeNode())
3124 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3125 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3126 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
3128 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
3129 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3131 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
3133 switch (setting.GetCacheControl())
3135 case WEB_CACHE_VALIDATED:
3136 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
3139 case WEB_CACHE_IGNORE:
3140 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
3147 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
3149 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
3153 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
3156 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
3158 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
3160 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
3162 if (__defaultUserAgent != setting.GetUserAgent())
3164 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
3165 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3167 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
3170 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
3172 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
3174 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
3176 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
3179 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
3181 pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
3182 pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
3183 pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
3184 pWebSettingImpl->SetFontSize(setting.GetFontSize());
3185 pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
3186 pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
3187 pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
3188 pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
3189 pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
3190 pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
3191 pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
3192 pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
3193 pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
3200 _WebImpl::GetSetting(void) const
3202 return *__pWebCore->GetSetting();
3206 const HitElementResult*
3207 _WebImpl::GetElementByPointN(const Point& point) const
3209 return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
3213 const HitElementResult*
3214 _WebImpl::GetElementByPointN(const FloatPoint& point) const
3216 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3222 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));
3224 result r = E_SUCCESS;
3226 _HitElementResultImpl* pHitElementResultImpl = null;
3228 std::unique_ptr<HitElementResult> pHitElementResult;
3229 std::unique_ptr<Bitmap> pImage;
3230 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
3232 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
3234 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3235 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
3237 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3238 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
3239 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
3240 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3241 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
3243 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
3245 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
3246 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3248 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
3249 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3251 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
3257 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
3258 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
3259 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
3260 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
3262 r = buf.Construct(imageLength);
3263 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3265 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
3266 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3270 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
3271 // webkit support types such as ico and vp8 additionally
3272 if (strcmp(pExtension, "gif") == 0)
3274 format = IMG_FORMAT_GIF;
3276 else if (strcmp(pExtension, "jpg") == 0)
3278 format = IMG_FORMAT_JPG;
3280 else if (strcmp(pExtension, "png") == 0)
3282 format = IMG_FORMAT_PNG;
3284 else if (strcmp(pExtension, "bmp") == 0)
3286 format = IMG_FORMAT_BMP;
3290 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
3294 r = image.Construct();
3295 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3297 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
3298 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3303 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
3304 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3306 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
3307 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3309 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
3310 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3313 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
3315 ewk_hit_test_free(pEwkHitTest);
3317 return pHitElementResult.release();
3320 ewk_hit_test_free(pEwkHitTest);
3327 _WebImpl::IsLoading(void) const
3329 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3335 double percent = ewk_view_load_progress_get(pWebview);
3337 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
3349 _WebImpl::GetTextFromBlock(void) const
3351 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3357 return ewk_view_text_selection_text_get(pWebview);
3362 _WebImpl::IsPrivateBrowsingEnabled(void) const
3364 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3367 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
3370 Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
3371 SysAssertf(pSettings, "Failed to get webkit instance.");
3373 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
3378 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
3380 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3383 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
3388 Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
3389 SysAssertf(pSettings, "Failed to get webkit instance.");
3391 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
3396 _WebImpl::ClearHistory(void)
3398 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3404 ewk_view_back_forward_list_clear(pWebview);
3409 _WebImpl::ClearCache(void)
3411 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3417 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3419 ewk_context_cache_clear(pContext);
3424 _WebImpl::ClearCookie(void)
3426 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3432 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3433 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3435 ewk_cookie_manager_cookies_clear(pCookieManager);
3440 _WebImpl::ClearFormData(void)
3442 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3448 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3450 ewk_context_form_candidate_data_clear(pContext);
3455 _WebImpl::ClearLoginFormData(void)
3457 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3463 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3465 ewk_context_form_password_data_clear(pContext);
3470 _WebImpl::IsCookieEnabled(void) const
3472 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3475 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
3478 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3479 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3480 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3482 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
3483 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3485 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, pPresenter.get());
3487 bool result = false;
3488 pPresenter->WaitAsyncProcess(result);
3495 _WebImpl::SetCookieEnabled(bool enable)
3497 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3500 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
3505 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3506 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3507 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3511 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
3515 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
3516 ewk_cookie_manager_cookies_clear(pCookieManager);
3522 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
3524 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3530 result r = E_SUCCESS;
3532 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
3533 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3536 String fileExtension = File::GetFileExtension(filePath);
3537 int pathLength = filePath.GetLength();
3540 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
3542 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
3543 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3544 r = filePath.SubString(0, index + 1, dirPath);
3545 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3547 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
3548 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
3552 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
3554 ewk_view_contents_pdf_get(pWebview, pSize->width, pSize->height, pFilePath.get());
3558 Evas_Coord contentsWidth;
3559 Evas_Coord contentsHeight;
3561 ewk_view_contents_size_get(pWebview, &contentsWidth, &contentsHeight);
3562 ewk_view_contents_pdf_get(pWebview, contentsWidth, contentsHeight, pFilePath.get());
3570 _WebImpl::IsMimeSupported(const String& mime) const
3572 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3578 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
3579 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3581 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(pWebview), pMime.get()));
3586 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
3588 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
3593 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
3595 __pUserUiListener = pUiEventListener;
3600 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
3602 __pUserUiListenerF = pUiEventListener;
3607 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
3609 __pUserKeypadEventListener = pKeypadEventListener;
3614 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
3616 if (__pWebDownloadHandler.get() == null)
3618 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
3619 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3622 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
3623 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
3628 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
3630 __pTextSearchListener = pTextSearchListener;
3635 _WebImpl::SetScrollEnabled(bool enable)
3637 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
3642 _WebImpl::IsScrollEnabled(void) const
3644 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
3649 _WebImpl::InitJsBridgeList(void)
3651 result r = E_SUCCESS;
3653 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
3654 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3656 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
3657 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3659 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
3660 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3662 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
3663 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3665 __pJsBridgeList = std::move(pJsBridgeList);
3672 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3674 result r = E_SUCCESS;
3676 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3677 String key(pJsBridge->GetName());
3679 r = __pJsBridgeList->Add(key, pJsBridge);
3680 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3687 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3689 result r = E_SUCCESS;
3691 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3692 String key(pJsBridge->GetName());
3694 r = __pJsBridgeList->Remove(key);
3695 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3702 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3704 result r = E_SUCCESS;
3706 IJsonValue* pJsonValue = null;
3707 IJavaScriptBridge* pJsBridge = null;
3709 String key(L"name");
3711 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3712 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));
3714 r = pJsonObject->GetValue(&key, pJsonValue);
3715 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3717 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3718 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3720 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3721 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3728 _WebImpl::GetLoadingListener(void) const
3730 return __pUserLoadingListener;
3734 IWebUiEventListener*
3735 _WebImpl::GetUiEventListener(void) const
3737 return __pUserUiListener;
3741 IWebUiEventListenerF*
3742 _WebImpl::GetUiEventListenerF(void) const
3744 return __pUserUiListenerF;
3748 IWebKeypadEventListener*
3749 _WebImpl::GetWebKeypadEventListener(void) const
3751 return __pUserKeypadEventListener;
3755 ITextSearchListener*
3756 _WebImpl::GetTextSearchListener(void) const
3758 return __pTextSearchListener;
3763 _WebImpl::SetEventListenerCallback(void) const
3765 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3768 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3769 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3771 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3772 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3774 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3775 SysAssertf(pSmartData, "Failed to request");
3777 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3778 SysAssertf(pSmart, "Failed to request");
3780 pSmart->popup_menu_show = OnSelectBoxRequested;
3781 pSmart->multiple_popup_menu_show = OnMultiSelectBoxRequested;
3782 pSmart->popup_menu_hide = OnSelectBoxClosed;
3783 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3785 pSmart->input_picker_show = OnDatePickerProviderRequested;
3786 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3787 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3789 pSmart->formdata_candidate_show = OnFormDataCandidateShow;
3790 pSmart->formdata_candidate_hide = OnFormDataCandidateHide;
3791 pSmart->formdata_candidate_update_data = OnFormDataCandidateUpdate;
3792 pSmart->formdata_candidate_is_showing = OnFormDataCandidateIsShowing;
3794 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3796 // add loading event callbacks for ILoadingListener
3797 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3798 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3800 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3801 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3802 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3803 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3804 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3805 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3806 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3807 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3808 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3810 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3812 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3813 evas_object_smart_callback_add(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3815 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3816 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3817 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3819 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3820 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3822 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3824 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3825 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3826 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3827 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, OnBeforeUnloadConfirmRequested, const_cast< _WebImpl* >(this));
3829 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3831 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3832 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3833 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3835 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3836 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3837 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3839 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3840 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3841 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3843 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3844 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3845 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3846 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3848 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3849 evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
3851 evas_object_smart_callback_add(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected, this);
3853 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
3854 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
3856 evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
3857 evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
3859 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3860 SysAssertf(pContext, "Failed to get webkit instance.");
3861 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3862 ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
3864 ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
3865 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3866 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3867 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
3869 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3870 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost, this);
3876 _WebImpl::RemoveEventListenerCallback(void) const
3878 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3881 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3882 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3884 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3885 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3887 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3888 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3890 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3891 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3892 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3893 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3894 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3895 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3896 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3897 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3898 evas_object_smart_callback_del(pWebNativeNode, "load,committed", OnLoadingCommitted);
3900 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3902 evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3903 evas_object_smart_callback_del_full(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3905 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3906 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3907 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3909 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3910 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3912 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3914 ewk_view_javascript_alert_callback_set(pWebNativeNode, null, null);
3915 ewk_view_javascript_prompt_callback_set(pWebNativeNode, null, null);
3916 ewk_view_javascript_confirm_callback_set(pWebNativeNode, null, null);
3917 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, null, null);
3919 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3921 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3922 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3923 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3925 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3926 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3927 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3928 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3929 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3930 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3932 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3933 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3934 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3936 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3938 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3939 evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
3941 evas_object_smart_callback_del(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected);
3943 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
3944 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
3946 evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
3947 evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
3949 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3950 SysAssertf(pContext, "Failed to get webkit instance.");
3951 ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
3953 ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
3954 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
3955 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
3956 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
3958 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3959 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost);
3965 _WebImpl::ClearCertificateDb(void)
3967 result r = E_SUCCESS;
3969 String certificatePath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
3970 String table(CERTIFICATE_TABLE_NAME);
3973 r = db.Construct(certificatePath, "r+", null);
3974 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3976 db.BeginTransaction();
3978 r = db.ExecuteSql(L"Delete From " + table, true);
3979 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3981 db.CommitTransaction();
3986 db.RollbackTransaction();
3991 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3993 return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
3998 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
4000 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4006 Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pWebview));
4007 SysAssertf(pSmartData && pSmartData->api, "Failed to get webkit instance.");
4008 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
4010 Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
4013 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
4015 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
4016 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
4018 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
4020 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
4021 char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
4022 if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
4024 ewk_view_command_execute(pWebview, "SelectWord", 0);
4025 evas_object_smart_callback_call(pWebview, "magnifier,hide", NULL);
4029 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
4036 _WebImpl::ReleaseBlock(void)
4038 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4044 ewk_view_text_selection_range_clear(pWebview);
4049 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
4051 FloatPoint tempStartPoint;
4052 FloatPoint tempEndPoint;
4054 GetBlockRange(tempStartPoint, tempEndPoint);
4056 startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
4057 endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
4062 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
4064 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4067 startPoint.x = startPoint.y = endPoint.x = endPoint.y = 0.0f;
4071 Eina_Rectangle leftHandle;
4072 Eina_Rectangle rightHandle;
4074 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
4075 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
4077 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
4079 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
4080 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
4081 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
4082 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
4084 if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
4086 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
4087 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
4093 _WebImpl::GetFaviconN(void) const
4095 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4101 result r = E_SUCCESS;
4103 Ewk_Context* pContext = ewk_view_context_get(pWebview);
4104 const char* pUrl = ewk_view_url_get(pWebview);
4105 Evas* pEvas = evas_object_evas_get(pWebview);
4107 Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
4113 Tizen::Graphics::BufferInfo bufferInfo;
4115 r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
4116 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4118 const Dimension dimension(bufferInfo.width, bufferInfo.height);
4119 Tizen::Base::ByteBuffer byteBuffer;
4121 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
4122 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4124 std::unique_ptr<Bitmap> pImage(new (std::nothrow) Bitmap());
4125 SysTryReturn(NID_WEB_CTRL, pImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4127 r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
4128 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4130 return pImage.release();
4136 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
4138 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4144 ewk_view_scroll_by(pWebview, diff.x, diff.y);
4149 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
4151 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4157 ewk_view_scroll_set(pWebview, dest.x, dest.y);
4162 _WebImpl::GetScrollPosition(void) const
4164 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4172 ewk_view_scroll_pos_get(pWebview, &position.x, &position.y);
4179 _WebImpl::GetPageSize(void) const
4181 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4184 return Dimension(0, 0);
4187 Evas_Coord width = 0;
4188 Evas_Coord height = 0;
4190 ewk_view_contents_size_get(pWebview, &width, &height);
4192 Dimension size(static_cast< int >(width), static_cast< int >(height));
4199 _WebImpl::SetLoadingErrorOccurred(bool arg)
4201 __isLoadingErrorOccurred = arg;
4206 _WebImpl::IsLoadingErrorOccurred(void) const
4208 return __isLoadingErrorOccurred;
4213 _WebImpl::SetRedirectRequested(bool arg)
4215 __isRedirectRequested = arg;
4220 _WebImpl::IsRedirectRequested(void) const
4222 return __isRedirectRequested;
4227 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
4234 _WebImpl::GetPolicyDecision(void) const
4241 _WebImpl::SetCertificateRequested(bool arg)
4243 __isCertificateRequested = arg;
4248 _WebImpl::IsCertificateRequested(void) const
4250 return __isCertificateRequested;
4255 _WebImpl::SetCertificateConfirmed(bool arg)
4257 __isCertificateConfirmed = arg;
4262 _WebImpl::IsCertificateConfirmed(void) const
4264 return __isCertificateConfirmed;
4269 _WebImpl::SetFullScreenKeypad(void)
4271 result r = E_SUCCESS;
4273 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
4274 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4276 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
4277 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4279 String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
4280 pKeypad->SetText(text);
4282 r = pKeypad->SetShowState(true);
4283 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4285 r = pKeypad->Show();
4286 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4288 pKeypad->AddTextEventListener(*this);
4290 __pKeypad = std::move(pKeypad);
4297 _WebImpl::RemoveFullScreenKeypad(void)
4299 __pKeypad->RemoveTextEventListener(*this);
4306 _WebImpl::IsFooterVisible(void) const
4308 return __isFooterVisible;
4313 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
4315 __isFooterVisible = isFooterVisible;
4320 _WebImpl::IsKeypadVisible(void) const
4322 return __isKeypadVisible;
4327 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
4329 __isKeypadVisible = isKeypadVisible;
4334 _WebImpl::IsKeypadOpened(void) const
4336 return __isKeypadOpened;
4340 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
4342 __isKeypadOpened = isKeypadOpened;
4347 _WebImpl::IsWinFocusLost(void) const
4349 return __isWinFocusLost;
4354 _WebImpl::SetWinFocusLost(bool isWinFocusLost)
4356 __isWinFocusLost = isWinFocusLost;
4361 _WebImpl::GetPreviousKeypadBounds(void) const
4363 return __keypadBounds;
4368 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
4370 __keypadBounds = bounds;
4375 _WebImpl::OnTextValueChangeCanceled(const Control& source)
4377 RemoveFullScreenKeypad();
4382 _WebImpl::OnTextValueChanged(const Control& source)
4384 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
4386 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
4388 RemoveFullScreenKeypad();
4393 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
4395 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
4396 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
4398 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
4399 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4401 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
4402 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
4404 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
4411 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
4413 result r = E_SUCCESS;
4415 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
4416 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4418 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4420 ILoadingListener* pLoadingListner = GetLoadingListener();
4421 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
4423 switch (pEventArg->GetEventType())
4425 case WEB_EVENT_LOADINGLISTENER_STARTED:
4427 pLoadingListner->OnLoadingStarted();
4431 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
4433 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
4434 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4436 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
4440 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
4442 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
4443 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4445 pLoadingListner->OnPageTitleReceived(*pPageTitle);
4449 case WEB_EVENT_LOADINGLISTENER_CANCELED:
4451 pLoadingListner->OnLoadingCanceled();
4455 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
4457 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
4458 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4460 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
4461 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4463 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
4465 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
4469 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
4471 pLoadingListner->OnLoadingCompleted();
4475 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
4477 pLoadingListner->OnHttpAuthenticationCanceled();
4481 case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
4483 std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
4484 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4488 pLoadingListner->OnFaviconReceived(*pFavicon.get());
4504 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
4506 result r = E_SUCCESS;
4508 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
4509 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4511 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4513 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
4514 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
4516 switch (pEventArg->GetEventType())
4518 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
4520 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
4521 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4523 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
4527 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
4529 pWebDownloadListener->OnWebDataDownloadCompleted();
4533 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
4535 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
4536 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4538 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
4540 pWebDownloadListener->OnWebDownloadFailed(errorType);
4555 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
4557 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4558 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4560 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4562 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4564 switch (pEventArg->GetEventType())
4566 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
4568 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4570 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4571 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4573 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4574 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4576 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4580 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
4582 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4584 __pUserUiListener->OnWebPageShowRequested(*pWeb);
4588 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
4590 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4592 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
4596 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
4598 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4600 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4601 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4603 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4618 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
4620 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4621 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4623 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4625 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4627 switch (pEventArg->GetEventType())
4629 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
4631 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4633 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4634 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4636 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4637 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4639 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4643 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
4645 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4647 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
4651 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
4653 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4655 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
4659 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
4661 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4663 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4664 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4666 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4681 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
4683 result r = E_SUCCESS;
4685 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
4686 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4688 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4690 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
4691 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
4693 switch (pEventArg->GetEventType())
4695 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4697 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4698 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4700 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4701 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4703 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4718 _WebImpl::VibrationRequested(uint64_t duration)
4720 result r = E_SUCCESS;
4722 __pVibrator.reset();
4724 std::unique_ptr<Vibrator> pVibrator(new (std::nothrow) Vibrator());
4725 SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4727 r = pVibrator->Construct();
4728 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4730 __pVibrator = std::move(pVibrator);
4732 IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
4734 r = __pVibrator->Start(&pattern, 1);
4735 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4742 _WebImpl::VibrationCanceled(void)
4744 __pVibrator.reset();
4749 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4751 result r = E_SUCCESS;
4753 String host(ewk_auth_challenge_url_get(pChallenge));
4754 String realm(ewk_auth_challenge_realm_get(pChallenge));
4756 __pAuthChallenge.reset();
4758 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4759 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4761 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4762 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4764 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4765 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4767 __pAuthChallenge = std::move(pAuthChallenge);
4769 ewk_auth_challenge_suspend(pChallenge);
4770 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4772 __pAuthChallenge.release();
4776 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4777 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4785 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4787 result r = E_SUCCESS;
4789 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4790 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4792 r = pAuthPopup->Construct(host, realm, pAuthChallenge);
4793 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4795 __pAuthPopup = std::move(pAuthPopup);
4797 int modalResult = 0;
4799 r = __pAuthPopup->ShowAndWait(modalResult);
4800 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4805 __pAuthPopup.reset();
4813 _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
4815 result r = E_SUCCESS;
4817 std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
4818 SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4820 r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
4821 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4823 __pCertConfirmPopup = std::move(pCertConfirmPopup);
4825 int modalResult = 0;
4827 r = __pCertConfirmPopup->ShowAndWait(modalResult);
4828 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4830 if (__pCertConfirmPopup.get() && userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
4832 __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
4836 if (__pCertConfirmPopup.get())
4838 __pCertConfirmPopup.reset();
4846 _WebImpl::ShowPromptPopup(String msg, String defVal)
4848 result r = E_SUCCESS;
4850 std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
4851 SysTryReturnResult(NID_WEB_CTRL, pPromptPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4853 r = pPromptPopup->Construct(msg, defVal, __pWebCore->GetWebNativeNode(), this);
4854 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4856 __pPromptPopup = std::move(pPromptPopup);
4858 r = __pPromptPopup->ShowPopup();
4859 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4864 __pPromptPopup.reset();
4872 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4874 result r = E_SUCCESS;
4876 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4877 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4879 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, true, msg);
4880 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4882 int modalResult = 0;
4884 switch(userConfirmMode)
4886 case USER_CONTENT_HANDLER:
4888 __pContentHandlerConfirmPopup = std::move(pUserConfirmPopup);
4890 r = __pContentHandlerConfirmPopup->ShowAndWait(modalResult);
4891 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pContentHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4893 __pContentHandlerConfirmPopup.reset();
4895 ewk_view_resume(__pWebCore->GetWebNativeNode());
4899 case USER_PROTOCOL_HANDLER:
4901 __pProtocolHandlerConfirmPopup = std::move(pUserConfirmPopup);
4903 r = __pProtocolHandlerConfirmPopup->ShowAndWait(modalResult);
4904 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pProtocolHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4906 __pProtocolHandlerConfirmPopup.reset();
4908 ewk_view_resume(__pWebCore->GetWebNativeNode());
4912 case USER_CONFIRM_APP_CACHE:
4914 __pAppCacheConfirmPopup = std::move(pUserConfirmPopup);
4916 r = __pAppCacheConfirmPopup->ShowAndWait(modalResult);
4917 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pAppCacheConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4919 __pAppCacheConfirmPopup.reset();
4921 ewk_view_resume(__pWebCore->GetWebNativeNode());
4925 case USER_CONFIRM_DB_QUOTA_EXCEDED:
4927 __pDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4929 r = __pDbQuotaConfirmPopup->ShowAndWait(modalResult);
4930 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4932 __pDbQuotaConfirmPopup.reset();
4934 ewk_view_resume(__pWebCore->GetWebNativeNode());
4938 case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
4940 __pLocalFsQuotaConfirmPopup = std::move(pUserConfirmPopup);
4942 r = __pLocalFsQuotaConfirmPopup->ShowAndWait(modalResult);
4943 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pLocalFsQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4945 __pLocalFsQuotaConfirmPopup.reset();
4947 ewk_view_resume(__pWebCore->GetWebNativeNode());
4951 case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
4953 __pIndexedDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4955 r = __pIndexedDbQuotaConfirmPopup->ShowAndWait(modalResult);
4956 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4958 __pIndexedDbQuotaConfirmPopup.reset();
4960 ewk_view_resume(__pWebCore->GetWebNativeNode());
4973 _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4975 result r = E_SUCCESS;
4977 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4978 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4980 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, false, msg);
4981 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4983 switch(userConfirmMode)
4985 case USER_CONFIRM_USERMEDIA:
4987 __pUserMediaConfirmPopup.reset();
4989 __pUserMediaConfirmPopup = std::move(pUserConfirmPopup);
4991 r = __pUserMediaConfirmPopup->ShowPopup();
4992 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pUserMediaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4996 case USER_CONFIRM_GEOLOCATION:
4998 __pGeolocationConfirmPopup.reset();
5000 __pGeolocationConfirmPopup = std::move(pUserConfirmPopup);
5002 r = __pGeolocationConfirmPopup->ShowPopup();
5003 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pGeolocationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5007 case USER_CONFIRM_NOTIFICATION:
5009 __pNotificationConfirmPopup.reset();
5011 __pNotificationConfirmPopup = std::move(pUserConfirmPopup);
5013 r = __pNotificationConfirmPopup->ShowPopup();
5014 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pNotificationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5018 case USER_SCRIPT_ALERT:
5020 __pScriptAlertConfirmPopup.reset();
5022 __pScriptAlertConfirmPopup = std::move(pUserConfirmPopup);
5024 r = __pScriptAlertConfirmPopup->ShowPopup();
5025 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptAlertConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5029 case USER_SCRIPT_CONFIRM:
5031 __pScriptConfirmPopup.reset();
5033 __pScriptConfirmPopup = std::move(pUserConfirmPopup);
5035 r = __pScriptConfirmPopup->ShowPopup();
5036 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5040 case USER_BEFORE_UNLOAD_CONFIRM:
5042 __pBeforeUnloadConfirmPopup.reset();
5044 __pBeforeUnloadConfirmPopup = std::move(pUserConfirmPopup);
5046 r = __pBeforeUnloadConfirmPopup->ShowPopup();
5047 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pBeforeUnloadConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5063 _WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl)
5066 _FormImpl* pFormImpl = null;
5068 _ControlImpl* pParentControlImpl = dynamic_cast< _ControlImpl* >(pControlImpl->GetParent());
5069 if (!pParentControlImpl)
5074 pFormImpl = dynamic_cast< _FormImpl* >(pParentControlImpl);
5080 return GetParentFormImpl(pParentControlImpl);
5085 _WebImpl::OnFocusGained(const _ControlImpl& source)
5092 _WebImpl::OnFocusLost(const _ControlImpl& source)
5094 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5100 if(IsKeypadVisible() == true)
5102 SetKeypadOpened(true);
5110 _WebImpl::HasValidNativeNode(void) const
5112 if (__pWebCore && __pWebCore->GetWebNativeNode())
5122 _WebImpl::OnPreAttachedToMainTree(void)
5124 result r = E_SUCCESS;
5126 r = _ContainerImpl::OnPreAttachedToMainTree();
5127 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5129 if (!HasValidNativeNode())
5131 r = __pWebCore->InitializeWebNativeNode();
5132 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5134 _ControlManager* pControlManager = _ControlManager::GetInstance();
5135 SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the _ControlManager instance.");
5136 OnChangeLayout(pControlManager->GetScreenRotation());
5138 r = InitializeSetting();
5139 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5141 _SettingInfoImpl::AddSettingEventListener(*this);
5143 _WebManager* pWebManager = _WebManager::GetInstance();
5144 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5145 pWebManager->AddWeb(reinterpret_cast< int >(this));
5148 if (IsVisible() == true)
5150 _WebManager* pWebManager = _WebManager::GetInstance();
5151 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5152 pWebManager->SetActiveWeb(this);
5160 _WebImpl::OnDetachingFromMainTree(void)
5162 result r = E_SUCCESS;
5164 r = _ContainerImpl::OnDetachingFromMainTree();
5165 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5167 _WebManager* pWebManager = _WebManager::GetInstance();
5168 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5169 pWebManager->RemoveActiveWeb(this);
5176 _WebImpl::OnSettingChanged(String& key)
5178 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5184 if (key == L"http://tizen.org/setting/font.type")
5186 ewk_view_use_settings_font(pWebview);
5192 _WebImpl::OnChangeLayout(_ControlRotation rotation)
5194 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5204 case _CONTROL_ROTATION_0:
5207 case _CONTROL_ROTATION_90:
5210 case _CONTROL_ROTATION_180:
5213 case _CONTROL_ROTATION_270:
5219 ewk_view_orientation_send(pWebview, degree);
5224 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
5226 _ContainerImpl::OnChangeLayout(orientation);
5228 if (__pColorPicker.get())
5230 __pColorPicker->ChangeLayout(orientation);
5233 HideFormDataWindow();
5235 std::unique_ptr< IEnumerator > pEnum(__webNotificationList.GetEnumeratorN());
5236 _WebNotification* pWebNotification = null;
5238 while (pEnum->MoveNext() == E_SUCCESS)
5240 pWebNotification = static_cast< _WebNotification* >(pEnum->GetCurrent());
5241 pWebNotification->OnChangeLayout();
5244 if (IsKeypadVisible())
5246 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
5247 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
5249 _FormImpl* pFormImpl = GetParentFormImpl(dynamic_cast< _ControlImpl* >(this));
5250 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(GetPreviousKeypadBounds().height));
5256 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
5258 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5264 _WebManager* pWebManager = _WebManager::GetInstance();
5265 SysTryReturnVoidResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "[E_SYSTEM] Failed to get the _WebManager instance.");
5266 if (IsVisible() == true)
5268 pWebManager->SetActiveWeb(this);
5269 ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
5273 pWebManager->RemoveActiveWeb(this);
5274 ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
5280 _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
5282 _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
5286 case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
5287 __pCertConfirmPopup.reset();
5289 case ID_PROMPT_POPUP_CLOSE:
5290 __pPromptPopup.reset();
5292 case ID_USER_CONFIRM_USERMEDIA_CLOSE:
5293 __pUserMediaConfirmPopup.reset();
5295 case ID_USER_CONFIRM_GEOLOCATION_CLOSE:
5296 __pGeolocationConfirmPopup.reset();
5298 case ID_USER_CONFIRM_NOTIFICATION_CLOSE:
5299 __pNotificationConfirmPopup.reset();
5301 case ID_USER_SCRIPT_ALERT_CLOSE:
5302 __pScriptAlertConfirmPopup.reset();
5304 case ID_USER_SCRIPT_CONFIRM_CLOSE:
5305 __pScriptConfirmPopup.reset();
5308 case ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE:
5309 __pBeforeUnloadConfirmPopup.reset();
5312 case ID_USER_SCRIPT_SELECTBOX_CLOSE:
5313 __pSelectBox.reset();
5324 _WebImpl::GetDownloadHandler(void) const
5326 return __pWebDownloadHandler.get();
5331 _WebImpl::HideColorPicker(void)
5333 __pColorPicker.reset();
5342 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
5344 result r = E_SUCCESS;
5346 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
5347 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5349 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
5351 r = pColorHadler->Construct(colorVal, this);
5352 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5354 __pColorPicker = std::move(pColorHadler);
5356 int modalResult = 0;
5357 r = __pColorPicker->ShowAndWait(modalResult);
5358 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5362 color = __pColorPicker->GetColor();
5368 __pColorPicker.reset();
5377 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
5379 result r = E_SUCCESS;
5381 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
5382 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5384 r = pInputPicker->Construct(String(inputValue), inputType, this);
5385 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5387 __pDatePicker = std::move(pInputPicker);
5389 int modalResult = 0;
5390 r = __pDatePicker->ShowAndWait(modalResult);
5391 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5395 dateStr = __pDatePicker->GetDate();
5401 __pDatePicker.reset();
5410 _WebImpl::GetInstance(Web* pWeb)
5412 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5417 _WebImpl::GetInstance(const Web* pWeb)
5419 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5424 _WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5426 int checkReturn = 0;
5428 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5431 if( checkmime == true)
5433 table = CUSTOM_CONTENT_TABLE_NAME;
5437 table = CUSTOM_PROTOCOL_TABLE_NAME;
5440 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5441 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5442 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5444 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5446 result r = db.Construct(handlerPath, "r+", null);
5447 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5449 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"'"));
5450 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5454 r = pEnum->MoveNext();
5455 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5456 r = pEnum->GetIntAt(0, checkReturn);
5457 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5469 _WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5473 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5476 if( checkmime == true)
5478 table = CUSTOM_CONTENT_TABLE_NAME;
5482 table = CUSTOM_PROTOCOL_TABLE_NAME;
5485 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5486 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5487 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5489 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5491 result r = db.Construct(handlerPath, "r+", null);
5492 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5494 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"'"));
5495 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5499 r = pEnum->MoveNext();
5500 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5501 r = pEnum->GetIntAt(0, checkId);
5502 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5504 std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
5505 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5507 r = pDeleteStmt->BindInt(0, checkId);
5508 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5510 db.BeginTransaction();
5512 std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
5514 db.CommitTransaction();
5521 const Tizen::Base::String
5522 _WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
5524 if (originUri == L"" || currentUri == L"")
5529 result r = E_SUCCESS;
5532 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5533 String originReplace(originUri);
5534 String table(CUSTOM_PROTOCOL_TABLE_NAME);
5538 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5539 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5541 r = currentUri.SubString(0, found + 1, baseUri);
5542 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5544 r = db.Construct(handlerPath, "r+", null);
5545 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5547 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
5548 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
5552 while (pEnum->MoveNext() == E_SUCCESS)
5557 String originScheme;
5559 r = pEnum->GetStringAt(0, protocol);
5560 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5562 r = pEnum->GetStringAt(1, queryUrl);
5563 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5565 r = pEnum->GetIntAt(2, allow);
5566 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5573 String protocolScheme(protocol + L":");
5575 r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
5576 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5578 if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
5580 if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
5582 r = originReplace.Replace(originScheme, "");
5583 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5585 queryUrl.Replace("%s", originReplace, 0);
5586 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5598 const Tizen::Base::String
5599 _WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
5601 if (originUri == L"" || currentUri == L"" || mime == L"")
5606 result r = E_SUCCESS;
5609 String originUrlStr = originUri;
5610 const String replaceStr = L"%s";
5612 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5613 String table(CUSTOM_CONTENT_TABLE_NAME);
5617 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5618 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5620 r = currentUri.SubString(0, found + 1, baseUri);
5621 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5623 r = db.Construct(handlerPath, "r+", null);
5624 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5626 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
5630 r = pEnum->MoveNext();
5631 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5632 r = pEnum->GetIntAt(0, allow);
5633 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5634 r = pEnum->GetStringAt(1, contentUrl);
5635 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5643 if (contentUrl != L"")
5645 r = contentUrl.Replace(replaceStr, originUrlStr, 0);
5646 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5658 _WebImpl::SetFormDataList(Eina_List* pFormDataList)
5660 __pFormDataList = pFormDataList;
5665 _WebImpl::IsFormDataWindowVisible(void) const
5667 return __isFormDataVisible;
5672 _WebImpl::ShowFormDataWindow(const Rectangle& windowRect, Evas_Object* pWebView)
5674 Rectangle rect(_CoordinateSystemUtils::InverseTransform(Rectangle(windowRect.x, windowRect.y + windowRect.height, windowRect.width, windowRect.height)));
5676 if (__isFormDataVisible)
5678 result r = __pFormDataWindow->UpdateList(__pFormDataList, rect);
5679 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5683 __pFormDataWindow.reset();
5685 std::unique_ptr<_FormDataWindow> pFormDataWindow( new (std::nothrow) _FormDataWindow());
5686 SysTryReturnResult(NID_WEB_CTRL, pFormDataWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
5688 result r = pFormDataWindow->Construct(rect, this, pWebView);
5689 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5691 r = pFormDataWindow->UpdateList(__pFormDataList, rect);
5692 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5694 r = pFormDataWindow->LaunchFormDataWindow();
5695 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5697 __pFormDataWindow = std::move(pFormDataWindow);
5698 __isFormDataVisible = true;
5706 _WebImpl::HideFormDataWindow(bool delWindow)
5710 __pFormDataWindow.reset();
5713 __isFormDataVisible = false;
5718 _WebImpl::ClearWebNotification(_WebNotification* pWebNotification)
5720 __webNotificationList.Remove(*pWebNotification);
5725 _WebImpl::SetWebNotification(_WebNotification* pWebNotification)
5727 __webNotificationList.Add(pWebNotification);
5731 }}} // Tizen::Web::Controls