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;
533 r = message.Format(512,
534 pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_STORE_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
535 _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
536 ewk_security_origin_host_get(pSecOrigin));
537 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
539 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_APP_CACHE, pView, message);
540 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
545 ewk_view_application_cache_permission_reply(pView, EINA_FALSE);
551 OnIndexedDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
553 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
554 SysAssertf(pImpl , "Failed to request");
556 _SystemResource* pSysResource = _SystemResource::GetInstance();
557 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
559 result r = E_SUCCESS;
562 r = message.Format(512,
563 pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
564 _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
565 ewk_security_origin_host_get(pSecOrigin));
566 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
568 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, pView, message);
569 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
574 ewk_view_exceeded_indexed_database_quota_reply(pView, EINA_FALSE);
580 OnDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, const char* database_name, unsigned long long expectedQuota, void* pUserData)
582 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
583 SysAssertf(pImpl , "Failed to request");
585 _SystemResource* pSysResource = _SystemResource::GetInstance();
586 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
588 result r = E_SUCCESS;
591 r = message.Format(512,
592 pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
593 _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
594 ewk_security_origin_host_get(pSecOrigin));
595 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
597 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_DB_QUOTA_EXCEDED, pView, message);
598 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
603 ewk_view_exceeded_database_quota_reply(pView, EINA_FALSE);
609 OnLocalFileSystemQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
611 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
612 SysAssertf(pImpl , "Failed to request");
614 _SystemResource* pSysResource = _SystemResource::GetInstance();
615 SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
617 result r = E_SUCCESS;
620 r = message.Format(512,
621 pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_P1SS_HP2SS_IS_ATTEMPTING_TO_STORE_A_LARGE_AMOUNT_OF_DATA_ON_YOUR_DEVICE_FOR_OFFLINE_USE").GetPointer(),
622 _StringConverter::CopyToCharArrayN(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_THIS_WEBPAGE")),
623 ewk_security_origin_host_get(pSecOrigin));
624 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
626 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, pView, message);
627 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
632 ewk_view_exceeded_local_file_system_quota_reply(pView, EINA_FALSE);
638 OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
640 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
641 Ewk_Geolocation_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(pEventInfo);
642 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
644 if (pImpl->GetSetting().IsGeolocationEnabled())
646 result r = E_SUCCESS;
648 std::unique_ptr<DbEnumerator> pEnum;
650 String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
651 String table(GEOLOCATION_TABLE_NAME);
654 const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPermissionRequest);
655 String origin = _Utility::CreateOrigin(pSecurityOrigin);
657 r = db.Construct(geolocationPath, "r", null);
658 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
660 pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select permission From " + table + L" Where origin = '" + origin + L"'"));
663 r = pEnum->MoveNext();
664 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
667 r = pEnum->GetIntAt(0, permission);
668 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
670 SysLog(NID_WEB_CTRL, "The current value of permission is %d", permission);
672 ewk_geolocation_permission_request_set(pPermissionRequest, static_cast < Eina_Bool >(permission));
676 ewk_geolocation_permission_request_suspend(pPermissionRequest);
678 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_GEOLOCATION, pPermissionRequest);
679 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
686 ewk_geolocation_permission_request_set(pPermissionRequest, EINA_FALSE);
691 OnGetUserMediaPermissionRequsted(void* pUserData, Evas_Object* pView, void* pEventInfo)
693 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
694 Ewk_User_Media_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_User_Media_Permission_Request* >(pEventInfo);
695 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
697 result r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_USERMEDIA, pEventInfo);
698 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
702 ewk_user_media_permission_request_set(pPermissionRequest, EINA_FALSE);
707 OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
709 result r = E_SUCCESS;
710 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
712 Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(pEventInfo);
713 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
715 ewk_notification_permission_request_suspend(pPermissionRequest);
717 r = pImpl->ShowUserConfirmPopupAsync(USER_CONFIRM_NOTIFICATION, pPermissionRequest);
718 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
722 ewk_notification_permission_request_set(pPermissionRequest, EINA_FALSE);
727 OnNotificationShow(void* pUserData, Evas_Object* pView, void* pEventInfo)
729 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
730 Ewk_Notification* pNotification = reinterpret_cast< Ewk_Notification* >(pEventInfo);
731 SysAssertf(pImpl && pNotification, "Failed to request");
733 result r = E_SUCCESS;
734 Ewk_Context* pContext = ewk_view_context_get(pView);
735 SysAssertf(pContext, "Failed to get webkit instance.");
736 uint64_t notificationId = ewk_notification_id_get(pNotification);
738 //ewk_notification_security_origin_get(pNotification)
740 const char* text = ewk_notification_body_get(pNotification);
741 SysSecureLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
743 std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification());
744 SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
746 r = pNotificationWindow->Construct(pContext, notificationId, pImpl);
747 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error propogated.", GetErrorMessage(r));
749 pNotificationWindow->SetText(String(text));
750 pNotificationWindow->LaunchNotification();
751 pImpl->SetWebNotification(pNotificationWindow.release());
753 ewk_notification_showed(pContext, notificationId);
758 OnNotificationCancel(void* pUserData, Evas_Object* pView, void* pEventInfo)
760 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
761 uint64_t* pNotificationID = reinterpret_cast< uint64_t* >(pEventInfo);
762 SysAssertf(pImpl && pNotificationID, "Failed to request");
764 //ToDo : Where is ewk API for cancel operation?
769 OnProtocolHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
771 result r = E_SUCCESS;
772 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
773 SysAssertf(pImpl, "Failed to request");
775 r = pImpl->ShowUserConfirmPopup(USER_PROTOCOL_HANDLER, pEventInfo);
776 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
781 OnIsProtocolHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
783 int checkHandler = 0;
784 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
785 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
786 SysAssertf(pImpl && pHandlerData, "Failed to request");
788 checkHandler = pImpl->SearchHandler(pHandlerData, false);
789 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
790 switch (checkHandler)
795 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
798 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
801 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
809 OnProtocolHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
811 result r = E_SUCCESS;
812 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
813 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
814 SysAssertf(pImpl && pHandlerData, "Failed to request");
816 r = pImpl->UnregistrationHandler(pHandlerData, false);
817 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
822 OnContentHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
824 result r = E_SUCCESS;
825 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
826 SysAssertf(pImpl, "Failed to request");
828 r = pImpl->ShowUserConfirmPopup(USER_CONTENT_HANDLER, pEventInfo);
829 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
834 OnIsContentHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
836 int checkHandler = 0;
837 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
838 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
839 SysAssertf(pImpl && pHandlerData, "Failed to request");
841 checkHandler = pImpl->SearchHandler(pHandlerData, true);
842 SysTryReturnVoidResult(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
844 switch (checkHandler)
849 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_DECLINED);
852 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
855 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_NEW);
864 OnContentHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
866 result r = E_SUCCESS;
867 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
868 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
869 SysAssertf(pImpl && pHandlerData, "Failed to request");
871 r = pImpl->UnregistrationHandler(pHandlerData, true);
872 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
877 OnFullScreenEntered(void* pUserData, Evas_Object* pView, void* pEventInfo)
879 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
880 SysAssertf(pImpl, "Failed to request");
882 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
883 SysAssertf(pWebCore, "Failed to get Web core object");
885 pWebCore->SetFullScreenEntered(true);
890 OnFullScreenExited(void* pUserData, Evas_Object* pView, void* pEventInfo)
892 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
893 SysAssertf(pImpl, "Failed to request");
895 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
896 SysAssertf(pWebCore, "Failed to get Web core object");
898 pWebCore->SetFullScreenEntered(false);
903 OnFocusDownRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
905 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
906 SysAssertf(pImpl, "Failed to request");
908 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
909 pWebCore->SetFocusEnd(true);
914 OnFocusUpRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
916 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
917 SysAssertf(pImpl, "Failed to request");
919 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
920 pWebCore->SetFocusEnd(true);
925 OnVibrationRequested(uint64_t duration, void* pUserData)
927 result r = E_SUCCESS;
929 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
930 SysAssertf(pImpl, "Failed to request");
932 r = pImpl->VibrationRequested(duration);
933 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
938 OnVibrationCanceled(void* pUserData)
940 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
941 SysAssertf(pImpl, "Failed to request");
943 pImpl->VibrationCanceled();
948 OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
950 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
951 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
952 SysAssertf(pImpl && pPolicy, "Failed to request");
954 String url(ewk_policy_decision_url_get(pPolicy));
955 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
957 if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
958 && !pImpl->IsRedirectRequested())
960 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
961 SysAssertf(pWebCore, "Failed to get Web core object");
963 pWebCore->SetFullScreenEntered(false);
965 pImpl->SetCertificateRequested(false);
967 if (pImpl->GetTextSearchListener())
969 pImpl->DisableAsyncSearch();
972 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
973 if (pLoadingListener)
975 WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
976 Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
978 switch (ewkNavigationType)
980 case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
981 navigationType = WEB_NAVIGATION_LINK_CLICKED;
983 case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
984 navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
986 case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
987 navigationType = WEB_NAVIGATION_BACKFORWARD;
989 case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
990 navigationType = WEB_NAVIGATION_RELOAD;
992 case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
993 navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
995 case EWK_POLICY_NAVIGATION_TYPE_OTHER:
996 navigationType = WEB_NAVIGATION_OTHER;
1002 if (pLoadingListener->OnLoadingRequested(url, navigationType))
1004 ewk_policy_decision_ignore(pPolicy);
1011 if (url == L"about:blank")
1013 ewk_policy_decision_use(pPolicy);
1018 String currentUrl(pImpl->GetUrl());
1019 String redirectUrl(pImpl->GetProtocolFromUri(url, currentUrl));
1020 if (redirectUrl != L"")
1022 ewk_policy_decision_ignore(pPolicy);
1024 pImpl->LoadUrl(redirectUrl);
1032 String uriScheme(uri.GetScheme());
1033 SysSecureLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
1035 if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file") && (uriScheme != L""))
1037 result r = E_SUCCESS;
1039 if (uriScheme == L"tel")
1041 String operationId(L"http://tizen.org/appcontrol/operation/dial");
1042 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1044 else if (uriScheme == L"mailto" || uriScheme == L"sms" || uriScheme == L"smsto" || uriScheme == L"mms" || uriScheme == L"mmsto" )
1046 String operationId(L"http://tizen.org/appcontrol/operation/compose");
1047 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1051 String operationId(L"http://tizen.org/appcontrol/operation/view");
1052 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1057 ewk_policy_decision_ignore(pPolicy);
1063 ewk_policy_decision_use(pPolicy);
1068 OnLoadingStarted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1070 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1071 SysAssertf(pImpl, "Failed to request");
1073 if (pImpl->GetLoadingListener())
1075 result r = E_SUCCESS;
1077 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_STARTED));
1078 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1080 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1081 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1082 pEventArg.release();
1088 OnPageTitleReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1090 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1091 char* pTitle = reinterpret_cast< char* >(pEventInfo);
1092 SysAssertf(pImpl, "Failed to request");
1094 SysLog(NID_WEB_CTRL, "The current value of title is %s", pTitle);
1096 if (pImpl->GetLoadingListener())
1098 result r = E_SUCCESS;
1100 std::unique_ptr<String> pPageTitle(new (std::nothrow) String(pTitle));
1101 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED));
1102 SysTryReturnVoidResult(NID_WEB_CTRL, pPageTitle.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1104 r = pEventArg->SetEventInfo(_LoadingEventArg::PAGE_TITLE, *pPageTitle.get());
1105 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1106 pPageTitle.release();
1108 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1109 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1110 pEventArg.release();
1116 OnEstimatedProgress(void* pUserData, Evas_Object* pView, void* pEventInfo)
1118 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1119 double* pProgress = reinterpret_cast< double* >(pEventInfo);
1120 SysAssertf(pImpl, "Failed to request");
1122 SysLog(NID_WEB_CTRL, "The current value of progress is %lf", *pProgress);
1124 if (pImpl->GetLoadingListener())
1126 result r = E_SUCCESS;
1128 std::unique_ptr<Integer> pProgressPercentage(new (std::nothrow) Integer(static_cast< int >(*pProgress * 100)));
1129 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PROGRESS));
1130 SysTryReturnVoidResult(NID_WEB_CTRL, pProgressPercentage.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1132 r = pEventArg->SetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS, *pProgressPercentage.get());
1133 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1134 pProgressPercentage.release();
1136 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1137 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1138 pEventArg.release();
1144 OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1146 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1147 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
1148 SysAssertf(pImpl && pPolicy, "Failed to request");
1150 result r = E_SUCCESS;
1152 int code = ewk_policy_decision_response_status_code_get(pPolicy);
1153 String url(ewk_policy_decision_url_get(pPolicy));
1154 String mime(ewk_policy_decision_response_mime_get(pPolicy));
1155 SysSecureLog(NID_WEB_CTRL, "code : %d, url : %ls, mime : %ls", code, url.GetPointer(), mime.GetPointer());
1157 if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
1159 if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
1161 pImpl->SetRedirectRequested(true);
1164 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
1165 if (pLoadingListener)
1167 HttpHeader httpHeader;
1169 Eina_Iterator* iterator = eina_hash_iterator_tuple_new(ewk_policy_decision_response_headers_get(pPolicy));
1172 Eina_Hash_Tuple *tuple = null;
1174 EINA_ITERATOR_FOREACH(iterator, tuple)
1176 String key(reinterpret_cast< const char* >(tuple->key));
1177 String value(reinterpret_cast< char* >(tuple->data));
1179 SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
1181 r = httpHeader.AddField(key, value);
1182 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, eina_iterator_free(iterator), r, "[%s] Propagating.", GetErrorMessage(r));
1185 eina_iterator_free(iterator);
1188 pImpl->SetPolicyDecision(pLoadingListener->OnWebDataReceived(mime, httpHeader));
1192 pImpl->SetPolicyDecision(WEB_DECISION_CONTINUE);
1196 switch (pImpl->GetPolicyDecision())
1198 case WEB_DECISION_CONTINUE:
1200 String currentUrl(pImpl->GetUrl());
1201 String redirectUrl(pImpl->GetRedirectUri(url, currentUrl, mime));
1202 if (redirectUrl != L"")
1204 ewk_policy_decision_ignore(pPolicy);
1206 pImpl->LoadUrl(redirectUrl);
1211 if (ewk_policy_decision_type_get(pPolicy) == EWK_POLICY_DECISION_USE)
1217 ewk_policy_decision_ignore(pPolicy);
1219 String operationId(L"http://tizen.org/appcontrol/operation/view");
1221 r = _AppControlImpl::FindAndStart(operationId, &url, &mime, null, null, null);
1222 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS || r == E_OBJ_NOT_FOUND, r, "[%s] Propagating.", GetErrorMessage(r));
1223 if (r == E_OBJ_NOT_FOUND)
1225 String operationId(L"http://tizen.org/appcontrol/operation/download");
1227 r = _AppControlImpl::FindAndStart(operationId, &url, null, null, null, null);
1228 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1236 case WEB_DECISION_DOWNLOAD:
1238 ewk_policy_decision_ignore(pPolicy);
1240 _WebDataHandler* pDownloadHandler = pImpl->GetDownloadHandler();
1241 SysTryReturnVoidResult(NID_WEB_CTRL, pDownloadHandler, E_SYSTEM, "[%s] A system error has been occurred. Failed to get DownloadHandler.", GetErrorMessage(E_SYSTEM));
1243 Ewk_Context* pContext = ewk_view_context_get(pView);
1244 SysAssertf(pContext, "Failed to get webkit instance.");
1246 pDownloadHandler->StartDownload(url);
1251 case WEB_DECISION_IGNORE:
1253 ewk_policy_decision_ignore(pPolicy);
1264 ewk_policy_decision_use(pPolicy);
1269 ewk_policy_decision_ignore(pPolicy);
1274 OnProgressCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1276 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1277 SysAssertf(pImpl, "Failed to request");
1279 if (pImpl->IsRedirectRequested())
1281 pImpl->SetRedirectRequested(false);
1284 if (pImpl->IsLoadingErrorOccurred())
1286 pImpl->SetLoadingErrorOccurred(false);
1287 evas_object_smart_callback_call(pView, "load,finished", NULL);
1293 OnLoadingErrorOccurred(void* pUserData, Evas_Object* pView, void* pEventInfo)
1295 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1296 Ewk_Error* pErrorData = reinterpret_cast< Ewk_Error* >(pEventInfo);
1297 SysAssertf(pImpl && pErrorData, "Failed to request");
1299 int code = ewk_error_code_get(pErrorData);
1300 const char* pDescription = ewk_error_description_get(pErrorData);
1302 SysLog(NID_WEB_CTRL, "The current value of code is %d, description is %s", code, pDescription);
1306 case EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE:
1307 pImpl->SetLoadingErrorOccurred(true);
1310 case EWK_ERROR_CODE_PLUGINWILLHANDLELOAD:
1311 evas_object_smart_callback_call(pView, "load,finished", NULL);
1314 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
1315 pImpl->SetLoadingErrorOccurred(true);
1316 evas_object_smart_callback_call(pView, "load,stop", NULL);
1320 pImpl->SetLoadingErrorOccurred(true);
1321 if (pImpl->GetLoadingListener())
1323 result r = E_SUCCESS;
1325 r = FireLoadingErrorOccurredEvent(pImpl, code, pDescription);
1326 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1334 OnLoadingCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
1336 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1337 SysAssertf(pImpl, "Failed to request");
1339 if (pImpl->GetLoadingListener())
1341 result r = E_SUCCESS;
1343 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_CANCELED));
1344 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1346 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1347 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1348 pEventArg.release();
1355 OnLoadingCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1357 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1358 SysAssertf(pImpl, "Failed to request");
1360 if (pImpl->GetLoadingListener())
1362 result r = E_SUCCESS;
1364 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_COMPLETED));
1365 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1367 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1368 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1369 pEventArg.release();
1375 OnLoadingCommitted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1377 evas_object_focus_set(pView, EINA_FALSE);
1382 OnFaviconReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
1384 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1385 SysAssertf(pImpl, "Failed to request");
1387 if (pImpl->GetLoadingListener())
1389 result r = E_SUCCESS;
1391 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED));
1392 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1394 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1395 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1396 pEventArg.release();
1403 OnDidStartDownloadCallback(const char* pUrl, void* pUserData)
1405 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1406 SysAssertf(pUrl && pImpl != null, "Failed to request");
1408 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s", pUrl);
1413 FireWebPageShowRequestedEvent(_WebImpl* pImpl, int event)
1415 result r = E_SUCCESS;
1417 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1418 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1420 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1421 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1422 pEventArg.release();
1429 OnWebPageShowRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1431 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1432 SysAssertf(pImpl, "Failed to request");
1434 if (pImpl->GetUiEventListener())
1436 result r = E_SUCCESS;
1438 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED);
1439 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1441 if (pImpl->GetUiEventListenerF())
1443 result r = E_SUCCESS;
1445 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT);
1446 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1452 OnWebWindowCreateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1454 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(pUserData);
1455 Evas_Object** pChildView = reinterpret_cast< Evas_Object** >(pEventInfo);
1456 SysAssertf(pParentImpl && pChildView, "Failed to request");
1458 IWebUiEventListener* pUserUiListener = pParentImpl->GetUiEventListener();
1459 IWebUiEventListenerF* pUserUiListenerF = pParentImpl->GetUiEventListenerF();
1460 if (pUserUiListener)
1462 Web* pWeb = pUserUiListener->OnWebWindowCreateRequested();
1465 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1466 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1468 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1469 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1472 if (pUserUiListenerF)
1474 Web* pWeb = pUserUiListenerF->OnWebWindowCreateRequested();
1477 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1478 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1480 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1481 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1488 FireWebWindowClosedRequestedEvent(_WebImpl* pImpl, int event)
1490 result r = E_SUCCESS;
1492 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1493 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1495 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1496 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1497 pEventArg.release();
1504 OnWebWindowClosedRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1506 _WebImpl* pChildImpl = reinterpret_cast< _WebImpl* >(pUserData);
1507 SysAssertf(pChildImpl, "Failed to request");
1509 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, PARENT_WEB_CTRL));
1510 if (pParentImpl == null)
1515 if (pParentImpl->GetUiEventListener())
1517 result r = E_SUCCESS;
1519 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED);
1520 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1522 if (pParentImpl->GetUiEventListenerF())
1524 result r = E_SUCCESS;
1526 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT);
1527 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1533 FireWebPreventDefaultTriggeredEvent(_WebImpl* pImpl, int event, bool trigger)
1535 result r = E_SUCCESS;
1537 std::unique_ptr<Boolean> pPreventTrigger(new (std::nothrow) Boolean(trigger));
1538 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1539 SysTryReturnResult(NID_WEB_CTRL, pPreventTrigger.get() && pEventArg.get(), E_OUT_OF_MEMORY, " Memory allocation failed." );
1541 r = pEventArg->SetEventInfo(_WebUiEventArg::PREVENT_DEFAULT, *pPreventTrigger.get());
1542 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1543 pPreventTrigger.release();
1545 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1546 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1547 pEventArg.release();
1554 OnWebPreventDefaultTriggered(void* pUserData, Evas_Object* pView, void* pEventInfo)
1556 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1557 Eina_Bool* pTrigger = reinterpret_cast< Eina_Bool* >(pEventInfo);
1558 SysAssertf(pImpl && pTrigger, "Failed to request");
1560 if (pImpl->GetUiEventListener())
1562 result r = E_SUCCESS;
1564 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED, static_cast< bool >(*pTrigger));
1565 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1567 if (pImpl->GetUiEventListenerF())
1569 result r = E_SUCCESS;
1571 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT, static_cast< bool >(*pTrigger));
1572 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1578 FireWebPageBlockSelectedEvent(_WebImpl* pImpl)
1580 result r = E_SUCCESS;
1582 std::unique_ptr<Point> startPoint(new (std::nothrow) Point());
1583 std::unique_ptr<Point> endPoint(new (std::nothrow) Point());
1584 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1586 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1588 if ((endPoint->x != 0) && (endPoint->y != 0))
1590 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED));
1591 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1593 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1594 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1595 startPoint.release();
1597 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1598 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1601 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1602 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1603 pEventArg.release();
1611 FireWebPageBlockSelectedEventF(_WebImpl* pImpl)
1613 result r = E_SUCCESS;
1615 std::unique_ptr<FloatPoint> startPoint(new (std::nothrow) FloatPoint());
1616 std::unique_ptr<FloatPoint> endPoint(new (std::nothrow) FloatPoint());
1618 SysTryReturnResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1620 pImpl->GetBlockRange(*startPoint.get(), *endPoint.get());
1621 if ((endPoint->x != 0.0f) && (endPoint->y != 0.0f))
1623 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT));
1624 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
1626 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
1627 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1628 startPoint.release();
1630 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
1631 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1634 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1635 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1636 pEventArg.release();
1644 OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
1646 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1647 SysAssertf(pImpl, "Failed to request");
1649 if (pImpl->GetUiEventListener())
1651 result r = E_SUCCESS;
1653 r = FireWebPageBlockSelectedEvent(pImpl);
1654 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1656 if (pImpl->GetUiEventListenerF())
1658 result r = E_SUCCESS;
1660 r = FireWebPageBlockSelectedEventF(pImpl);
1661 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1667 OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
1669 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1670 char* pJsonText = reinterpret_cast< char* >(pEventInfo);
1671 SysAssertf(pImpl && pJsonText, "Failed to request");
1673 result r = E_SUCCESS;
1675 SysLog(NID_WEB_CTRL, "The current value of jsontext is %s", pJsonText);
1677 std::unique_ptr<_JsBridgeArg> pEventArg(new (std::nothrow) _JsBridgeArg());
1678 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1680 r = pEventArg->Construct(pJsonText);
1681 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1683 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1684 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1685 pEventArg.release();
1690 OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
1692 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1693 Eina_Rectangle* pEinaRect = reinterpret_cast< Eina_Rectangle* >(pEventInfo);
1694 SysAssertf(pImpl && pEinaRect, "Failed to request");
1696 if (pImpl->GetSetting().GetInputStyle() == INPUT_STYLE_OVERLAY)
1698 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1699 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1701 Rectangle rect(pEinaRect->x, pEinaRect->y, pEinaRect->w, pEinaRect->h);
1703 if (rect.height == 0)
1708 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1711 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
1713 pFormImpl->Invalidate(false);
1716 if (pImpl->GetWebKeypadEventListener())
1718 if (pImpl->IsKeypadVisible() == true)
1720 if ((pImpl->GetPreviousKeypadBounds().width == rect.width) && (pImpl->GetPreviousKeypadBounds().height != rect.height))
1722 pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1727 pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1731 pImpl->SetPreviousKeypadBounds(rect);
1735 result r = pImpl->SetFullScreenKeypad();
1736 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1742 OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
1744 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1745 SysAssertf(pImpl, "Failed to request");
1747 pImpl->SetKeypadVisibleState(true);
1749 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1752 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1753 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1755 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(pImpl->GetPreviousKeypadBounds().height));
1757 if (pFormImpl->HasFooter())
1759 pFormImpl->GetCore().SetKeypadShowState(true);
1764 if (pImpl->GetWebKeypadEventListener())
1766 pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
1772 OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
1774 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1775 SysAssertf(pImpl, "Failed to request");
1777 _FormImpl* pFormImpl = pImpl->GetParentFormImpl(dynamic_cast< _ControlImpl* >(pImpl));
1780 pFormImpl->DeflateClientRectHeight(0);
1782 pFormImpl->Invalidate(false);
1784 if (pFormImpl->HasFooter())
1786 pFormImpl->GetCore().SetKeypadShowState(false);
1791 if (pImpl->GetWebKeypadEventListener())
1793 pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1796 pImpl->SetKeypadVisibleState(false);
1801 OnWindowObjectFocusLost(void* pUserData, Evas_Object* pWin, void* pEvent_info)
1803 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1804 SysAssertf(pImpl, "Failed to request");
1806 pImpl->SetWinFocusLost(true);
1811 OnWindowObjectFocusGained(void* pUserData, Evas_Object* pWin, void* pEvent_info)
1813 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1814 SysAssertf(pImpl, "Failed to request");
1816 if (pImpl->IsVisible() == true && pImpl->IsFocused() == true)
1818 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1819 SysAssertf(pWebCore, "Failed to get Web core object");
1821 if (pImpl->IsWinFocusLost() == true)
1823 Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
1824 SysAssertf(pSettings, "Failed to get settings instance.");
1826 if (ewk_settings_clear_text_selection_automatically_get(pSettings) == EINA_FALSE)
1828 ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_TRUE);
1830 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1832 else if (pImpl->IsKeypadOpened() == true)
1834 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1839 pImpl->SetWinFocusLost(false);
1844 OnWebNativeNodeFocusGained(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
1846 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1847 SysAssertf(pImpl, "Failed to request");
1849 if (pImpl->IsKeypadOpened() == true)
1851 pImpl->SetKeypadOpened(false);
1853 else if (pImpl->IsWinFocusLost() == true && pImpl->IsFocused() == false)
1855 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1856 SysAssertf(pWebCore, "Failed to get Web core object");
1858 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_FALSE);
1864 OnWebNativeNodeFocusLost(void* pUserData, Evas* pCanvas, Evas_Object* pView, void* pEventInfo)
1866 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1867 SysAssertf(pImpl, "Failed to request");
1869 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1870 SysAssertf(pWebCore, "Failed to get Web core object");
1872 Eina_Rectangle leftHandle;
1873 Eina_Rectangle rightHandle;
1875 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
1876 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
1878 if (pImpl->IsWinFocusLost() == true && ewk_view_text_selection_range_get(pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle))
1880 Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
1881 SysAssertf(pSettings, "Failed to get settings instance.");
1883 ewk_settings_clear_text_selection_automatically_set(pSettings, EINA_FALSE);
1889 OnColorPickerProviderRequested(Ewk_View_Smart_Data* pSmartData, int red, int green, int blue, int alpha)
1891 SysAssertf(pSmartData, "invalid smartdata");
1892 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1893 SysAssertf(pWebImpl, "Failed to get Impl");
1895 result r = E_SUCCESS;
1897 if (pWebImpl->GetColorpicker())
1904 r = pWebImpl->ShowColorPicker(red, green, blue, alpha, color);
1905 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1907 byte r1, g1, b1, a1;
1908 color.GetColorComponents(r1, g1, b1, a1);
1909 ewk_view_color_picker_color_set(pSmartData->self, r1, g1, b1, a1);
1916 OnColorPickerProviderDismissed(Ewk_View_Smart_Data* pSmartData)
1918 SysAssertf(pSmartData, "invalid smartdata");
1920 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1921 SysAssertf(pWebImpl, "Failed to get Impl");
1923 return pWebImpl->HideColorPicker();
1928 OnDatePickerProviderRequested(Ewk_View_Smart_Data* pSmartData, Ewk_Input_Type inputType, const char* inputValue)
1930 SysAssertf(pSmartData, "Failed to request");
1931 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1932 SysAssertf(pWebImpl, "Failed to get Impl");
1934 result r = E_SUCCESS;
1936 if (pWebImpl->GetDatepicker())
1938 ewk_view_focused_input_element_value_set(pSmartData->self, inputValue);
1945 r = pWebImpl->ShowDatePicker(inputType, inputValue, dateStr);
1946 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1948 std::unique_ptr<char[]> pDateStr(_StringConverter::CopyToCharArrayN(dateStr));
1949 SysTryReturn(NID_WEB_CTRL, pDateStr.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1951 ewk_view_focused_input_element_value_set(pSmartData->self, pDateStr.get());
1958 OnSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, double pageScaleFactor, Eina_List* pItems, int selectedIndex)
1960 SysAssertf(pSmartData, "Failed to request");
1962 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1963 SysAssertf(pWebImpl, "Failed to get Impl");
1965 result r = pWebImpl->ShowSelectBoxPopup(false, L"", pItems, pSmartData->self, selectedIndex);
1966 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1973 OnMultiSelectBoxRequested(Ewk_View_Smart_Data* pSmartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* pItems)
1975 SysAssertf(pSmartData, "Failed to request");
1977 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1978 SysAssertf(pWebImpl, "Failed to get Impl");
1980 result r = pWebImpl->ShowSelectBoxPopup(true, L"", pItems, pSmartData->self, 0);
1981 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1988 OnSelectBoxClosed(Ewk_View_Smart_Data* pSmartData)
1990 SysAssertf(pSmartData, "invalid smartdata");
1992 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1993 SysAssertf(pWebImpl, "Failed to get Impl");
1995 result r = pWebImpl->ClearSelectBoxPopup();
1996 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
2003 OnSelectBoxUpdateRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, Eina_List* pItems, int selectedIndex)
2005 SysAssertf(pSmartData, "invalid smartdata");
2007 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2008 SysAssertf(pWebImpl, "Failed to get Impl");
2010 result r = pWebImpl->UpdateSelectBoxPopup(pItems, selectedIndex, false);
2011 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
2018 OnFormDataCandidateShow(Ewk_View_Smart_Data *pSmartData, int x, int y, int w, int h)
2020 SysAssertf(pSmartData, "Failed to request");
2022 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2023 SysAssertf(pWebImpl, "Failed to get Impl");
2025 Rectangle windowRect(x, y, w, h);
2026 result r = pWebImpl->ShowFormDataWindow(windowRect, pSmartData->self);
2027 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
2034 OnFormDataCandidateHide(Ewk_View_Smart_Data *pSmartData)
2036 SysAssertf(pSmartData, "Failed to request");
2038 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2039 SysAssertf(pWebImpl, "Failed to get Impl");
2041 if (pWebImpl->IsFormDataWindowVisible())
2043 pWebImpl->HideFormDataWindow();
2051 OnFormDataCandidateUpdate(Ewk_View_Smart_Data *pSmartData, Eina_List *pDataList)
2053 SysAssertf(pSmartData, "Failed to request");
2055 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2056 SysAssertf(pWebImpl, "Failed to get Impl");
2058 pWebImpl->SetFormDataList(pDataList);
2065 OnFormDataCandidateIsShowing(Ewk_View_Smart_Data *pSmartData)
2067 SysAssertf(pSmartData, "Failed to request");
2069 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
2070 SysAssertf(pWebImpl, "Failed to get Impl");
2072 if (pWebImpl->IsFormDataWindowVisible())
2084 OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
2086 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
2087 SysAssertf(pPresenter && !pError, "Failed to request");
2089 bool ret = EINA_TRUE;
2093 case EWK_COOKIE_ACCEPT_POLICY_ALWAYS:
2095 case EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY:
2099 case EWK_COOKIE_ACCEPT_POLICY_NEVER:
2108 SysLog(NID_WEB_CTRL, "The current value of policy is %d", ret);
2110 pPresenter->EndAsyncProcess(ret);
2115 OnScriptExecuted(Evas_Object* pView, const char* pResult, void* pUserData)
2117 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
2118 SysAssertf(pPresenter, "Failed to request");
2120 String result(pResult);
2121 SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
2123 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
2124 _WebManager* pWebManager = _WebManager::GetInstance();
2125 if (pWebManager->IsValidCallback(reinterpret_cast< int >(pImpl), reinterpret_cast< int >(pPresenter)))
2127 pPresenter->EndAsyncProcess(result);
2133 OnTextFound(void* pUserData, Evas_Object* pView, void* pEventInfo)
2135 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
2136 SysAssertf(pImpl, "Failed to request");
2138 int* pTotalCount = reinterpret_cast< int* >(pEventInfo);
2139 SysLog(NID_WEB_CTRL, "The current value of totalCount is %d", *pTotalCount);
2141 _WebPresenter* pWebPresenter = pImpl->GetSearchPresenter();
2145 pWebPresenter->EndAsyncProcess(*pTotalCount);
2149 if (pImpl->GetTextSearchListener())
2151 result r = E_SUCCESS;
2155 if (*pTotalCount > 0)
2157 ordinal = pImpl->GetAsyncSearchOrdinal();
2158 pImpl->SetAsyncSearchResult(*pTotalCount);
2161 if (pImpl->GetPendingAsyncSearchCount() > 0)
2166 std::unique_ptr<Integer> pCount(new (std::nothrow) Integer(*pTotalCount));
2167 std::unique_ptr<Integer> pOrdinal(new (std::nothrow) Integer(ordinal));
2168 std::unique_ptr<_TextSearchEventArg> pEventArg(new (std::nothrow) _TextSearchEventArg(WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND));
2169 SysTryReturnVoidResult(NID_WEB_CTRL, pCount.get() && pOrdinal.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2171 r = pEventArg->SetEventInfo(_TextSearchEventArg::TOTAL_COUNT, *pCount.get());
2172 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2175 r = pEventArg->SetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL, *pOrdinal.get());
2176 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2179 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
2180 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2181 pEventArg.release();
2187 class _JsBridgeHashCodeProvider
2188 : public Tizen::Base::Collection::IHashCodeProviderT< Tizen::Base::String >
2191 _JsBridgeHashCodeProvider(){}
2192 virtual ~_JsBridgeHashCodeProvider(void) {}
2195 int GetHashCode(const Tizen::Base::String& obj) const
2197 return obj.GetHashCode();
2203 //Comparer implementation
2204 class _JsBridgeComparer
2205 : public Tizen::Base::Collection::IComparerT< Tizen::Base::String >
2208 _JsBridgeComparer(){}
2209 virtual ~_JsBridgeComparer(void) {}
2212 result Compare(const Tizen::Base::String& obj1, const Tizen::Base::String& obj2, int& cmp) const
2229 _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
2230 : _ContainerImpl(pWeb, pCore)
2231 , __isFooterVisible(false)
2232 , __isKeypadVisible(false)
2233 , __isKeypadOpened(false)
2234 , __isWinFocusLost(false)
2235 , __isLoadingErrorOccurred(false)
2236 , __isRedirectRequested(false)
2237 , __isCertificateRequested(false)
2238 , __isCertificateConfirmed(false)
2239 , __isFormDataVisible(false)
2240 , __keypadBounds(0, 0, 0, 0)
2242 , __pUserLoadingListener(null)
2243 , __pUserUiListener(null)
2244 , __pUserUiListenerF(null)
2245 , __pUserKeypadEventListener(null)
2246 , __pTextSearchListener(null)
2248 , __pJsBridgeList(null)
2249 , __pJsProvider(null)
2250 , __pJsComparer(null)
2251 , __pWebDownloadHandler(null)
2253 , __pAuthChallenge(null)
2254 , __pAuthPopup(null)
2255 , __pUserMediaConfirmPopup(null)
2256 , __pContentHandlerConfirmPopup(null)
2257 , __pProtocolHandlerConfirmPopup(null)
2258 , __pGeolocationConfirmPopup(null)
2259 , __pNotificationConfirmPopup(null)
2260 , __pScriptAlertConfirmPopup(null)
2261 , __pScriptConfirmPopup(null)
2262 , __pBeforeUnloadConfirmPopup(null)
2263 , __pAppCacheConfirmPopup(null)
2264 , __pDbQuotaConfirmPopup(null)
2265 , __pLocalFsQuotaConfirmPopup(null)
2266 , __pIndexedDbQuotaConfirmPopup(null)
2267 , __pPromptPopup(null)
2268 , __pCertConfirmPopup(null)
2269 , __pSelectBox(null)
2270 , __pDatePicker(null)
2271 , __pColorPicker(null)
2272 , __pFormDataWindow(null)
2274 , __policy(WEB_DECISION_CONTINUE)
2275 , __defaultUserAgent(L"")
2276 , __pFormDataList(null)
2277 , __popupClosed(false)
2279 __textSearch.__searchAll = false;
2280 __textSearch.__searchForward = true;
2281 __textSearch.__caseSensitive = false;
2282 __textSearch.__pending = 0;
2283 __textSearch.__currentIndex = 1;
2284 __textSearch.__totalCount = -1;
2285 __textSearch.__text = L"";
2289 _WebImpl::~_WebImpl()
2291 _WebManager* pWebManager = _WebManager::GetInstance();
2292 SysTryCatch(NID_WEB_CTRL, pWebManager, , E_SYSTEM, "[%s] Failed to get the _ControlManager instance.", GetErrorMessage(E_SYSTEM));
2293 pWebManager->RemoveWeb(reinterpret_cast< int >(this));
2296 _SettingInfoImpl::RemoveSettingEventListener(*this);
2297 RemoveEventListenerCallback();
2302 _WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
2304 result r = E_SUCCESS;
2306 r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2307 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2309 _Web* pCore = _Web::CreateWebN();
2310 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2312 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2314 r = CheckConstruction(pCore, pImpl);
2315 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2317 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2318 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2320 r = pImpl->Construct();
2321 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2333 _WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
2335 result r = E_SUCCESS;
2337 r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
2338 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2340 _Web* pCore = _Web::CreateWebN();
2341 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2343 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
2345 r = CheckConstruction(pCore, pImpl);
2346 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
2348 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
2349 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2351 r = pImpl->Construct();
2352 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2364 _WebImpl::Construct(void)
2366 result r = E_SUCCESS;
2368 r = __mutex.Create();
2369 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2371 r = __textSearch.__searchQueue.Construct();
2372 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2374 r = __webNotificationList.Construct();
2375 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2377 r = InitJsBridgeList();
2378 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2381 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2383 __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
2384 SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
2391 _WebImpl::InitializeSetting(void)
2393 result r = E_SUCCESS;
2395 WebSetting* pWebSetting = __pWebCore->GetSetting();
2396 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(pWebSetting);
2398 SetCookieEnabled(pWebSettingImpl->IsCookieEnabled());
2399 SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
2401 __defaultUserAgent = pWebSettingImpl->GetUserAgent();
2403 r = SetSetting(*pWebSetting);
2404 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2406 SetEventListenerCallback();
2413 _WebImpl::IsLayoutable(void) const
2420 _WebImpl::InitWebEvent(void)
2422 __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
2423 SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2425 return __pWebEvent->Construct(*this);
2430 _WebImpl::GetWebEvent(void) const
2432 return __pWebEvent.get();
2437 _WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
2439 Eina_Hash* pHttpHeader = null;
2441 std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
2442 if (pFieldNameList.get())
2444 pHttpHeader = eina_hash_string_small_new(FreeCharArray);
2445 SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2447 int count = pFieldNameList->GetCount();
2449 for (int i = 0; i < count; i++)
2451 String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
2452 SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2454 std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
2455 SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2457 std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
2458 SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2460 while (pFieldValueEnum->MoveNext() == E_SUCCESS)
2462 Eina_Bool ret = false;
2464 String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
2465 SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2467 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
2468 SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2470 ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
2471 SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2478 eina_hash_free(pHttpHeader);
2485 _WebImpl::LoadUrl(const String& url) const
2487 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2493 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2494 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2496 ewk_view_url_set(pWebview, pUrl.get());
2503 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
2505 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2511 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2512 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2514 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2516 ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
2518 eina_hash_free(pHttpHeader);
2525 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
2527 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2533 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2534 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2536 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2538 ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
2540 eina_hash_free(pHttpHeader);
2547 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
2549 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2555 SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
2557 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
2558 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2559 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
2560 SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2562 ewk_view_contents_set(pWebview, reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
2569 _WebImpl::Pause(void)
2571 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2577 ewk_view_suspend(pWebview);
2582 _WebImpl::Resume(void)
2584 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2590 ewk_view_resume(pWebview);
2595 _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
2597 __pSelectBox.reset();
2599 SysTryReturnResult(NID_WEB_CTRL, eina_list_count(pItems) > 0, E_SYSTEM, "ItemCount is invalid.");
2601 result r = E_SUCCESS;
2603 std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
2604 SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2606 int itemCount = eina_list_count(pItems);
2607 int defaultCount = (itemCount < DEFAULT_LIST_ITEM_COUNT) ? itemCount : (isMultiSelect ? (DEFAULT_LIST_ITEM_COUNT - 1) : DEFAULT_LIST_ITEM_COUNT);
2608 r = pSelectBox->Construct(this, isMultiSelect, title, defaultCount, pWebView);
2610 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2612 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2613 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2615 __pSelectBox = std::move(pSelectBox);
2617 return __pSelectBox->ShowPopup();
2622 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2624 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2626 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2631 _WebImpl::ClearSelectBoxPopup(void)
2633 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2635 __pSelectBox.reset();
2644 _WebImpl::GetDatepicker(void)
2646 _InputPickerPopup* pInputPicker =null;
2649 pInputPicker = __pDatePicker.get();
2651 return pInputPicker;
2656 _WebImpl::GetColorpicker(void)
2658 _InputPickerPopup* pInputPicker =null;
2661 pInputPicker = __pColorPicker.get();
2663 return pInputPicker;
2668 _WebImpl::CanGoBack(void) const
2670 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2676 return static_cast< bool >(ewk_view_back_possible(pWebview));
2681 _WebImpl::CanGoForward(void) const
2683 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2689 return static_cast< bool >(ewk_view_forward_possible(pWebview));
2694 _WebImpl::GoBack(void) const
2696 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2702 ewk_view_back(pWebview);
2707 _WebImpl::GoForward(void) const
2709 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2715 ewk_view_forward(pWebview);
2720 _WebImpl::GetUrl(void) const
2722 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2728 return ewk_view_url_get(pWebview);
2733 _WebImpl::GetTitle(void) const
2735 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2741 return ewk_view_title_get(pWebview);
2746 _WebImpl::StopLoading(void) const
2748 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2754 ewk_view_stop(pWebview);
2759 _WebImpl::Reload(void) const
2761 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2767 ewk_view_reload(pWebview);
2772 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
2774 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2780 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2781 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2783 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2784 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2786 ewk_view_script_execute(pWebview, pScript.get(), OnScriptExecuted, pPresenter.get());
2788 String* pResult = new (std::nothrow) String(L"");
2789 SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2791 pPresenter->WaitAsyncProcess(*pResult);
2798 _WebImpl::SetZoomLevel(float level)
2800 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2806 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);
2808 ewk_view_scale_set(pWebview, static_cast< double >(level), 0, 0);
2815 _WebImpl::GetZoomLevel(void) const
2817 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2823 return static_cast< float >(ewk_view_scale_get(pWebview));
2827 const PageNavigationList*
2828 _WebImpl::GetBackForwardListN(void) const
2830 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2836 result r = E_SUCCESS;
2838 _PageNavigationListImpl* pNavigationListImpl = null;
2839 _HistoryItemImpl* pHistoryItemImpl = null;
2841 std::unique_ptr<PageNavigationList> pNavigationList;
2842 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2845 int forwardCount = 0;
2850 Ewk_History* pEwkHistoryList = ewk_view_history_get(pWebview);
2851 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2853 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2854 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2856 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2857 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2859 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2860 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2862 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2863 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2865 r = pHistoryList->Construct();
2866 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2868 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2869 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2870 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2872 for (int i = -backCount; i < forwardCount + 1; i++)
2874 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2875 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2877 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2878 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2880 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2881 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2883 url = ewk_history_item_uri_get(pEwkItem);
2884 title = ewk_history_item_title_get(pEwkItem);
2885 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2887 pHistoryItemImpl->SetHistoryItem(url, title);
2889 r = pHistoryList->Add(*pHistoryItem.get());
2890 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2891 pHistoryItem.release();
2894 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2896 ewk_history_free(pEwkHistoryList);
2898 return pNavigationList.release();
2901 ewk_history_free(pEwkHistoryList);
2908 _WebImpl::SearchText(const String& text, bool searchForward)
2910 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2916 result r = E_SUCCESS;
2918 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2922 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2925 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2926 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2928 r = SynchronizeSearch(SEARCH_SYNC, pWebview, condition, text, searchForward, false, pPresenter.get());
2929 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
2932 pPresenter->WaitAsyncProcess(result);
2934 return static_cast < bool >(result);
2939 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2941 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2947 result r = E_SUCCESS;
2949 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2953 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2956 r = SynchronizeSearch(SEARCH_ALL_ASYNC, pWebview, condition, text, true, caseSensitive);
2957 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2964 _WebImpl::SearchNextAsync(bool searchForward)
2966 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2972 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2973 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2974 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2976 result r = E_SUCCESS;
2978 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2980 if (!__textSearch.__caseSensitive)
2982 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2987 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2990 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pWebview, condition, __textSearch.__text, searchForward);
2991 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2998 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
3000 MutexGuard lock(__mutex);
3002 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
3003 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3008 if (__textSearch.__searchAll)
3010 DisableAsyncSearch();
3012 __textSearch.__searchQueue.Enqueue(this);
3013 __textSearch.__searchQueue.Enqueue(pWebPresenter);
3015 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
3016 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3020 __textSearch.__searchQueue.Enqueue(pWebPresenter);
3022 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3026 case SEARCH_ALL_ASYNC:
3027 __textSearch.__searchAll = true;
3028 __textSearch.__text = text;
3029 __textSearch.__searchForward = true;
3030 __textSearch.__caseSensitive = caseSensitive;
3031 __textSearch.__totalCount = -1;
3032 __textSearch.__currentIndex = 1;
3034 __textSearch.__searchQueue.Enqueue(this);
3035 __textSearch.__searchQueue.Enqueue(this);
3037 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
3038 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3041 case SEARCH_NEXT_ASYNC:
3042 __textSearch.__searchForward = searchForward;
3044 CalculateAsyncSearchOrdinal();
3046 __textSearch.__searchQueue.Enqueue(this);
3048 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3060 _WebImpl::SetAsyncSearchResult(int totalCount)
3062 __textSearch.__totalCount = totalCount;
3067 _WebImpl::GetSearchPresenter(void)
3069 MutexGuard lock(__mutex);
3071 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
3076 _WebImpl::GetPendingAsyncSearchCount(void) const
3078 return __textSearch.__searchQueue.GetCount();
3083 _WebImpl::CalculateAsyncSearchOrdinal(void)
3085 if (__textSearch.__searchForward)
3087 __textSearch.__currentIndex++;
3091 __textSearch.__currentIndex--;
3097 _WebImpl::GetAsyncSearchOrdinal(void) const
3099 return __textSearch.__currentIndex;
3104 _WebImpl::DisableAsyncSearch(void)
3106 __textSearch.__searchAll = false;
3111 _WebImpl::SetSetting(const WebSetting& setting)
3113 if (__pWebCore->GetWebNativeNode())
3115 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3116 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3117 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
3119 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
3120 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3122 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
3124 switch (setting.GetCacheControl())
3126 case WEB_CACHE_VALIDATED:
3127 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
3130 case WEB_CACHE_IGNORE:
3131 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
3138 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
3140 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
3144 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
3147 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
3149 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
3151 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
3153 if (__defaultUserAgent != setting.GetUserAgent())
3155 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
3156 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3158 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
3161 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
3163 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
3165 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
3167 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
3170 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
3172 pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
3173 pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
3174 pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
3175 pWebSettingImpl->SetFontSize(setting.GetFontSize());
3176 pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
3177 pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
3178 pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
3179 pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
3180 pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
3181 pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
3182 pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
3183 pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
3184 pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
3191 _WebImpl::GetSetting(void) const
3193 return *__pWebCore->GetSetting();
3197 const HitElementResult*
3198 _WebImpl::GetElementByPointN(const Point& point) const
3200 return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
3204 const HitElementResult*
3205 _WebImpl::GetElementByPointN(const FloatPoint& point) const
3207 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3213 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));
3215 result r = E_SUCCESS;
3217 _HitElementResultImpl* pHitElementResultImpl = null;
3219 std::unique_ptr<HitElementResult> pHitElementResult;
3220 std::unique_ptr<Bitmap> pImage;
3221 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
3223 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
3225 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3226 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
3228 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3229 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
3230 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
3231 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3232 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
3234 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
3236 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
3237 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3239 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
3240 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3242 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
3248 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
3249 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
3250 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
3251 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
3253 r = buf.Construct(imageLength);
3254 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3256 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
3257 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3261 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
3262 // webkit support types such as ico and vp8 additionally
3263 if (strcmp(pExtension, "gif") == 0)
3265 format = IMG_FORMAT_GIF;
3267 else if (strcmp(pExtension, "jpg") == 0)
3269 format = IMG_FORMAT_JPG;
3271 else if (strcmp(pExtension, "png") == 0)
3273 format = IMG_FORMAT_PNG;
3275 else if (strcmp(pExtension, "bmp") == 0)
3277 format = IMG_FORMAT_BMP;
3281 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
3285 r = image.Construct();
3286 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3288 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
3289 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3294 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
3295 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3297 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
3298 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3300 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
3301 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3304 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
3306 ewk_hit_test_free(pEwkHitTest);
3308 return pHitElementResult.release();
3311 ewk_hit_test_free(pEwkHitTest);
3318 _WebImpl::IsLoading(void) const
3320 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3326 double percent = ewk_view_load_progress_get(pWebview);
3328 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
3340 _WebImpl::GetTextFromBlock(void) const
3342 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3348 return ewk_view_text_selection_text_get(pWebview);
3353 _WebImpl::IsPrivateBrowsingEnabled(void) const
3355 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3358 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
3361 Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
3362 SysAssertf(pSettings, "Failed to get webkit instance.");
3364 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
3369 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
3371 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3374 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
3379 Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
3380 SysAssertf(pSettings, "Failed to get webkit instance.");
3382 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
3387 _WebImpl::ClearHistory(void)
3389 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3395 ewk_view_back_forward_list_clear(pWebview);
3400 _WebImpl::ClearCache(void)
3402 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3408 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3410 ewk_context_cache_clear(pContext);
3415 _WebImpl::ClearCookie(void)
3417 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3423 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3424 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3426 ewk_cookie_manager_cookies_clear(pCookieManager);
3431 _WebImpl::ClearFormData(void)
3433 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3439 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3441 ewk_context_form_candidate_data_clear(pContext);
3446 _WebImpl::ClearLoginFormData(void)
3448 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3454 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3456 ewk_context_form_password_data_clear(pContext);
3461 _WebImpl::IsCookieEnabled(void) const
3463 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3466 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
3469 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3470 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3471 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3473 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
3474 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3476 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, pPresenter.get());
3478 bool result = false;
3479 pPresenter->WaitAsyncProcess(result);
3486 _WebImpl::SetCookieEnabled(bool enable)
3488 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3491 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
3496 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3497 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3498 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3502 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
3506 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
3507 ewk_cookie_manager_cookies_clear(pCookieManager);
3513 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
3515 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3521 result r = E_SUCCESS;
3523 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
3524 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3527 String fileExtension = File::GetFileExtension(filePath);
3528 int pathLength = filePath.GetLength();
3531 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
3533 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
3534 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3535 r = filePath.SubString(0, index + 1, dirPath);
3536 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3538 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
3539 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
3543 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
3545 ewk_view_contents_pdf_get(pWebview, pSize->width, pSize->height, pFilePath.get());
3549 Evas_Coord contentsWidth;
3550 Evas_Coord contentsHeight;
3552 ewk_view_contents_size_get(pWebview, &contentsWidth, &contentsHeight);
3553 ewk_view_contents_pdf_get(pWebview, contentsWidth, contentsHeight, pFilePath.get());
3561 _WebImpl::IsMimeSupported(const String& mime) const
3563 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3569 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
3570 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3572 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(pWebview), pMime.get()));
3577 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
3579 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
3584 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
3586 __pUserUiListener = pUiEventListener;
3591 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
3593 __pUserUiListenerF = pUiEventListener;
3598 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
3600 __pUserKeypadEventListener = pKeypadEventListener;
3605 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
3607 if (__pWebDownloadHandler.get() == null)
3609 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
3610 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3613 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
3614 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
3619 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
3621 __pTextSearchListener = pTextSearchListener;
3626 _WebImpl::SetScrollEnabled(bool enable)
3628 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
3633 _WebImpl::IsScrollEnabled(void) const
3635 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
3640 _WebImpl::InitJsBridgeList(void)
3642 result r = E_SUCCESS;
3644 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
3645 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3647 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
3648 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3650 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
3651 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3653 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
3654 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3656 __pJsBridgeList = std::move(pJsBridgeList);
3663 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3665 result r = E_SUCCESS;
3667 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3668 String key(pJsBridge->GetName());
3670 r = __pJsBridgeList->Add(key, pJsBridge);
3671 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3678 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3680 result r = E_SUCCESS;
3682 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3683 String key(pJsBridge->GetName());
3685 r = __pJsBridgeList->Remove(key);
3686 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3693 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3695 result r = E_SUCCESS;
3697 IJsonValue* pJsonValue = null;
3698 IJavaScriptBridge* pJsBridge = null;
3700 String key(L"name");
3702 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3703 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));
3705 r = pJsonObject->GetValue(&key, pJsonValue);
3706 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3708 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3709 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3711 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3712 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3719 _WebImpl::GetLoadingListener(void) const
3721 return __pUserLoadingListener;
3725 IWebUiEventListener*
3726 _WebImpl::GetUiEventListener(void) const
3728 return __pUserUiListener;
3732 IWebUiEventListenerF*
3733 _WebImpl::GetUiEventListenerF(void) const
3735 return __pUserUiListenerF;
3739 IWebKeypadEventListener*
3740 _WebImpl::GetWebKeypadEventListener(void) const
3742 return __pUserKeypadEventListener;
3746 ITextSearchListener*
3747 _WebImpl::GetTextSearchListener(void) const
3749 return __pTextSearchListener;
3754 _WebImpl::SetEventListenerCallback(void) const
3756 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3759 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3760 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3762 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3763 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3765 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3766 SysAssertf(pSmartData, "Failed to request");
3768 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3769 SysAssertf(pSmart, "Failed to request");
3771 pSmart->popup_menu_show = OnSelectBoxRequested;
3772 pSmart->multiple_popup_menu_show = OnMultiSelectBoxRequested;
3773 pSmart->popup_menu_hide = OnSelectBoxClosed;
3774 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3776 pSmart->input_picker_show = OnDatePickerProviderRequested;
3777 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3778 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3780 pSmart->formdata_candidate_show = OnFormDataCandidateShow;
3781 pSmart->formdata_candidate_hide = OnFormDataCandidateHide;
3782 pSmart->formdata_candidate_update_data = OnFormDataCandidateUpdate;
3783 pSmart->formdata_candidate_is_showing = OnFormDataCandidateIsShowing;
3785 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3787 // add loading event callbacks for ILoadingListener
3788 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3789 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3791 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3792 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3793 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3794 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3795 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3796 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3797 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3798 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3799 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3801 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3803 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3804 evas_object_smart_callback_add(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3806 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3807 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3808 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3810 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3811 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3813 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3815 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3816 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3817 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3818 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, OnBeforeUnloadConfirmRequested, const_cast< _WebImpl* >(this));
3820 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3822 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3823 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3824 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3826 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3827 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3828 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3830 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3831 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3832 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3834 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3835 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3836 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3837 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3839 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3840 evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
3842 evas_object_smart_callback_add(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected, this);
3844 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
3845 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
3847 evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
3848 evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
3850 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3851 SysAssertf(pContext, "Failed to get webkit instance.");
3852 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3853 ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
3855 ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
3856 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3857 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3858 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
3860 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3861 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost, this);
3867 _WebImpl::RemoveEventListenerCallback(void) const
3869 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3872 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3873 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3875 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3876 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3878 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3879 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3881 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3882 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3883 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3884 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3885 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3886 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3887 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3888 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3889 evas_object_smart_callback_del(pWebNativeNode, "load,committed", OnLoadingCommitted);
3891 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3893 evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3894 evas_object_smart_callback_del_full(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3896 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3897 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3898 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3900 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3901 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3903 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3905 ewk_view_javascript_alert_callback_set(pWebNativeNode, null, null);
3906 ewk_view_javascript_prompt_callback_set(pWebNativeNode, null, null);
3907 ewk_view_javascript_confirm_callback_set(pWebNativeNode, null, null);
3908 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, null, null);
3910 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3912 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3913 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3914 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3916 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3917 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3918 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3919 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3920 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3921 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3923 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3924 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3925 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3927 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3929 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3930 evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
3932 evas_object_smart_callback_del(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected);
3934 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
3935 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
3937 evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
3938 evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
3940 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3941 SysAssertf(pContext, "Failed to get webkit instance.");
3942 ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
3944 ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
3945 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
3946 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
3947 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
3949 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3950 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost);
3956 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3958 return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
3963 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
3965 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3971 Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pWebview));
3972 SysAssertf(pSmartData && pSmartData->api, "Failed to get webkit instance.");
3973 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
3975 Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3978 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3980 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3981 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
3983 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3985 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3986 char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
3987 if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
3989 ewk_view_command_execute(pWebview, "SelectWord", null);
3990 evas_object_smart_callback_call(pWebview, "magnifier,hide", NULL);
3994 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
4001 _WebImpl::ReleaseBlock(void)
4003 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4009 ewk_view_text_selection_range_clear(pWebview);
4014 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
4016 FloatPoint tempStartPoint;
4017 FloatPoint tempEndPoint;
4019 GetBlockRange(tempStartPoint, tempEndPoint);
4021 startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
4022 endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
4027 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
4029 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4032 startPoint.x = startPoint.y = endPoint.x = endPoint.y = 0.0f;
4036 Eina_Rectangle leftHandle;
4037 Eina_Rectangle rightHandle;
4039 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
4040 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
4042 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
4044 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
4045 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
4046 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
4047 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
4049 if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
4051 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
4052 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
4058 _WebImpl::GetFaviconN(void) const
4060 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4066 result r = E_SUCCESS;
4068 Ewk_Context* pContext = ewk_view_context_get(pWebview);
4069 const char* pUrl = ewk_view_url_get(pWebview);
4070 Evas* pEvas = evas_object_evas_get(pWebview);
4072 Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
4078 Tizen::Graphics::BufferInfo bufferInfo;
4080 r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
4081 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4083 const Dimension dimension(bufferInfo.width, bufferInfo.height);
4084 Tizen::Base::ByteBuffer byteBuffer;
4086 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
4087 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4089 std::unique_ptr<Bitmap> pImage(new (std::nothrow) Bitmap());
4090 SysTryReturn(NID_WEB_CTRL, pImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4092 r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
4093 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4095 return pImage.release();
4101 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
4103 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4109 ewk_view_scroll_by(pWebview, diff.x, diff.y);
4114 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
4116 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4122 ewk_view_scroll_set(pWebview, dest.x, dest.y);
4127 _WebImpl::GetScrollPosition(void) const
4129 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4137 ewk_view_scroll_pos_get(pWebview, &position.x, &position.y);
4144 _WebImpl::GetPageSize(void) const
4146 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4149 return Dimension(0, 0);
4152 Evas_Coord width = 0;
4153 Evas_Coord height = 0;
4155 ewk_view_contents_size_get(pWebview, &width, &height);
4157 Dimension size(static_cast< int >(width), static_cast< int >(height));
4164 _WebImpl::SetLoadingErrorOccurred(bool arg)
4166 __isLoadingErrorOccurred = arg;
4171 _WebImpl::IsLoadingErrorOccurred(void) const
4173 return __isLoadingErrorOccurred;
4178 _WebImpl::SetRedirectRequested(bool arg)
4180 __isRedirectRequested = arg;
4185 _WebImpl::IsRedirectRequested(void) const
4187 return __isRedirectRequested;
4192 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
4199 _WebImpl::GetPolicyDecision(void) const
4206 _WebImpl::SetCertificateRequested(bool arg)
4208 __isCertificateRequested = arg;
4213 _WebImpl::IsCertificateRequested(void) const
4215 return __isCertificateRequested;
4220 _WebImpl::SetCertificateConfirmed(bool arg)
4222 __isCertificateConfirmed = arg;
4227 _WebImpl::IsCertificateConfirmed(void) const
4229 return __isCertificateConfirmed;
4234 _WebImpl::SetFullScreenKeypad(void)
4236 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4242 result r = E_SUCCESS;
4244 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
4245 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4247 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
4248 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4250 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pWebCore->GetTouchPosition())));
4252 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
4253 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
4255 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
4256 if (tagName.Equals(L"INPUT", false))
4258 String text(ewk_view_focused_input_element_value_get(pWebview));
4259 pKeypad->SetText(text);
4263 String* pText = EvaluateJavascriptN(L"document.activeElement.value");
4264 SysTryReturnResult(NID_WEB_CTRL, pText, E_OUT_OF_MEMORY, "Memory allocation failed.");
4265 pKeypad->SetText(*pText);
4268 r = pKeypad->SetShowState(true);
4269 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4271 r = pKeypad->Show();
4272 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4274 pKeypad->AddTextEventListener(*this);
4276 __pKeypad = std::move(pKeypad);
4283 _WebImpl::RemoveFullScreenKeypad(void)
4285 __pKeypad->RemoveTextEventListener(*this);
4292 _WebImpl::IsFooterVisible(void) const
4294 return __isFooterVisible;
4299 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
4301 __isFooterVisible = isFooterVisible;
4306 _WebImpl::IsKeypadVisible(void) const
4308 return __isKeypadVisible;
4313 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
4315 __isKeypadVisible = isKeypadVisible;
4320 _WebImpl::IsKeypadOpened(void) const
4322 return __isKeypadOpened;
4326 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
4328 __isKeypadOpened = isKeypadOpened;
4333 _WebImpl::IsWinFocusLost(void) const
4335 return __isWinFocusLost;
4340 _WebImpl::SetWinFocusLost(bool isWinFocusLost)
4342 __isWinFocusLost = isWinFocusLost;
4347 _WebImpl::GetPreviousKeypadBounds(void) const
4349 return __keypadBounds;
4354 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
4356 __keypadBounds = bounds;
4361 _WebImpl::OnTextValueChangeCanceled(const Control& source)
4363 RemoveFullScreenKeypad();
4368 _WebImpl::OnTextValueChanged(const Control& source)
4370 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4376 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
4377 SysTryReturnVoidResult(NID_WEB_CTRL, pText.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
4379 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pWebCore->GetTouchPosition())));
4381 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
4382 SysTryReturnVoidResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "[E_SYSTEM] Failed to get hit test.");
4384 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
4385 if (tagName.Equals(L"INPUT", false))
4387 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
4391 ewk_view_command_execute(pWebview, "SelectAll", null);
4392 ewk_view_command_execute(pWebview, "Delete", null);
4393 ewk_view_command_execute(pWebview, "InsertText", pText.get());
4396 RemoveFullScreenKeypad();
4401 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
4403 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
4404 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
4406 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
4407 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4409 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
4410 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
4412 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
4419 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
4421 result r = E_SUCCESS;
4423 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
4424 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4426 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4428 ILoadingListener* pLoadingListner = GetLoadingListener();
4429 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
4431 switch (pEventArg->GetEventType())
4433 case WEB_EVENT_LOADINGLISTENER_STARTED:
4435 pLoadingListner->OnLoadingStarted();
4439 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
4441 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
4442 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4444 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
4448 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
4450 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
4451 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4453 pLoadingListner->OnPageTitleReceived(*pPageTitle);
4457 case WEB_EVENT_LOADINGLISTENER_CANCELED:
4459 pLoadingListner->OnLoadingCanceled();
4463 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
4465 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
4466 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4468 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
4469 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4471 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
4473 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
4477 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
4479 pLoadingListner->OnLoadingCompleted();
4483 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
4485 pLoadingListner->OnHttpAuthenticationCanceled();
4489 case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
4491 std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
4492 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4496 pLoadingListner->OnFaviconReceived(*pFavicon.get());
4512 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
4514 result r = E_SUCCESS;
4516 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
4517 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4519 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4521 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
4522 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
4524 switch (pEventArg->GetEventType())
4526 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
4528 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
4529 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4531 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
4535 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
4537 pWebDownloadListener->OnWebDataDownloadCompleted();
4541 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
4543 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
4544 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4546 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
4548 pWebDownloadListener->OnWebDownloadFailed(errorType);
4563 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
4565 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4566 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4568 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4570 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4572 switch (pEventArg->GetEventType())
4574 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
4576 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4578 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4579 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4581 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4582 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4584 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4588 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
4590 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4592 __pUserUiListener->OnWebPageShowRequested(*pWeb);
4596 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
4598 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4600 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
4604 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
4606 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4608 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4609 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4611 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4626 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
4628 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4629 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4631 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4633 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4635 switch (pEventArg->GetEventType())
4637 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
4639 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4641 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4642 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4644 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4645 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4647 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4651 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
4653 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4655 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
4659 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
4661 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4663 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
4667 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
4669 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4671 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4672 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4674 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4689 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
4691 result r = E_SUCCESS;
4693 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
4694 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4696 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4698 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
4699 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
4701 switch (pEventArg->GetEventType())
4703 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4705 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4706 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4708 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4709 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4711 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4726 _WebImpl::VibrationRequested(uint64_t duration)
4728 result r = E_SUCCESS;
4730 __pVibrator.reset();
4732 std::unique_ptr<Vibrator> pVibrator(new (std::nothrow) Vibrator());
4733 SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4735 r = pVibrator->Construct();
4736 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4738 __pVibrator = std::move(pVibrator);
4740 IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
4742 r = __pVibrator->Start(&pattern, 1);
4743 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4750 _WebImpl::VibrationCanceled(void)
4752 __pVibrator.reset();
4757 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4759 result r = E_SUCCESS;
4761 String host(ewk_auth_challenge_url_get(pChallenge));
4762 String realm(ewk_auth_challenge_realm_get(pChallenge));
4764 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4765 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4767 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4768 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4770 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4771 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4773 __pAuthChallenge = std::move(pAuthChallenge);
4775 ewk_auth_challenge_suspend(pChallenge);
4776 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4778 __pAuthChallenge.release();
4782 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4783 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4791 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4793 result r = E_SUCCESS;
4795 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4796 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4798 r = pAuthPopup->Construct(host, realm, this);
4799 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4801 __pAuthPopup = std::move(pAuthPopup);
4803 r = __pAuthPopup->ShowPopup();
4804 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4811 _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
4813 result r = E_SUCCESS;
4815 std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
4816 SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4818 r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
4819 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4821 __pCertConfirmPopup = std::move(pCertConfirmPopup);
4823 int modalResult = 0;
4825 r = __pCertConfirmPopup->ShowAndWait(modalResult);
4826 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4828 if (__pCertConfirmPopup.get() && userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
4830 __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
4834 if (__pCertConfirmPopup.get())
4836 __pCertConfirmPopup.reset();
4844 _WebImpl::ShowPromptPopup(String msg, String defVal)
4846 result r = E_SUCCESS;
4848 std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
4849 SysTryReturnResult(NID_WEB_CTRL, pPromptPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4851 r = pPromptPopup->Construct(msg, defVal, __pWebCore->GetWebNativeNode(), this);
4852 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4854 __pPromptPopup = std::move(pPromptPopup);
4856 r = __pPromptPopup->ShowPopup();
4857 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4862 __pPromptPopup.reset();
4870 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4872 result r = E_SUCCESS;
4874 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4875 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4877 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, true, msg);
4878 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4880 int modalResult = 0;
4882 switch(userConfirmMode)
4884 case USER_CONTENT_HANDLER:
4886 __pContentHandlerConfirmPopup = std::move(pUserConfirmPopup);
4888 r = __pContentHandlerConfirmPopup->ShowAndWait(modalResult);
4889 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pContentHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4891 __pContentHandlerConfirmPopup.reset();
4893 ewk_view_resume(__pWebCore->GetWebNativeNode());
4897 case USER_PROTOCOL_HANDLER:
4899 __pProtocolHandlerConfirmPopup = std::move(pUserConfirmPopup);
4901 r = __pProtocolHandlerConfirmPopup->ShowAndWait(modalResult);
4902 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pProtocolHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4904 __pProtocolHandlerConfirmPopup.reset();
4906 ewk_view_resume(__pWebCore->GetWebNativeNode());
4910 case USER_CONFIRM_APP_CACHE:
4912 __pAppCacheConfirmPopup = std::move(pUserConfirmPopup);
4914 r = __pAppCacheConfirmPopup->ShowAndWait(modalResult);
4915 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pAppCacheConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4917 __pAppCacheConfirmPopup.reset();
4919 ewk_view_resume(__pWebCore->GetWebNativeNode());
4923 case USER_CONFIRM_DB_QUOTA_EXCEDED:
4925 __pDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4927 r = __pDbQuotaConfirmPopup->ShowAndWait(modalResult);
4928 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4930 __pDbQuotaConfirmPopup.reset();
4932 ewk_view_resume(__pWebCore->GetWebNativeNode());
4936 case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
4938 __pLocalFsQuotaConfirmPopup = std::move(pUserConfirmPopup);
4940 r = __pLocalFsQuotaConfirmPopup->ShowAndWait(modalResult);
4941 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pLocalFsQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4943 __pLocalFsQuotaConfirmPopup.reset();
4945 ewk_view_resume(__pWebCore->GetWebNativeNode());
4949 case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
4951 __pIndexedDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4953 r = __pIndexedDbQuotaConfirmPopup->ShowAndWait(modalResult);
4954 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4956 __pIndexedDbQuotaConfirmPopup.reset();
4958 ewk_view_resume(__pWebCore->GetWebNativeNode());
4971 _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4973 result r = E_SUCCESS;
4975 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4976 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4978 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, false, msg);
4979 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4981 switch(userConfirmMode)
4983 case USER_CONFIRM_USERMEDIA:
4985 __pUserMediaConfirmPopup.reset();
4987 __pUserMediaConfirmPopup = std::move(pUserConfirmPopup);
4989 r = __pUserMediaConfirmPopup->ShowPopup();
4990 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pUserMediaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4994 case USER_CONFIRM_GEOLOCATION:
4996 __pGeolocationConfirmPopup.reset();
4998 __pGeolocationConfirmPopup = std::move(pUserConfirmPopup);
5000 r = __pGeolocationConfirmPopup->ShowPopup();
5001 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pGeolocationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5005 case USER_CONFIRM_NOTIFICATION:
5007 __pNotificationConfirmPopup.reset();
5009 __pNotificationConfirmPopup = std::move(pUserConfirmPopup);
5011 r = __pNotificationConfirmPopup->ShowPopup();
5012 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pNotificationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5016 case USER_SCRIPT_ALERT:
5018 __pScriptAlertConfirmPopup.reset();
5020 __pScriptAlertConfirmPopup = std::move(pUserConfirmPopup);
5022 r = __pScriptAlertConfirmPopup->ShowPopup();
5023 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptAlertConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5027 case USER_SCRIPT_CONFIRM:
5029 __pScriptConfirmPopup.reset();
5031 __pScriptConfirmPopup = std::move(pUserConfirmPopup);
5033 r = __pScriptConfirmPopup->ShowPopup();
5034 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5038 case USER_BEFORE_UNLOAD_CONFIRM:
5040 __pBeforeUnloadConfirmPopup.reset();
5042 __pBeforeUnloadConfirmPopup = std::move(pUserConfirmPopup);
5044 r = __pBeforeUnloadConfirmPopup->ShowPopup();
5045 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pBeforeUnloadConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5061 _WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl)
5064 _FormImpl* pFormImpl = null;
5066 _ControlImpl* pParentControlImpl = dynamic_cast< _ControlImpl* >(pControlImpl->GetParent());
5067 if (!pParentControlImpl)
5072 pFormImpl = dynamic_cast< _FormImpl* >(pParentControlImpl);
5078 return GetParentFormImpl(pParentControlImpl);
5083 _WebImpl::OnFocusGained(const _ControlImpl& source)
5090 _WebImpl::OnFocusLost(const _ControlImpl& source)
5092 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5098 if(IsKeypadVisible() == true)
5100 SetKeypadOpened(true);
5108 _WebImpl::HasValidNativeNode(void) const
5110 if (__pWebCore && __pWebCore->GetWebNativeNode())
5120 _WebImpl::OnPreAttachedToMainTree(void)
5122 result r = E_SUCCESS;
5124 r = _ContainerImpl::OnPreAttachedToMainTree();
5125 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5127 if (!HasValidNativeNode())
5129 r = __pWebCore->InitializeWebNativeNode();
5130 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5132 _ControlManager* pControlManager = _ControlManager::GetInstance();
5133 SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the _ControlManager instance.");
5134 OnChangeLayout(pControlManager->GetScreenRotation());
5136 r = InitializeSetting();
5137 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5139 _SettingInfoImpl::AddSettingEventListener(*this);
5141 _WebManager* pWebManager = _WebManager::GetInstance();
5142 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5143 pWebManager->AddWeb(reinterpret_cast< int >(this));
5146 if (IsVisible() == true)
5148 _WebManager* pWebManager = _WebManager::GetInstance();
5149 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5150 pWebManager->SetActiveWeb(this);
5158 _WebImpl::OnDetachingFromMainTree(void)
5160 result r = E_SUCCESS;
5162 r = _ContainerImpl::OnDetachingFromMainTree();
5163 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5165 _WebManager* pWebManager = _WebManager::GetInstance();
5166 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5167 pWebManager->RemoveActiveWeb(this);
5174 _WebImpl::OnSettingChanged(String& key)
5176 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5182 if (key == L"http://tizen.org/setting/font.type")
5184 ewk_view_use_settings_font(pWebview);
5190 _WebImpl::OnChangeLayout(_ControlRotation rotation)
5192 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5202 case _CONTROL_ROTATION_0:
5205 case _CONTROL_ROTATION_90:
5208 case _CONTROL_ROTATION_180:
5211 case _CONTROL_ROTATION_270:
5217 ewk_view_orientation_send(pWebview, degree);
5222 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
5224 _ContainerImpl::OnChangeLayout(orientation);
5226 if (__pColorPicker.get())
5228 __pColorPicker->ChangeLayout(orientation);
5231 HideFormDataWindow();
5233 std::unique_ptr< IEnumerator > pEnum(__webNotificationList.GetEnumeratorN());
5234 _WebNotification* pWebNotification = null;
5236 while (pEnum->MoveNext() == E_SUCCESS)
5238 pWebNotification = static_cast< _WebNotification* >(pEnum->GetCurrent());
5239 pWebNotification->OnChangeLayout();
5242 if (IsKeypadVisible())
5244 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
5245 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
5247 _FormImpl* pFormImpl = GetParentFormImpl(dynamic_cast< _ControlImpl* >(this));
5248 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(GetPreviousKeypadBounds().height));
5254 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
5256 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5262 _WebManager* pWebManager = _WebManager::GetInstance();
5263 SysTryReturnVoidResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "[E_SYSTEM] Failed to get the _WebManager instance.");
5264 if (IsVisible() == true)
5266 pWebManager->SetActiveWeb(this);
5269 // ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, true);
5273 // ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
5278 pWebManager->RemoveActiveWeb(this);
5281 // ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, true);
5285 // ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
5292 _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
5294 _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
5298 case ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL:
5299 __pAuthPopup->RemoveAllControls();
5300 __pAuthPopup.reset();
5301 __pAuthChallenge->Cancel();
5302 __pAuthChallenge.reset();
5304 case ID_AUTHENTICATION_CONFIRM_POPUP_PROCESS:
5305 __pAuthPopup->RemoveAllControls();
5306 __pAuthPopup.reset();
5309 std::unique_ptr<ArrayList, AllElementsDeleter> pAuthValue(reinterpret_cast< ArrayList* >(pArgs));
5310 __pAuthChallenge->Process(*reinterpret_cast< String* >(pAuthValue->GetAt(0)),*reinterpret_cast< String* >(pAuthValue->GetAt(1)));
5312 __pAuthChallenge.reset();
5314 case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
5315 __pCertConfirmPopup.reset();
5317 case ID_PROMPT_POPUP_CLOSE:
5318 __pPromptPopup.reset();
5320 case ID_USER_CONFIRM_USERMEDIA_CLOSE:
5321 __pUserMediaConfirmPopup.reset();
5323 case ID_USER_CONFIRM_GEOLOCATION_CLOSE:
5324 __pGeolocationConfirmPopup.reset();
5326 case ID_USER_CONFIRM_NOTIFICATION_CLOSE:
5327 __pNotificationConfirmPopup.reset();
5329 case ID_USER_SCRIPT_ALERT_CLOSE:
5330 __pScriptAlertConfirmPopup.reset();
5332 case ID_USER_SCRIPT_CONFIRM_CLOSE:
5333 __pScriptConfirmPopup.reset();
5336 case ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE:
5337 __pBeforeUnloadConfirmPopup.reset();
5340 case ID_USER_SCRIPT_SELECTBOX_CLOSE:
5341 __pSelectBox.reset();
5352 _WebImpl::GetDownloadHandler(void) const
5354 return __pWebDownloadHandler.get();
5359 _WebImpl::HideColorPicker(void)
5361 __pColorPicker.reset();
5370 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
5372 result r = E_SUCCESS;
5374 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
5375 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5377 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
5379 r = pColorHadler->Construct(colorVal, this);
5380 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5382 __pColorPicker = std::move(pColorHadler);
5384 int modalResult = 0;
5385 r = __pColorPicker->ShowAndWait(modalResult);
5386 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5390 color = __pColorPicker->GetColor();
5396 __pColorPicker.reset();
5405 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
5407 result r = E_SUCCESS;
5409 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
5410 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5412 r = pInputPicker->Construct(String(inputValue), inputType, this);
5413 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5415 __pDatePicker = std::move(pInputPicker);
5417 int modalResult = 0;
5418 r = __pDatePicker->ShowAndWait(modalResult);
5419 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5423 dateStr = __pDatePicker->GetDate();
5429 __pDatePicker.reset();
5438 _WebImpl::GetInstance(Web* pWeb)
5440 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5445 _WebImpl::GetInstance(const Web* pWeb)
5447 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5452 _WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5454 int checkReturn = 0;
5456 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5459 if( checkmime == true)
5461 table = CUSTOM_CONTENT_TABLE_NAME;
5465 table = CUSTOM_PROTOCOL_TABLE_NAME;
5468 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5469 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5470 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5472 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5474 result r = db.Construct(handlerPath, "r+", null);
5475 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5477 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"'"));
5478 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5482 r = pEnum->MoveNext();
5483 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5484 r = pEnum->GetIntAt(0, checkReturn);
5485 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5497 _WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5501 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5504 if( checkmime == true)
5506 table = CUSTOM_CONTENT_TABLE_NAME;
5510 table = CUSTOM_PROTOCOL_TABLE_NAME;
5513 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5514 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5515 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5517 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5519 result r = db.Construct(handlerPath, "r+", null);
5520 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5522 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"'"));
5523 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5527 r = pEnum->MoveNext();
5528 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5529 r = pEnum->GetIntAt(0, checkId);
5530 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5532 std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
5533 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5535 r = pDeleteStmt->BindInt(0, checkId);
5536 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5538 db.BeginTransaction();
5540 std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
5542 db.CommitTransaction();
5549 const Tizen::Base::String
5550 _WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
5552 if (originUri == L"" || currentUri == L"")
5557 result r = E_SUCCESS;
5560 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5561 String originReplace(originUri);
5562 String table(CUSTOM_PROTOCOL_TABLE_NAME);
5566 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5567 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5569 r = currentUri.SubString(0, found + 1, baseUri);
5570 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5572 r = db.Construct(handlerPath, "r+", null);
5573 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5575 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
5576 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
5580 while (pEnum->MoveNext() == E_SUCCESS)
5585 String originScheme;
5587 r = pEnum->GetStringAt(0, protocol);
5588 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5590 r = pEnum->GetStringAt(1, queryUrl);
5591 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5593 r = pEnum->GetIntAt(2, allow);
5594 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5601 String protocolScheme(protocol + L":");
5603 r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
5604 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5606 if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
5608 if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
5610 r = originReplace.Replace(originScheme, "");
5611 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5613 queryUrl.Replace("%s", originReplace, 0);
5614 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5626 const Tizen::Base::String
5627 _WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
5629 if (originUri == L"" || currentUri == L"" || mime == L"")
5634 result r = E_SUCCESS;
5637 String originUrlStr = originUri;
5638 const String replaceStr = L"%s";
5640 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5641 String table(CUSTOM_CONTENT_TABLE_NAME);
5645 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5646 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5648 r = currentUri.SubString(0, found + 1, baseUri);
5649 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5651 r = db.Construct(handlerPath, "r+", null);
5652 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5654 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
5658 r = pEnum->MoveNext();
5659 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5660 r = pEnum->GetIntAt(0, allow);
5661 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5662 r = pEnum->GetStringAt(1, contentUrl);
5663 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5671 if (contentUrl != L"")
5673 r = contentUrl.Replace(replaceStr, originUrlStr, 0);
5674 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5686 _WebImpl::SetFormDataList(Eina_List* pFormDataList)
5688 __pFormDataList = pFormDataList;
5693 _WebImpl::IsFormDataWindowVisible(void) const
5695 return __isFormDataVisible;
5700 _WebImpl::ShowFormDataWindow(const Rectangle& windowRect, Evas_Object* pWebView)
5702 Rectangle rect(_CoordinateSystemUtils::InverseTransform(Rectangle(windowRect.x, windowRect.y + windowRect.height, windowRect.width, windowRect.height)));
5704 if (__isFormDataVisible)
5706 result r = __pFormDataWindow->UpdateList(__pFormDataList, rect);
5707 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5711 __pFormDataWindow.reset();
5713 std::unique_ptr<_FormDataWindow> pFormDataWindow( new (std::nothrow) _FormDataWindow());
5714 SysTryReturnResult(NID_WEB_CTRL, pFormDataWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
5716 result r = pFormDataWindow->Construct(rect, this, pWebView);
5717 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5719 r = pFormDataWindow->UpdateList(__pFormDataList, rect);
5720 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5722 r = pFormDataWindow->LaunchFormDataWindow();
5723 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5725 __pFormDataWindow = std::move(pFormDataWindow);
5726 __isFormDataVisible = true;
5734 _WebImpl::HideFormDataWindow(bool delWindow)
5738 __pFormDataWindow.reset();
5741 __isFormDataVisible = false;
5746 _WebImpl::ClearWebNotification(_WebNotification* pWebNotification)
5748 __webNotificationList.Remove(*pWebNotification);
5753 _WebImpl::SetWebNotification(_WebNotification* pWebNotification)
5755 __webNotificationList.Add(pWebNotification);
5759 }}} // Tizen::Web::Controls