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_SYSTEM, "[%s] Failed to get the _ControlManager instance.", GetErrorMessage(E_SYSTEM));
2297 pWebManager->RemoveWeb(reinterpret_cast< int >(this));
2300 _SettingInfoImpl::RemoveSettingEventListener(*this);
2301 RemoveEventListenerCallback();
2306 _WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
2308 result r = E_SUCCESS;
2310 r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2311 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2313 _Web* pCore = _Web::CreateWebN();
2314 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2316 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2318 r = CheckConstruction(pCore, pImpl);
2319 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2321 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2322 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2324 r = pImpl->Construct();
2325 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2337 _WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
2339 result r = E_SUCCESS;
2341 r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2342 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2344 _Web* pCore = _Web::CreateWebN();
2345 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2347 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2349 r = CheckConstruction(pCore, pImpl);
2350 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2352 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2353 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2355 r = pImpl->Construct();
2356 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2368 _WebImpl::Construct(void)
2370 result r = E_SUCCESS;
2372 r = __mutex.Create();
2373 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2375 r = __textSearch.__searchQueue.Construct();
2376 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2378 r = __webNotificationList.Construct();
2379 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2381 r = InitJsBridgeList();
2382 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2385 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2387 __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
2388 SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
2395 _WebImpl::InitializeSetting(void)
2397 result r = E_SUCCESS;
2399 WebSetting* pWebSetting = __pWebCore->GetSetting();
2400 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(pWebSetting);
2402 SetCookieEnabled(pWebSettingImpl->IsCookieEnabled());
2403 SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
2405 __defaultUserAgent = pWebSettingImpl->GetUserAgent();
2407 r = SetSetting(*pWebSetting);
2408 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2410 SetEventListenerCallback();
2417 _WebImpl::IsLayoutable(void) const
2424 _WebImpl::InitWebEvent(void)
2426 __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
2427 SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2429 return __pWebEvent->Construct(*this);
2434 _WebImpl::GetWebEvent(void) const
2436 return __pWebEvent.get();
2441 _WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
2443 Eina_Hash* pHttpHeader = null;
2445 std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
2446 if (pFieldNameList.get())
2448 pHttpHeader = eina_hash_string_small_new(FreeCharArray);
2449 SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2451 int count = pFieldNameList->GetCount();
2453 for (int i = 0; i < count; i++)
2455 String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
2456 SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2458 std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
2459 SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2461 std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
2462 SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2464 while (pFieldValueEnum->MoveNext() == E_SUCCESS)
2466 Eina_Bool ret = false;
2468 String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
2469 SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2471 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
2472 SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2474 ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
2475 SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2482 eina_hash_free(pHttpHeader);
2489 _WebImpl::LoadUrl(const String& url) const
2491 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2497 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2498 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2500 ewk_view_url_set(pWebview, pUrl.get());
2507 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
2509 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2515 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2516 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2518 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2520 ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
2522 eina_hash_free(pHttpHeader);
2529 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
2531 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2537 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2538 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2540 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2542 ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
2544 eina_hash_free(pHttpHeader);
2551 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
2553 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2559 SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
2561 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
2562 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2563 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
2564 SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2566 ewk_view_contents_set(pWebview, reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
2573 _WebImpl::Pause(void)
2575 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2581 ewk_view_suspend(pWebview);
2586 _WebImpl::Resume(void)
2588 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2594 ewk_view_resume(pWebview);
2599 _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
2601 __pSelectBox.reset();
2603 SysTryReturnResult(NID_WEB_CTRL, eina_list_count(pItems) > 0, E_SYSTEM, "ItemCount is invalid.");
2605 result r = E_SUCCESS;
2607 std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
2608 SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2612 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT - 1, pWebView);
2616 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
2618 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2620 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2621 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2623 __pSelectBox = std::move(pSelectBox);
2625 return __pSelectBox->ShowPopup();
2630 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2632 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2634 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2639 _WebImpl::ClearSelectBoxPopup(void)
2641 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2643 __pSelectBox.reset();
2652 _WebImpl::GetDatepicker(void)
2654 _InputPickerPopup* pInputPicker =null;
2657 pInputPicker = __pDatePicker.get();
2659 return pInputPicker;
2664 _WebImpl::GetColorpicker(void)
2666 _InputPickerPopup* pInputPicker =null;
2669 pInputPicker = __pColorPicker.get();
2671 return pInputPicker;
2676 _WebImpl::CanGoBack(void) const
2678 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2684 return static_cast< bool >(ewk_view_back_possible(pWebview));
2689 _WebImpl::CanGoForward(void) const
2691 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2697 return static_cast< bool >(ewk_view_forward_possible(pWebview));
2702 _WebImpl::GoBack(void) const
2704 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2710 ewk_view_back(pWebview);
2715 _WebImpl::GoForward(void) const
2717 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2723 ewk_view_forward(pWebview);
2728 _WebImpl::GetUrl(void) const
2730 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2736 return ewk_view_url_get(pWebview);
2741 _WebImpl::GetTitle(void) const
2743 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2749 return ewk_view_title_get(pWebview);
2754 _WebImpl::StopLoading(void) const
2756 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2762 ewk_view_stop(pWebview);
2767 _WebImpl::Reload(void) const
2769 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2775 ewk_view_reload(pWebview);
2780 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
2782 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2788 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2789 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2791 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2792 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2794 ewk_view_script_execute(pWebview, pScript.get(), OnScriptExecuted, pPresenter.get());
2796 String* pResult = new (std::nothrow) String(L"");
2797 SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2799 pPresenter->WaitAsyncProcess(*pResult);
2806 _WebImpl::SetZoomLevel(float level)
2808 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2814 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);
2816 ewk_view_scale_set(pWebview, static_cast< double >(level), 0, 0);
2823 _WebImpl::GetZoomLevel(void) const
2825 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2831 return static_cast< float >(ewk_view_scale_get(pWebview));
2835 const PageNavigationList*
2836 _WebImpl::GetBackForwardListN(void) const
2838 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2844 result r = E_SUCCESS;
2846 _PageNavigationListImpl* pNavigationListImpl = null;
2847 _HistoryItemImpl* pHistoryItemImpl = null;
2849 std::unique_ptr<PageNavigationList> pNavigationList;
2850 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2853 int forwardCount = 0;
2858 Ewk_History* pEwkHistoryList = ewk_view_history_get(pWebview);
2859 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2861 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2862 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2864 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2865 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2867 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2868 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2870 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2871 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2873 r = pHistoryList->Construct();
2874 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2876 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2877 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2878 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2880 for (int i = -backCount; i < forwardCount + 1; i++)
2882 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2883 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2885 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2886 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2888 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2889 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2891 url = ewk_history_item_uri_get(pEwkItem);
2892 title = ewk_history_item_title_get(pEwkItem);
2893 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2895 pHistoryItemImpl->SetHistoryItem(url, title);
2897 r = pHistoryList->Add(*pHistoryItem.get());
2898 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2899 pHistoryItem.release();
2902 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2904 ewk_history_free(pEwkHistoryList);
2906 return pNavigationList.release();
2909 ewk_history_free(pEwkHistoryList);
2916 _WebImpl::SearchText(const String& text, bool searchForward)
2918 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2924 result r = E_SUCCESS;
2926 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2930 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2933 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2934 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2936 r = SynchronizeSearch(SEARCH_SYNC, pWebview, condition, text, searchForward, false, pPresenter.get());
2937 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
2940 pPresenter->WaitAsyncProcess(result);
2942 return static_cast < bool >(result);
2947 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2949 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2955 result r = E_SUCCESS;
2957 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2961 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2964 r = SynchronizeSearch(SEARCH_ALL_ASYNC, pWebview, condition, text, true, caseSensitive);
2965 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2972 _WebImpl::SearchNextAsync(bool searchForward)
2974 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2980 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2981 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2982 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2984 result r = E_SUCCESS;
2986 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2988 if (!__textSearch.__caseSensitive)
2990 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2995 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2998 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pWebview, condition, __textSearch.__text, searchForward);
2999 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3006 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
3008 MutexGuard lock(__mutex);
3010 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
3011 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3016 if (__textSearch.__searchAll)
3018 DisableAsyncSearch();
3020 __textSearch.__searchQueue.Enqueue(this);
3021 __textSearch.__searchQueue.Enqueue(pWebPresenter);
3023 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
3024 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3028 __textSearch.__searchQueue.Enqueue(pWebPresenter);
3030 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3034 case SEARCH_ALL_ASYNC:
3035 __textSearch.__searchAll = true;
3036 __textSearch.__text = text;
3037 __textSearch.__searchForward = true;
3038 __textSearch.__caseSensitive = caseSensitive;
3039 __textSearch.__totalCount = -1;
3040 __textSearch.__currentIndex = 1;
3042 __textSearch.__searchQueue.Enqueue(this);
3043 __textSearch.__searchQueue.Enqueue(this);
3045 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
3046 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3049 case SEARCH_NEXT_ASYNC:
3050 __textSearch.__searchForward = searchForward;
3052 CalculateAsyncSearchOrdinal();
3054 __textSearch.__searchQueue.Enqueue(this);
3056 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3068 _WebImpl::SetAsyncSearchResult(int totalCount)
3070 __textSearch.__totalCount = totalCount;
3075 _WebImpl::GetSearchPresenter(void)
3077 MutexGuard lock(__mutex);
3079 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
3084 _WebImpl::GetPendingAsyncSearchCount(void) const
3086 return __textSearch.__searchQueue.GetCount();
3091 _WebImpl::CalculateAsyncSearchOrdinal(void)
3093 if (__textSearch.__searchForward)
3095 __textSearch.__currentIndex++;
3099 __textSearch.__currentIndex--;
3105 _WebImpl::GetAsyncSearchOrdinal(void) const
3107 return __textSearch.__currentIndex;
3112 _WebImpl::DisableAsyncSearch(void)
3114 __textSearch.__searchAll = false;
3119 _WebImpl::SetSetting(const WebSetting& setting)
3121 if (__pWebCore->GetWebNativeNode())
3123 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3124 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3125 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
3127 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
3128 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3130 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
3132 switch (setting.GetCacheControl())
3134 case WEB_CACHE_VALIDATED:
3135 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
3138 case WEB_CACHE_IGNORE:
3139 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
3146 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
3148 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
3152 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
3155 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
3157 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
3159 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
3161 if (__defaultUserAgent != setting.GetUserAgent())
3163 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
3164 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3166 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
3169 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
3171 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
3173 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
3175 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
3178 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
3180 pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
3181 pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
3182 pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
3183 pWebSettingImpl->SetFontSize(setting.GetFontSize());
3184 pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
3185 pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
3186 pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
3187 pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
3188 pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
3189 pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
3190 pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
3191 pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
3192 pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
3199 _WebImpl::GetSetting(void) const
3201 return *__pWebCore->GetSetting();
3205 const HitElementResult*
3206 _WebImpl::GetElementByPointN(const Point& point) const
3208 return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
3212 const HitElementResult*
3213 _WebImpl::GetElementByPointN(const FloatPoint& point) const
3215 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3221 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));
3223 result r = E_SUCCESS;
3225 _HitElementResultImpl* pHitElementResultImpl = null;
3227 std::unique_ptr<HitElementResult> pHitElementResult;
3228 std::unique_ptr<Bitmap> pImage;
3229 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
3231 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
3233 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3234 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
3236 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3237 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
3238 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
3239 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3240 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
3242 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
3244 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
3245 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3247 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
3248 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3250 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
3256 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
3257 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
3258 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
3259 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
3261 r = buf.Construct(imageLength);
3262 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3264 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
3265 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3269 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
3270 // webkit support types such as ico and vp8 additionally
3271 if (strcmp(pExtension, "gif") == 0)
3273 format = IMG_FORMAT_GIF;
3275 else if (strcmp(pExtension, "jpg") == 0)
3277 format = IMG_FORMAT_JPG;
3279 else if (strcmp(pExtension, "png") == 0)
3281 format = IMG_FORMAT_PNG;
3283 else if (strcmp(pExtension, "bmp") == 0)
3285 format = IMG_FORMAT_BMP;
3289 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
3293 r = image.Construct();
3294 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3296 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
3297 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3302 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
3303 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3305 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
3306 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3308 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
3309 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3312 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
3314 ewk_hit_test_free(pEwkHitTest);
3316 return pHitElementResult.release();
3319 ewk_hit_test_free(pEwkHitTest);
3326 _WebImpl::IsLoading(void) const
3328 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3334 double percent = ewk_view_load_progress_get(pWebview);
3336 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
3348 _WebImpl::GetTextFromBlock(void) const
3350 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3356 return ewk_view_text_selection_text_get(pWebview);
3361 _WebImpl::IsPrivateBrowsingEnabled(void) const
3363 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3366 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
3369 Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
3370 SysAssertf(pSettings, "Failed to get webkit instance.");
3372 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
3377 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
3379 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3382 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
3387 Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
3388 SysAssertf(pSettings, "Failed to get webkit instance.");
3390 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
3395 _WebImpl::ClearHistory(void)
3397 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3403 ewk_view_back_forward_list_clear(pWebview);
3408 _WebImpl::ClearCache(void)
3410 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3416 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3418 ewk_context_cache_clear(pContext);
3423 _WebImpl::ClearCookie(void)
3425 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3431 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3432 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3434 ewk_cookie_manager_cookies_clear(pCookieManager);
3439 _WebImpl::ClearFormData(void)
3441 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3447 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3449 ewk_context_form_candidate_data_clear(pContext);
3454 _WebImpl::ClearLoginFormData(void)
3456 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3462 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3464 ewk_context_form_password_data_clear(pContext);
3469 _WebImpl::IsCookieEnabled(void) const
3471 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3474 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
3477 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3478 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3479 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3481 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
3482 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3484 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, pPresenter.get());
3486 bool result = false;
3487 pPresenter->WaitAsyncProcess(result);
3494 _WebImpl::SetCookieEnabled(bool enable)
3496 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3499 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
3504 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3505 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3506 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3510 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
3514 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
3515 ewk_cookie_manager_cookies_clear(pCookieManager);
3521 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
3523 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3529 result r = E_SUCCESS;
3531 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
3532 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3535 String fileExtension = File::GetFileExtension(filePath);
3536 int pathLength = filePath.GetLength();
3539 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
3541 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
3542 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3543 r = filePath.SubString(0, index + 1, dirPath);
3544 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3546 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
3547 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
3551 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
3553 ewk_view_contents_pdf_get(pWebview, pSize->width, pSize->height, pFilePath.get());
3557 Evas_Coord contentsWidth;
3558 Evas_Coord contentsHeight;
3560 ewk_view_contents_size_get(pWebview, &contentsWidth, &contentsHeight);
3561 ewk_view_contents_pdf_get(pWebview, contentsWidth, contentsHeight, pFilePath.get());
3569 _WebImpl::IsMimeSupported(const String& mime) const
3571 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3577 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
3578 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3580 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(pWebview), pMime.get()));
3585 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
3587 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
3592 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
3594 __pUserUiListener = pUiEventListener;
3599 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
3601 __pUserUiListenerF = pUiEventListener;
3606 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
3608 __pUserKeypadEventListener = pKeypadEventListener;
3613 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
3615 if (__pWebDownloadHandler.get() == null)
3617 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
3618 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3621 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
3622 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
3627 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
3629 __pTextSearchListener = pTextSearchListener;
3634 _WebImpl::SetScrollEnabled(bool enable)
3636 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
3641 _WebImpl::IsScrollEnabled(void) const
3643 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
3648 _WebImpl::InitJsBridgeList(void)
3650 result r = E_SUCCESS;
3652 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
3653 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3655 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
3656 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3658 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
3659 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3661 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
3662 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3664 __pJsBridgeList = std::move(pJsBridgeList);
3671 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3673 result r = E_SUCCESS;
3675 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3676 String key(pJsBridge->GetName());
3678 r = __pJsBridgeList->Add(key, pJsBridge);
3679 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3686 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3688 result r = E_SUCCESS;
3690 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3691 String key(pJsBridge->GetName());
3693 r = __pJsBridgeList->Remove(key);
3694 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3701 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3703 result r = E_SUCCESS;
3705 IJsonValue* pJsonValue = null;
3706 IJavaScriptBridge* pJsBridge = null;
3708 String key(L"name");
3710 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3711 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));
3713 r = pJsonObject->GetValue(&key, pJsonValue);
3714 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3716 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3717 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3719 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3720 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3727 _WebImpl::GetLoadingListener(void) const
3729 return __pUserLoadingListener;
3733 IWebUiEventListener*
3734 _WebImpl::GetUiEventListener(void) const
3736 return __pUserUiListener;
3740 IWebUiEventListenerF*
3741 _WebImpl::GetUiEventListenerF(void) const
3743 return __pUserUiListenerF;
3747 IWebKeypadEventListener*
3748 _WebImpl::GetWebKeypadEventListener(void) const
3750 return __pUserKeypadEventListener;
3754 ITextSearchListener*
3755 _WebImpl::GetTextSearchListener(void) const
3757 return __pTextSearchListener;
3762 _WebImpl::SetEventListenerCallback(void) const
3764 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3767 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3768 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3770 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3771 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3773 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3774 SysAssertf(pSmartData, "Failed to request");
3776 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3777 SysAssertf(pSmart, "Failed to request");
3779 pSmart->popup_menu_show = OnSelectBoxRequested;
3780 pSmart->multiple_popup_menu_show = OnMultiSelectBoxRequested;
3781 pSmart->popup_menu_hide = OnSelectBoxClosed;
3782 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3784 pSmart->input_picker_show = OnDatePickerProviderRequested;
3785 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3786 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3788 pSmart->formdata_candidate_show = OnFormDataCandidateShow;
3789 pSmart->formdata_candidate_hide = OnFormDataCandidateHide;
3790 pSmart->formdata_candidate_update_data = OnFormDataCandidateUpdate;
3791 pSmart->formdata_candidate_is_showing = OnFormDataCandidateIsShowing;
3793 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3795 // add loading event callbacks for ILoadingListener
3796 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3797 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3799 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3800 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3801 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3802 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3803 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3804 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3805 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3806 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3807 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3809 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3811 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3812 evas_object_smart_callback_add(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3814 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3815 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3816 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3818 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3819 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3821 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3823 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3824 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3825 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3826 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, OnBeforeUnloadConfirmRequested, const_cast< _WebImpl* >(this));
3828 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3830 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3831 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3832 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3834 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3835 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3836 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3838 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3839 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3840 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3842 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3843 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3844 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3845 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3847 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3848 evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
3850 evas_object_smart_callback_add(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected, this);
3852 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
3853 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
3855 evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
3856 evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
3858 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3859 SysAssertf(pContext, "Failed to get webkit instance.");
3860 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3861 ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
3863 ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
3864 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3865 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3866 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
3868 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3869 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost, this);
3875 _WebImpl::RemoveEventListenerCallback(void) const
3877 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3880 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3881 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3883 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3884 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3886 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3887 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3889 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3890 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3891 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3892 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3893 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3894 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3895 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3896 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3897 evas_object_smart_callback_del(pWebNativeNode, "load,committed", OnLoadingCommitted);
3899 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3901 evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3902 evas_object_smart_callback_del_full(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3904 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3905 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3906 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3908 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3909 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3911 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3913 ewk_view_javascript_alert_callback_set(pWebNativeNode, null, null);
3914 ewk_view_javascript_prompt_callback_set(pWebNativeNode, null, null);
3915 ewk_view_javascript_confirm_callback_set(pWebNativeNode, null, null);
3916 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, null, null);
3918 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3920 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3921 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3922 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3924 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3925 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3926 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3927 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3928 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3929 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3931 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3932 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3933 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3935 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3937 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3938 evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
3940 evas_object_smart_callback_del(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected);
3942 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
3943 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
3945 evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
3946 evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
3948 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3949 SysAssertf(pContext, "Failed to get webkit instance.");
3950 ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
3952 ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
3953 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
3954 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
3955 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
3957 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3958 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost);
3964 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3966 return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
3971 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
3973 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3979 Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pWebview));
3980 SysAssertf(pSmartData && pSmartData->api, "Failed to get webkit instance.");
3981 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
3983 Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3986 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3988 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3989 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
3991 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3993 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3994 char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
3995 if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
3997 ewk_view_command_execute(pWebview, "SelectWord", 0);
3998 evas_object_smart_callback_call(pWebview, "magnifier,hide", NULL);
4002 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
4009 _WebImpl::ReleaseBlock(void)
4011 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4017 ewk_view_text_selection_range_clear(pWebview);
4022 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
4024 FloatPoint tempStartPoint;
4025 FloatPoint tempEndPoint;
4027 GetBlockRange(tempStartPoint, tempEndPoint);
4029 startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
4030 endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
4035 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
4037 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4040 startPoint.x = startPoint.y = endPoint.x = endPoint.y = 0.0f;
4044 Eina_Rectangle leftHandle;
4045 Eina_Rectangle rightHandle;
4047 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
4048 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
4050 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
4052 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
4053 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
4054 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
4055 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
4057 if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
4059 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
4060 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
4066 _WebImpl::GetFaviconN(void) const
4068 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4074 result r = E_SUCCESS;
4076 Ewk_Context* pContext = ewk_view_context_get(pWebview);
4077 const char* pUrl = ewk_view_url_get(pWebview);
4078 Evas* pEvas = evas_object_evas_get(pWebview);
4080 Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
4086 Tizen::Graphics::BufferInfo bufferInfo;
4088 r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
4089 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4091 const Dimension dimension(bufferInfo.width, bufferInfo.height);
4092 Tizen::Base::ByteBuffer byteBuffer;
4094 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
4095 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4097 std::unique_ptr<Bitmap> pImage(new (std::nothrow) Bitmap());
4098 SysTryReturn(NID_WEB_CTRL, pImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4100 r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
4101 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4103 return pImage.release();
4109 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
4111 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4117 ewk_view_scroll_by(pWebview, diff.x, diff.y);
4122 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
4124 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4130 ewk_view_scroll_set(pWebview, dest.x, dest.y);
4135 _WebImpl::GetScrollPosition(void) const
4137 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4145 ewk_view_scroll_pos_get(pWebview, &position.x, &position.y);
4152 _WebImpl::GetPageSize(void) const
4154 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4157 return Dimension(0, 0);
4160 Evas_Coord width = 0;
4161 Evas_Coord height = 0;
4163 ewk_view_contents_size_get(pWebview, &width, &height);
4165 Dimension size(static_cast< int >(width), static_cast< int >(height));
4172 _WebImpl::SetLoadingErrorOccurred(bool arg)
4174 __isLoadingErrorOccurred = arg;
4179 _WebImpl::IsLoadingErrorOccurred(void) const
4181 return __isLoadingErrorOccurred;
4186 _WebImpl::SetRedirectRequested(bool arg)
4188 __isRedirectRequested = arg;
4193 _WebImpl::IsRedirectRequested(void) const
4195 return __isRedirectRequested;
4200 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
4207 _WebImpl::GetPolicyDecision(void) const
4214 _WebImpl::SetCertificateRequested(bool arg)
4216 __isCertificateRequested = arg;
4221 _WebImpl::IsCertificateRequested(void) const
4223 return __isCertificateRequested;
4228 _WebImpl::SetCertificateConfirmed(bool arg)
4230 __isCertificateConfirmed = arg;
4235 _WebImpl::IsCertificateConfirmed(void) const
4237 return __isCertificateConfirmed;
4242 _WebImpl::SetFullScreenKeypad(void)
4244 result r = E_SUCCESS;
4246 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
4247 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4249 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
4250 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4252 String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
4253 pKeypad->SetText(text);
4255 r = pKeypad->SetShowState(true);
4256 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4258 r = pKeypad->Show();
4259 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4261 pKeypad->AddTextEventListener(*this);
4263 __pKeypad = std::move(pKeypad);
4270 _WebImpl::RemoveFullScreenKeypad(void)
4272 __pKeypad->RemoveTextEventListener(*this);
4279 _WebImpl::IsFooterVisible(void) const
4281 return __isFooterVisible;
4286 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
4288 __isFooterVisible = isFooterVisible;
4293 _WebImpl::IsKeypadVisible(void) const
4295 return __isKeypadVisible;
4300 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
4302 __isKeypadVisible = isKeypadVisible;
4307 _WebImpl::IsKeypadOpened(void) const
4309 return __isKeypadOpened;
4313 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
4315 __isKeypadOpened = isKeypadOpened;
4320 _WebImpl::IsWinFocusLost(void) const
4322 return __isWinFocusLost;
4327 _WebImpl::SetWinFocusLost(bool isWinFocusLost)
4329 __isWinFocusLost = isWinFocusLost;
4334 _WebImpl::GetPreviousKeypadBounds(void) const
4336 return __keypadBounds;
4341 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
4343 __keypadBounds = bounds;
4348 _WebImpl::OnTextValueChangeCanceled(const Control& source)
4350 RemoveFullScreenKeypad();
4355 _WebImpl::OnTextValueChanged(const Control& source)
4357 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
4359 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
4361 RemoveFullScreenKeypad();
4366 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
4368 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
4369 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
4371 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
4372 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4374 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
4375 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
4377 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
4384 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
4386 result r = E_SUCCESS;
4388 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
4389 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4391 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4393 ILoadingListener* pLoadingListner = GetLoadingListener();
4394 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
4396 switch (pEventArg->GetEventType())
4398 case WEB_EVENT_LOADINGLISTENER_STARTED:
4400 pLoadingListner->OnLoadingStarted();
4404 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
4406 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
4407 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4409 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
4413 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
4415 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
4416 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4418 pLoadingListner->OnPageTitleReceived(*pPageTitle);
4422 case WEB_EVENT_LOADINGLISTENER_CANCELED:
4424 pLoadingListner->OnLoadingCanceled();
4428 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
4430 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
4431 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4433 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
4434 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4436 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
4438 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
4442 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
4444 pLoadingListner->OnLoadingCompleted();
4448 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
4450 pLoadingListner->OnHttpAuthenticationCanceled();
4454 case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
4456 std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
4457 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4461 pLoadingListner->OnFaviconReceived(*pFavicon.get());
4477 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
4479 result r = E_SUCCESS;
4481 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
4482 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4484 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4486 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
4487 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
4489 switch (pEventArg->GetEventType())
4491 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
4493 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
4494 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4496 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
4500 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
4502 pWebDownloadListener->OnWebDataDownloadCompleted();
4506 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
4508 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
4509 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4511 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
4513 pWebDownloadListener->OnWebDownloadFailed(errorType);
4528 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
4530 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4531 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4533 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4535 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4537 switch (pEventArg->GetEventType())
4539 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
4541 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4543 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4544 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4546 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4547 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4549 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4553 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
4555 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4557 __pUserUiListener->OnWebPageShowRequested(*pWeb);
4561 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
4563 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4565 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
4569 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
4571 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4573 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4574 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4576 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4591 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
4593 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4594 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4596 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4598 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4600 switch (pEventArg->GetEventType())
4602 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
4604 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4606 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4607 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4609 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4610 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4612 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4616 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
4618 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4620 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
4624 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
4626 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4628 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
4632 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
4634 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4636 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4637 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4639 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4654 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
4656 result r = E_SUCCESS;
4658 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
4659 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4661 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4663 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
4664 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
4666 switch (pEventArg->GetEventType())
4668 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4670 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4671 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4673 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4674 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4676 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4691 _WebImpl::VibrationRequested(uint64_t duration)
4693 result r = E_SUCCESS;
4695 __pVibrator.reset();
4697 std::unique_ptr<Vibrator> pVibrator(new (std::nothrow) Vibrator());
4698 SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4700 r = pVibrator->Construct();
4701 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4703 __pVibrator = std::move(pVibrator);
4705 IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
4707 r = __pVibrator->Start(&pattern, 1);
4708 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4715 _WebImpl::VibrationCanceled(void)
4717 __pVibrator.reset();
4722 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4724 result r = E_SUCCESS;
4726 String host(ewk_auth_challenge_url_get(pChallenge));
4727 String realm(ewk_auth_challenge_realm_get(pChallenge));
4729 __pAuthChallenge.reset();
4731 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4732 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4734 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4735 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4737 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4738 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4740 __pAuthChallenge = std::move(pAuthChallenge);
4742 ewk_auth_challenge_suspend(pChallenge);
4743 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4745 __pAuthChallenge.release();
4749 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4750 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4758 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4760 result r = E_SUCCESS;
4762 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4763 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4765 r = pAuthPopup->Construct(host, realm, pAuthChallenge);
4766 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4768 __pAuthPopup = std::move(pAuthPopup);
4770 int modalResult = 0;
4772 r = __pAuthPopup->ShowAndWait(modalResult);
4773 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4778 __pAuthPopup.reset();
4786 _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
4788 result r = E_SUCCESS;
4790 std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
4791 SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4793 r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
4794 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4796 __pCertConfirmPopup = std::move(pCertConfirmPopup);
4798 int modalResult = 0;
4800 r = __pCertConfirmPopup->ShowAndWait(modalResult);
4801 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4803 if (__pCertConfirmPopup.get() && userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
4805 __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
4809 if (__pCertConfirmPopup.get())
4811 __pCertConfirmPopup.reset();
4819 _WebImpl::ShowPromptPopup(String msg, String defVal)
4821 result r = E_SUCCESS;
4823 std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
4824 SysTryReturnResult(NID_WEB_CTRL, pPromptPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4826 r = pPromptPopup->Construct(msg, defVal, __pWebCore->GetWebNativeNode(), this);
4827 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4829 __pPromptPopup = std::move(pPromptPopup);
4831 r = __pPromptPopup->ShowPopup();
4832 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4837 __pPromptPopup.reset();
4845 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4847 result r = E_SUCCESS;
4849 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4850 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4852 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, true, msg);
4853 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4855 int modalResult = 0;
4857 switch(userConfirmMode)
4859 case USER_CONTENT_HANDLER:
4861 __pContentHandlerConfirmPopup = std::move(pUserConfirmPopup);
4863 r = __pContentHandlerConfirmPopup->ShowAndWait(modalResult);
4864 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pContentHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4866 __pContentHandlerConfirmPopup.reset();
4868 ewk_view_resume(__pWebCore->GetWebNativeNode());
4872 case USER_PROTOCOL_HANDLER:
4874 __pProtocolHandlerConfirmPopup = std::move(pUserConfirmPopup);
4876 r = __pProtocolHandlerConfirmPopup->ShowAndWait(modalResult);
4877 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pProtocolHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4879 __pProtocolHandlerConfirmPopup.reset();
4881 ewk_view_resume(__pWebCore->GetWebNativeNode());
4885 case USER_CONFIRM_APP_CACHE:
4887 __pAppCacheConfirmPopup = std::move(pUserConfirmPopup);
4889 r = __pAppCacheConfirmPopup->ShowAndWait(modalResult);
4890 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pAppCacheConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4892 __pAppCacheConfirmPopup.reset();
4894 ewk_view_resume(__pWebCore->GetWebNativeNode());
4898 case USER_CONFIRM_DB_QUOTA_EXCEDED:
4900 __pDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4902 r = __pDbQuotaConfirmPopup->ShowAndWait(modalResult);
4903 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4905 __pDbQuotaConfirmPopup.reset();
4907 ewk_view_resume(__pWebCore->GetWebNativeNode());
4911 case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
4913 __pLocalFsQuotaConfirmPopup = std::move(pUserConfirmPopup);
4915 r = __pLocalFsQuotaConfirmPopup->ShowAndWait(modalResult);
4916 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pLocalFsQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4918 __pLocalFsQuotaConfirmPopup.reset();
4920 ewk_view_resume(__pWebCore->GetWebNativeNode());
4924 case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
4926 __pIndexedDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4928 r = __pIndexedDbQuotaConfirmPopup->ShowAndWait(modalResult);
4929 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4931 __pIndexedDbQuotaConfirmPopup.reset();
4933 ewk_view_resume(__pWebCore->GetWebNativeNode());
4946 _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4948 result r = E_SUCCESS;
4950 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4951 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4953 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, false, msg);
4954 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4956 switch(userConfirmMode)
4958 case USER_CONFIRM_USERMEDIA:
4960 __pUserMediaConfirmPopup.reset();
4962 __pUserMediaConfirmPopup = std::move(pUserConfirmPopup);
4964 r = __pUserMediaConfirmPopup->ShowPopup();
4965 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pUserMediaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4969 case USER_CONFIRM_GEOLOCATION:
4971 __pGeolocationConfirmPopup.reset();
4973 __pGeolocationConfirmPopup = std::move(pUserConfirmPopup);
4975 r = __pGeolocationConfirmPopup->ShowPopup();
4976 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pGeolocationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4980 case USER_CONFIRM_NOTIFICATION:
4982 __pNotificationConfirmPopup.reset();
4984 __pNotificationConfirmPopup = std::move(pUserConfirmPopup);
4986 r = __pNotificationConfirmPopup->ShowPopup();
4987 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pNotificationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4991 case USER_SCRIPT_ALERT:
4993 __pScriptAlertConfirmPopup.reset();
4995 __pScriptAlertConfirmPopup = std::move(pUserConfirmPopup);
4997 r = __pScriptAlertConfirmPopup->ShowPopup();
4998 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptAlertConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5002 case USER_SCRIPT_CONFIRM:
5004 __pScriptConfirmPopup.reset();
5006 __pScriptConfirmPopup = std::move(pUserConfirmPopup);
5008 r = __pScriptConfirmPopup->ShowPopup();
5009 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5013 case USER_BEFORE_UNLOAD_CONFIRM:
5015 __pBeforeUnloadConfirmPopup.reset();
5017 __pBeforeUnloadConfirmPopup = std::move(pUserConfirmPopup);
5019 r = __pBeforeUnloadConfirmPopup->ShowPopup();
5020 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pBeforeUnloadConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5036 _WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl)
5039 _FormImpl* pFormImpl = null;
5041 _ControlImpl* pParentControlImpl = dynamic_cast< _ControlImpl* >(pControlImpl->GetParent());
5042 if (!pParentControlImpl)
5047 pFormImpl = dynamic_cast< _FormImpl* >(pParentControlImpl);
5053 return GetParentFormImpl(pParentControlImpl);
5058 _WebImpl::OnFocusGained(const _ControlImpl& source)
5065 _WebImpl::OnFocusLost(const _ControlImpl& source)
5067 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5073 if(IsKeypadVisible() == true)
5075 SetKeypadOpened(true);
5083 _WebImpl::HasValidNativeNode(void) const
5085 if (__pWebCore && __pWebCore->GetWebNativeNode())
5095 _WebImpl::OnPreAttachedToMainTree(void)
5097 result r = E_SUCCESS;
5099 r = _ContainerImpl::OnPreAttachedToMainTree();
5100 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5102 if (!HasValidNativeNode())
5104 r = __pWebCore->InitializeWebNativeNode();
5105 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5107 _ControlManager* pControlManager = _ControlManager::GetInstance();
5108 SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the _ControlManager instance.");
5109 OnChangeLayout(pControlManager->GetScreenRotation());
5111 r = InitializeSetting();
5112 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5114 _SettingInfoImpl::AddSettingEventListener(*this);
5116 _WebManager* pWebManager = _WebManager::GetInstance();
5117 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5118 pWebManager->AddWeb(reinterpret_cast< int >(this));
5121 if (IsVisible() == true)
5123 _WebManager* pWebManager = _WebManager::GetInstance();
5124 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5125 pWebManager->SetActiveWeb(this);
5133 _WebImpl::OnDetachingFromMainTree(void)
5135 result r = E_SUCCESS;
5137 r = _ContainerImpl::OnDetachingFromMainTree();
5138 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5140 _WebManager* pWebManager = _WebManager::GetInstance();
5141 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5142 pWebManager->RemoveActiveWeb(this);
5149 _WebImpl::OnSettingChanged(String& key)
5151 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5157 if (key == L"http://tizen.org/setting/font.type")
5159 ewk_view_use_settings_font(pWebview);
5165 _WebImpl::OnChangeLayout(_ControlRotation rotation)
5167 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5177 case _CONTROL_ROTATION_0:
5180 case _CONTROL_ROTATION_90:
5183 case _CONTROL_ROTATION_180:
5186 case _CONTROL_ROTATION_270:
5192 ewk_view_orientation_send(pWebview, degree);
5197 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
5199 _ContainerImpl::OnChangeLayout(orientation);
5201 if (__pColorPicker.get())
5203 __pColorPicker->ChangeLayout(orientation);
5206 HideFormDataWindow();
5208 std::unique_ptr< IEnumerator > pEnum(__webNotificationList.GetEnumeratorN());
5209 _WebNotification* pWebNotification = null;
5211 while (pEnum->MoveNext() == E_SUCCESS)
5213 pWebNotification = static_cast< _WebNotification* >(pEnum->GetCurrent());
5214 pWebNotification->OnChangeLayout();
5217 if (IsKeypadVisible())
5219 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
5220 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
5222 _FormImpl* pFormImpl = GetParentFormImpl(dynamic_cast< _ControlImpl* >(this));
5223 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(GetPreviousKeypadBounds().height));
5229 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
5231 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5237 _WebManager* pWebManager = _WebManager::GetInstance();
5238 SysTryReturnVoidResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "[E_SYSTEM] Failed to get the _WebManager instance.");
5239 if (IsVisible() == true)
5241 pWebManager->SetActiveWeb(this);
5242 ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
5246 pWebManager->RemoveActiveWeb(this);
5247 ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
5253 _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
5255 _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
5259 case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
5260 __pCertConfirmPopup.reset();
5262 case ID_PROMPT_POPUP_CLOSE:
5263 __pPromptPopup.reset();
5265 case ID_USER_CONFIRM_USERMEDIA_CLOSE:
5266 __pUserMediaConfirmPopup.reset();
5268 case ID_USER_CONFIRM_GEOLOCATION_CLOSE:
5269 __pGeolocationConfirmPopup.reset();
5271 case ID_USER_CONFIRM_NOTIFICATION_CLOSE:
5272 __pNotificationConfirmPopup.reset();
5274 case ID_USER_SCRIPT_ALERT_CLOSE:
5275 __pScriptAlertConfirmPopup.reset();
5277 case ID_USER_SCRIPT_CONFIRM_CLOSE:
5278 __pScriptConfirmPopup.reset();
5281 case ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE:
5282 __pBeforeUnloadConfirmPopup.reset();
5285 case ID_USER_SCRIPT_SELECTBOX_CLOSE:
5286 __pSelectBox.reset();
5297 _WebImpl::GetDownloadHandler(void) const
5299 return __pWebDownloadHandler.get();
5304 _WebImpl::HideColorPicker(void)
5306 __pColorPicker.reset();
5315 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
5317 result r = E_SUCCESS;
5319 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
5320 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5322 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
5324 r = pColorHadler->Construct(colorVal, this);
5325 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5327 __pColorPicker = std::move(pColorHadler);
5329 int modalResult = 0;
5330 r = __pColorPicker->ShowAndWait(modalResult);
5331 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5335 color = __pColorPicker->GetColor();
5341 __pColorPicker.reset();
5350 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
5352 result r = E_SUCCESS;
5354 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
5355 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5357 r = pInputPicker->Construct(String(inputValue), inputType, this);
5358 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5360 __pDatePicker = std::move(pInputPicker);
5362 int modalResult = 0;
5363 r = __pDatePicker->ShowAndWait(modalResult);
5364 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5368 dateStr = __pDatePicker->GetDate();
5374 __pDatePicker.reset();
5383 _WebImpl::GetInstance(Web* pWeb)
5385 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5390 _WebImpl::GetInstance(const Web* pWeb)
5392 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5397 _WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5399 int checkReturn = 0;
5401 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5404 if( checkmime == true)
5406 table = CUSTOM_CONTENT_TABLE_NAME;
5410 table = CUSTOM_PROTOCOL_TABLE_NAME;
5413 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5414 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5415 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5417 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5419 result r = db.Construct(handlerPath, "r+", null);
5420 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5422 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"'"));
5423 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5427 r = pEnum->MoveNext();
5428 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5429 r = pEnum->GetIntAt(0, checkReturn);
5430 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5442 _WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5446 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5449 if( checkmime == true)
5451 table = CUSTOM_CONTENT_TABLE_NAME;
5455 table = CUSTOM_PROTOCOL_TABLE_NAME;
5458 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5459 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5460 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5462 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5464 result r = db.Construct(handlerPath, "r+", null);
5465 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5467 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"'"));
5468 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5472 r = pEnum->MoveNext();
5473 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5474 r = pEnum->GetIntAt(0, checkId);
5475 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5477 std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
5478 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5480 r = pDeleteStmt->BindInt(0, checkId);
5481 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5483 db.BeginTransaction();
5485 std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
5487 db.CommitTransaction();
5494 const Tizen::Base::String
5495 _WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
5497 if (originUri == L"" || currentUri == L"")
5502 result r = E_SUCCESS;
5505 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5506 String originReplace(originUri);
5507 String table(CUSTOM_PROTOCOL_TABLE_NAME);
5511 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5512 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5514 r = currentUri.SubString(0, found + 1, baseUri);
5515 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5517 r = db.Construct(handlerPath, "r+", null);
5518 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5520 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
5521 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
5525 while (pEnum->MoveNext() == E_SUCCESS)
5530 String originScheme;
5532 r = pEnum->GetStringAt(0, protocol);
5533 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5535 r = pEnum->GetStringAt(1, queryUrl);
5536 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5538 r = pEnum->GetIntAt(2, allow);
5539 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5546 String protocolScheme(protocol + L":");
5548 r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
5549 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5551 if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
5553 if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
5555 r = originReplace.Replace(originScheme, "");
5556 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5558 queryUrl.Replace("%s", originReplace, 0);
5559 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5571 const Tizen::Base::String
5572 _WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
5574 if (originUri == L"" || currentUri == L"" || mime == L"")
5579 result r = E_SUCCESS;
5582 String originUrlStr = originUri;
5583 const String replaceStr = L"%s";
5585 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5586 String table(CUSTOM_CONTENT_TABLE_NAME);
5590 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5591 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5593 r = currentUri.SubString(0, found + 1, baseUri);
5594 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5596 r = db.Construct(handlerPath, "r+", null);
5597 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5599 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
5603 r = pEnum->MoveNext();
5604 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5605 r = pEnum->GetIntAt(0, allow);
5606 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5607 r = pEnum->GetStringAt(1, contentUrl);
5608 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5616 if (contentUrl != L"")
5618 r = contentUrl.Replace(replaceStr, originUrlStr, 0);
5619 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5631 _WebImpl::SetFormDataList(Eina_List* pFormDataList)
5633 __pFormDataList = pFormDataList;
5638 _WebImpl::IsFormDataWindowVisible(void) const
5640 return __isFormDataVisible;
5645 _WebImpl::ShowFormDataWindow(const Rectangle& windowRect, Evas_Object* pWebView)
5647 Rectangle rect(_CoordinateSystemUtils::InverseTransform(Rectangle(windowRect.x, windowRect.y + windowRect.height, windowRect.width, windowRect.height)));
5649 if (__isFormDataVisible)
5651 result r = __pFormDataWindow->UpdateList(__pFormDataList, rect);
5652 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5656 __pFormDataWindow.reset();
5658 std::unique_ptr<_FormDataWindow> pFormDataWindow( new (std::nothrow) _FormDataWindow());
5659 SysTryReturnResult(NID_WEB_CTRL, pFormDataWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
5661 result r = pFormDataWindow->Construct(rect, this, pWebView);
5662 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5664 r = pFormDataWindow->UpdateList(__pFormDataList, rect);
5665 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5667 r = pFormDataWindow->LaunchFormDataWindow();
5668 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5670 __pFormDataWindow = std::move(pFormDataWindow);
5671 __isFormDataVisible = true;
5679 _WebImpl::HideFormDataWindow(bool delWindow)
5683 __pFormDataWindow.reset();
5686 __isFormDataVisible = false;
5691 _WebImpl::ClearWebNotification(_WebNotification* pWebNotification)
5693 __webNotificationList.Remove(*pWebNotification);
5698 _WebImpl::SetWebNotification(_WebNotification* pWebNotification)
5700 __webNotificationList.Add(pWebNotification);
5704 }}} // Tizen::Web::Controls