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.");
2608 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT - 1, pWebView);
2612 r = pSelectBox->Construct(this, isMultiSelect, title, DEFAULT_LIST_ITEM_COUNT, pWebView);
2614 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2616 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2617 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2619 __pSelectBox = std::move(pSelectBox);
2621 return __pSelectBox->ShowPopup();
2626 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2628 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2630 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2635 _WebImpl::ClearSelectBoxPopup(void)
2637 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2639 __pSelectBox.reset();
2648 _WebImpl::GetDatepicker(void)
2650 _InputPickerPopup* pInputPicker =null;
2653 pInputPicker = __pDatePicker.get();
2655 return pInputPicker;
2660 _WebImpl::GetColorpicker(void)
2662 _InputPickerPopup* pInputPicker =null;
2665 pInputPicker = __pColorPicker.get();
2667 return pInputPicker;
2672 _WebImpl::CanGoBack(void) const
2674 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2680 return static_cast< bool >(ewk_view_back_possible(pWebview));
2685 _WebImpl::CanGoForward(void) const
2687 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2693 return static_cast< bool >(ewk_view_forward_possible(pWebview));
2698 _WebImpl::GoBack(void) const
2700 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2706 ewk_view_back(pWebview);
2711 _WebImpl::GoForward(void) const
2713 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2719 ewk_view_forward(pWebview);
2724 _WebImpl::GetUrl(void) const
2726 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2732 return ewk_view_url_get(pWebview);
2737 _WebImpl::GetTitle(void) const
2739 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2745 return ewk_view_title_get(pWebview);
2750 _WebImpl::StopLoading(void) const
2752 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2758 ewk_view_stop(pWebview);
2763 _WebImpl::Reload(void) const
2765 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2771 ewk_view_reload(pWebview);
2776 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
2778 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2784 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2785 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2787 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2788 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2790 ewk_view_script_execute(pWebview, pScript.get(), OnScriptExecuted, pPresenter.get());
2792 String* pResult = new (std::nothrow) String(L"");
2793 SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2795 pPresenter->WaitAsyncProcess(*pResult);
2802 _WebImpl::SetZoomLevel(float level)
2804 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2810 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);
2812 ewk_view_scale_set(pWebview, static_cast< double >(level), 0, 0);
2819 _WebImpl::GetZoomLevel(void) const
2821 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2827 return static_cast< float >(ewk_view_scale_get(pWebview));
2831 const PageNavigationList*
2832 _WebImpl::GetBackForwardListN(void) const
2834 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2840 result r = E_SUCCESS;
2842 _PageNavigationListImpl* pNavigationListImpl = null;
2843 _HistoryItemImpl* pHistoryItemImpl = null;
2845 std::unique_ptr<PageNavigationList> pNavigationList;
2846 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2849 int forwardCount = 0;
2854 Ewk_History* pEwkHistoryList = ewk_view_history_get(pWebview);
2855 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2857 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2858 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2860 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2861 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2863 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2864 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2866 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2867 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2869 r = pHistoryList->Construct();
2870 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2872 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2873 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2874 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2876 for (int i = -backCount; i < forwardCount + 1; i++)
2878 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2879 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2881 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2882 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2884 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2885 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2887 url = ewk_history_item_uri_get(pEwkItem);
2888 title = ewk_history_item_title_get(pEwkItem);
2889 SysSecureLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2891 pHistoryItemImpl->SetHistoryItem(url, title);
2893 r = pHistoryList->Add(*pHistoryItem.get());
2894 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2895 pHistoryItem.release();
2898 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2900 ewk_history_free(pEwkHistoryList);
2902 return pNavigationList.release();
2905 ewk_history_free(pEwkHistoryList);
2912 _WebImpl::SearchText(const String& text, bool searchForward)
2914 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2920 result r = E_SUCCESS;
2922 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2926 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2929 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
2930 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2932 r = SynchronizeSearch(SEARCH_SYNC, pWebview, condition, text, searchForward, false, pPresenter.get());
2933 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
2936 pPresenter->WaitAsyncProcess(result);
2938 return static_cast < bool >(result);
2943 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2945 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2951 result r = E_SUCCESS;
2953 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2957 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2960 r = SynchronizeSearch(SEARCH_ALL_ASYNC, pWebview, condition, text, true, caseSensitive);
2961 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2968 _WebImpl::SearchNextAsync(bool searchForward)
2970 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
2976 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2977 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2978 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2980 result r = E_SUCCESS;
2982 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2984 if (!__textSearch.__caseSensitive)
2986 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2991 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2994 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pWebview, condition, __textSearch.__text, searchForward);
2995 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3002 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
3004 MutexGuard lock(__mutex);
3006 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
3007 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3012 if (__textSearch.__searchAll)
3014 DisableAsyncSearch();
3016 __textSearch.__searchQueue.Enqueue(this);
3017 __textSearch.__searchQueue.Enqueue(pWebPresenter);
3019 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
3020 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3024 __textSearch.__searchQueue.Enqueue(pWebPresenter);
3026 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3030 case SEARCH_ALL_ASYNC:
3031 __textSearch.__searchAll = true;
3032 __textSearch.__text = text;
3033 __textSearch.__searchForward = true;
3034 __textSearch.__caseSensitive = caseSensitive;
3035 __textSearch.__totalCount = -1;
3036 __textSearch.__currentIndex = 1;
3038 __textSearch.__searchQueue.Enqueue(this);
3039 __textSearch.__searchQueue.Enqueue(this);
3041 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
3042 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3045 case SEARCH_NEXT_ASYNC:
3046 __textSearch.__searchForward = searchForward;
3048 CalculateAsyncSearchOrdinal();
3050 __textSearch.__searchQueue.Enqueue(this);
3052 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
3064 _WebImpl::SetAsyncSearchResult(int totalCount)
3066 __textSearch.__totalCount = totalCount;
3071 _WebImpl::GetSearchPresenter(void)
3073 MutexGuard lock(__mutex);
3075 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
3080 _WebImpl::GetPendingAsyncSearchCount(void) const
3082 return __textSearch.__searchQueue.GetCount();
3087 _WebImpl::CalculateAsyncSearchOrdinal(void)
3089 if (__textSearch.__searchForward)
3091 __textSearch.__currentIndex++;
3095 __textSearch.__currentIndex--;
3101 _WebImpl::GetAsyncSearchOrdinal(void) const
3103 return __textSearch.__currentIndex;
3108 _WebImpl::DisableAsyncSearch(void)
3110 __textSearch.__searchAll = false;
3115 _WebImpl::SetSetting(const WebSetting& setting)
3117 if (__pWebCore->GetWebNativeNode())
3119 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
3120 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
3121 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
3123 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
3124 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3126 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
3128 switch (setting.GetCacheControl())
3130 case WEB_CACHE_VALIDATED:
3131 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
3134 case WEB_CACHE_IGNORE:
3135 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
3142 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
3144 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
3148 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
3151 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
3153 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
3155 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
3157 if (__defaultUserAgent != setting.GetUserAgent())
3159 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
3160 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3162 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
3165 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
3167 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
3169 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
3171 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
3174 _WebSettingImpl* pWebSettingImpl = _WebSettingImpl::GetInstance(__pWebCore->GetSetting());
3176 pWebSettingImpl->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
3177 pWebSettingImpl->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
3178 pWebSettingImpl->SetCacheControl(setting.GetCacheControl());
3179 pWebSettingImpl->SetFontSize(setting.GetFontSize());
3180 pWebSettingImpl->SetJavascriptEnabled(setting.IsJavascriptEnabled());
3181 pWebSettingImpl->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
3182 pWebSettingImpl->SetInputStyle(setting.GetInputStyle());
3183 pWebSettingImpl->SetUserAgent(setting.GetUserAgent());
3184 pWebSettingImpl->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
3185 pWebSettingImpl->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
3186 pWebSettingImpl->SetGeolocationEnabled(setting.IsGeolocationEnabled());
3187 pWebSettingImpl->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
3188 pWebSettingImpl->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
3195 _WebImpl::GetSetting(void) const
3197 return *__pWebCore->GetSetting();
3201 const HitElementResult*
3202 _WebImpl::GetElementByPointN(const Point& point) const
3204 return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
3208 const HitElementResult*
3209 _WebImpl::GetElementByPointN(const FloatPoint& point) const
3211 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3217 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));
3219 result r = E_SUCCESS;
3221 _HitElementResultImpl* pHitElementResultImpl = null;
3223 std::unique_ptr<HitElementResult> pHitElementResult;
3224 std::unique_ptr<Bitmap> pImage;
3225 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
3227 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
3229 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3230 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
3232 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3233 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
3234 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
3235 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3236 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
3238 SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
3240 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
3241 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3243 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
3244 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3246 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
3252 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
3253 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
3254 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
3255 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
3257 r = buf.Construct(imageLength);
3258 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3260 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
3261 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3265 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
3266 // webkit support types such as ico and vp8 additionally
3267 if (strcmp(pExtension, "gif") == 0)
3269 format = IMG_FORMAT_GIF;
3271 else if (strcmp(pExtension, "jpg") == 0)
3273 format = IMG_FORMAT_JPG;
3275 else if (strcmp(pExtension, "png") == 0)
3277 format = IMG_FORMAT_PNG;
3279 else if (strcmp(pExtension, "bmp") == 0)
3281 format = IMG_FORMAT_BMP;
3285 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
3289 r = image.Construct();
3290 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3292 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
3293 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3298 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
3299 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3301 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
3302 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
3304 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
3305 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3308 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
3310 ewk_hit_test_free(pEwkHitTest);
3312 return pHitElementResult.release();
3315 ewk_hit_test_free(pEwkHitTest);
3322 _WebImpl::IsLoading(void) const
3324 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3330 double percent = ewk_view_load_progress_get(pWebview);
3332 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
3344 _WebImpl::GetTextFromBlock(void) const
3346 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3352 return ewk_view_text_selection_text_get(pWebview);
3357 _WebImpl::IsPrivateBrowsingEnabled(void) const
3359 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3362 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
3365 Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
3366 SysAssertf(pSettings, "Failed to get webkit instance.");
3368 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
3373 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
3375 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3378 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
3383 Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
3384 SysAssertf(pSettings, "Failed to get webkit instance.");
3386 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
3391 _WebImpl::ClearHistory(void)
3393 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3399 ewk_view_back_forward_list_clear(pWebview);
3404 _WebImpl::ClearCache(void)
3406 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3412 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3414 ewk_context_cache_clear(pContext);
3419 _WebImpl::ClearCookie(void)
3421 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3427 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3428 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3430 ewk_cookie_manager_cookies_clear(pCookieManager);
3435 _WebImpl::ClearFormData(void)
3437 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3443 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3445 ewk_context_form_candidate_data_clear(pContext);
3450 _WebImpl::ClearLoginFormData(void)
3452 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3458 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3460 ewk_context_form_password_data_clear(pContext);
3465 _WebImpl::IsCookieEnabled(void) const
3467 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3470 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
3473 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3474 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3475 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3477 std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
3478 SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3480 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, pPresenter.get());
3482 bool result = false;
3483 pPresenter->WaitAsyncProcess(result);
3490 _WebImpl::SetCookieEnabled(bool enable)
3492 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3495 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
3500 Ewk_Context* pContext = ewk_view_context_get(pWebview);
3501 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
3502 SysAssertf(pCookieManager, "Failed to get webkit instance.");
3506 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
3510 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
3511 ewk_cookie_manager_cookies_clear(pCookieManager);
3517 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
3519 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3525 result r = E_SUCCESS;
3527 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
3528 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3531 String fileExtension = File::GetFileExtension(filePath);
3532 int pathLength = filePath.GetLength();
3535 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
3537 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
3538 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3539 r = filePath.SubString(0, index + 1, dirPath);
3540 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
3542 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
3543 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
3547 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
3549 ewk_view_contents_pdf_get(pWebview, pSize->width, pSize->height, pFilePath.get());
3553 Evas_Coord contentsWidth;
3554 Evas_Coord contentsHeight;
3556 ewk_view_contents_size_get(pWebview, &contentsWidth, &contentsHeight);
3557 ewk_view_contents_pdf_get(pWebview, contentsWidth, contentsHeight, pFilePath.get());
3565 _WebImpl::IsMimeSupported(const String& mime) const
3567 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3573 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
3574 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3576 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(pWebview), pMime.get()));
3581 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
3583 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
3588 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
3590 __pUserUiListener = pUiEventListener;
3595 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
3597 __pUserUiListenerF = pUiEventListener;
3602 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
3604 __pUserKeypadEventListener = pKeypadEventListener;
3609 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
3611 if (__pWebDownloadHandler.get() == null)
3613 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
3614 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3617 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
3618 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
3623 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
3625 __pTextSearchListener = pTextSearchListener;
3630 _WebImpl::SetScrollEnabled(bool enable)
3632 _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetScrollEnabled(enable);
3637 _WebImpl::IsScrollEnabled(void) const
3639 return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsScrollEnabled();
3644 _WebImpl::InitJsBridgeList(void)
3646 result r = E_SUCCESS;
3648 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
3649 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3651 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
3652 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3654 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
3655 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
3657 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
3658 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3660 __pJsBridgeList = std::move(pJsBridgeList);
3667 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3669 result r = E_SUCCESS;
3671 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3672 String key(pJsBridge->GetName());
3674 r = __pJsBridgeList->Add(key, pJsBridge);
3675 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3682 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3684 result r = E_SUCCESS;
3686 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3687 String key(pJsBridge->GetName());
3689 r = __pJsBridgeList->Remove(key);
3690 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3697 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3699 result r = E_SUCCESS;
3701 IJsonValue* pJsonValue = null;
3702 IJavaScriptBridge* pJsBridge = null;
3704 String key(L"name");
3706 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3707 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));
3709 r = pJsonObject->GetValue(&key, pJsonValue);
3710 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3712 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3713 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3715 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3716 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3723 _WebImpl::GetLoadingListener(void) const
3725 return __pUserLoadingListener;
3729 IWebUiEventListener*
3730 _WebImpl::GetUiEventListener(void) const
3732 return __pUserUiListener;
3736 IWebUiEventListenerF*
3737 _WebImpl::GetUiEventListenerF(void) const
3739 return __pUserUiListenerF;
3743 IWebKeypadEventListener*
3744 _WebImpl::GetWebKeypadEventListener(void) const
3746 return __pUserKeypadEventListener;
3750 ITextSearchListener*
3751 _WebImpl::GetTextSearchListener(void) const
3753 return __pTextSearchListener;
3758 _WebImpl::SetEventListenerCallback(void) const
3760 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3763 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3764 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3766 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3767 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3769 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3770 SysAssertf(pSmartData, "Failed to request");
3772 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3773 SysAssertf(pSmart, "Failed to request");
3775 pSmart->popup_menu_show = OnSelectBoxRequested;
3776 pSmart->multiple_popup_menu_show = OnMultiSelectBoxRequested;
3777 pSmart->popup_menu_hide = OnSelectBoxClosed;
3778 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3780 pSmart->input_picker_show = OnDatePickerProviderRequested;
3781 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3782 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3784 pSmart->formdata_candidate_show = OnFormDataCandidateShow;
3785 pSmart->formdata_candidate_hide = OnFormDataCandidateHide;
3786 pSmart->formdata_candidate_update_data = OnFormDataCandidateUpdate;
3787 pSmart->formdata_candidate_is_showing = OnFormDataCandidateIsShowing;
3789 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3791 // add loading event callbacks for ILoadingListener
3792 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3793 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3795 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3796 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3797 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3798 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3799 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3800 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3801 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3802 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3803 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3805 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3807 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3808 evas_object_smart_callback_add(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3810 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3811 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3812 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3814 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3815 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3817 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3819 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3820 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3821 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3822 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, OnBeforeUnloadConfirmRequested, const_cast< _WebImpl* >(this));
3824 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3826 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3827 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3828 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3830 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3831 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3832 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3834 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3835 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3836 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3838 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3839 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3840 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3841 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3843 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3844 evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
3846 evas_object_smart_callback_add(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected, this);
3848 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
3849 evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
3851 evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
3852 evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
3854 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3855 SysAssertf(pContext, "Failed to get webkit instance.");
3856 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3857 ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
3859 ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
3860 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3861 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
3862 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
3864 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3865 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost, this);
3871 _WebImpl::RemoveEventListenerCallback(void) const
3873 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3876 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3877 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3879 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3880 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3882 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3883 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3885 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3886 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3887 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3888 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3889 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3890 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3891 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3892 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3893 evas_object_smart_callback_del(pWebNativeNode, "load,committed", OnLoadingCommitted);
3895 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3897 evas_object_smart_callback_del_full(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3898 evas_object_smart_callback_del_full(pWinObject, "focus,out", OnWindowObjectFocusLost, this);
3900 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3901 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3902 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3904 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3905 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3907 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3909 ewk_view_javascript_alert_callback_set(pWebNativeNode, null, null);
3910 ewk_view_javascript_prompt_callback_set(pWebNativeNode, null, null);
3911 ewk_view_javascript_confirm_callback_set(pWebNativeNode, null, null);
3912 ewk_view_before_unload_confirm_panel_callback_set(pWebNativeNode, null, null);
3914 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3916 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3917 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3918 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3920 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3921 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3922 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3923 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3924 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3925 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3927 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3928 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3929 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3931 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3933 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3934 evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
3936 evas_object_smart_callback_del(pWebNativeNode, "magnifier,hide", OnWebPageBlockSelected);
3938 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
3939 evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
3941 evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
3942 evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
3944 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3945 SysAssertf(pContext, "Failed to get webkit instance.");
3946 ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
3948 ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
3949 ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
3950 ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
3951 ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
3953 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3954 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_OUT, OnWebNativeNodeFocusLost);
3960 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3962 return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
3967 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
3969 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
3975 Ewk_View_Smart_Data* pSmartData = reinterpret_cast< Ewk_View_Smart_Data* >(evas_object_smart_data_get(pWebview));
3976 SysAssertf(pSmartData && pSmartData->api, "Failed to get webkit instance.");
3977 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
3979 Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3982 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3984 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
3985 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
3987 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
3989 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
3990 char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable"));
3991 if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue)
3993 ewk_view_command_execute(pWebview, "SelectWord", null);
3994 evas_object_smart_callback_call(pWebview, "magnifier,hide", NULL);
3998 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
4005 _WebImpl::ReleaseBlock(void)
4007 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4013 ewk_view_text_selection_range_clear(pWebview);
4018 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
4020 FloatPoint tempStartPoint;
4021 FloatPoint tempEndPoint;
4023 GetBlockRange(tempStartPoint, tempEndPoint);
4025 startPoint = _CoordinateSystemUtils::ConvertToInteger(tempStartPoint);
4026 endPoint = _CoordinateSystemUtils::ConvertToInteger(tempEndPoint);
4031 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
4033 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4036 startPoint.x = startPoint.y = endPoint.x = endPoint.y = 0.0f;
4040 Eina_Rectangle leftHandle;
4041 Eina_Rectangle rightHandle;
4043 EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
4044 EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
4046 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
4048 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
4049 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
4050 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
4051 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
4053 if ((endPoint.x != 0.0f) && (endPoint.y != 0.0f))
4055 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
4056 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
4062 _WebImpl::GetFaviconN(void) const
4064 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4070 result r = E_SUCCESS;
4072 Ewk_Context* pContext = ewk_view_context_get(pWebview);
4073 const char* pUrl = ewk_view_url_get(pWebview);
4074 Evas* pEvas = evas_object_evas_get(pWebview);
4076 Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
4082 Tizen::Graphics::BufferInfo bufferInfo;
4084 r = _Utility::GetPixelBufferFromEvasObject(pFavicon, bufferInfo);
4085 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4087 const Dimension dimension(bufferInfo.width, bufferInfo.height);
4088 Tizen::Base::ByteBuffer byteBuffer;
4090 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
4091 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4093 std::unique_ptr<Bitmap> pImage(new (std::nothrow) Bitmap());
4094 SysTryReturn(NID_WEB_CTRL, pImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
4096 r = pImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
4097 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
4099 return pImage.release();
4105 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
4107 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4113 ewk_view_scroll_by(pWebview, diff.x, diff.y);
4118 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
4120 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4126 ewk_view_scroll_set(pWebview, dest.x, dest.y);
4131 _WebImpl::GetScrollPosition(void) const
4133 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4141 ewk_view_scroll_pos_get(pWebview, &position.x, &position.y);
4148 _WebImpl::GetPageSize(void) const
4150 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4153 return Dimension(0, 0);
4156 Evas_Coord width = 0;
4157 Evas_Coord height = 0;
4159 ewk_view_contents_size_get(pWebview, &width, &height);
4161 Dimension size(static_cast< int >(width), static_cast< int >(height));
4168 _WebImpl::SetLoadingErrorOccurred(bool arg)
4170 __isLoadingErrorOccurred = arg;
4175 _WebImpl::IsLoadingErrorOccurred(void) const
4177 return __isLoadingErrorOccurred;
4182 _WebImpl::SetRedirectRequested(bool arg)
4184 __isRedirectRequested = arg;
4189 _WebImpl::IsRedirectRequested(void) const
4191 return __isRedirectRequested;
4196 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
4203 _WebImpl::GetPolicyDecision(void) const
4210 _WebImpl::SetCertificateRequested(bool arg)
4212 __isCertificateRequested = arg;
4217 _WebImpl::IsCertificateRequested(void) const
4219 return __isCertificateRequested;
4224 _WebImpl::SetCertificateConfirmed(bool arg)
4226 __isCertificateConfirmed = arg;
4231 _WebImpl::IsCertificateConfirmed(void) const
4233 return __isCertificateConfirmed;
4238 _WebImpl::SetFullScreenKeypad(void)
4240 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4246 result r = E_SUCCESS;
4248 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
4249 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4251 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
4252 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4254 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pWebCore->GetTouchPosition())));
4256 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
4257 SysTryReturnResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "Failed to get hit test.");
4259 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
4260 if (tagName.Equals(L"INPUT", false))
4262 String text(ewk_view_focused_input_element_value_get(pWebview));
4263 pKeypad->SetText(text);
4267 String* pText = EvaluateJavascriptN(L"document.activeElement.value");
4268 SysTryReturnResult(NID_WEB_CTRL, pText, E_OUT_OF_MEMORY, "Memory allocation failed.");
4269 pKeypad->SetText(*pText);
4272 r = pKeypad->SetShowState(true);
4273 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4275 r = pKeypad->Show();
4276 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4278 pKeypad->AddTextEventListener(*this);
4280 __pKeypad = std::move(pKeypad);
4287 _WebImpl::RemoveFullScreenKeypad(void)
4289 __pKeypad->RemoveTextEventListener(*this);
4296 _WebImpl::IsFooterVisible(void) const
4298 return __isFooterVisible;
4303 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
4305 __isFooterVisible = isFooterVisible;
4310 _WebImpl::IsKeypadVisible(void) const
4312 return __isKeypadVisible;
4317 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
4319 __isKeypadVisible = isKeypadVisible;
4324 _WebImpl::IsKeypadOpened(void) const
4326 return __isKeypadOpened;
4330 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
4332 __isKeypadOpened = isKeypadOpened;
4337 _WebImpl::IsWinFocusLost(void) const
4339 return __isWinFocusLost;
4344 _WebImpl::SetWinFocusLost(bool isWinFocusLost)
4346 __isWinFocusLost = isWinFocusLost;
4351 _WebImpl::GetPreviousKeypadBounds(void) const
4353 return __keypadBounds;
4358 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
4360 __keypadBounds = bounds;
4365 _WebImpl::OnTextValueChangeCanceled(const Control& source)
4367 RemoveFullScreenKeypad();
4372 _WebImpl::OnTextValueChanged(const Control& source)
4374 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
4380 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
4381 SysTryReturnVoidResult(NID_WEB_CTRL, pText.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
4383 Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pWebCore->GetTouchPosition())));
4385 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
4386 SysTryReturnVoidResult(NID_WEB_CTRL, pEwkHitTest, E_SYSTEM, "[E_SYSTEM] Failed to get hit test.");
4388 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
4389 if (tagName.Equals(L"INPUT", false))
4391 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
4395 ewk_view_command_execute(pWebview, "SelectAll", null);
4396 ewk_view_command_execute(pWebview, "Delete", null);
4397 ewk_view_command_execute(pWebview, "InsertText", pText.get());
4400 RemoveFullScreenKeypad();
4405 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
4407 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
4408 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
4410 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
4411 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4413 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
4414 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
4416 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
4423 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
4425 result r = E_SUCCESS;
4427 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
4428 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4430 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4432 ILoadingListener* pLoadingListner = GetLoadingListener();
4433 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
4435 switch (pEventArg->GetEventType())
4437 case WEB_EVENT_LOADINGLISTENER_STARTED:
4439 pLoadingListner->OnLoadingStarted();
4443 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
4445 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
4446 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4448 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
4452 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
4454 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
4455 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4457 pLoadingListner->OnPageTitleReceived(*pPageTitle);
4461 case WEB_EVENT_LOADINGLISTENER_CANCELED:
4463 pLoadingListner->OnLoadingCanceled();
4467 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
4469 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
4470 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4472 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
4473 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4475 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
4477 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
4481 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
4483 pLoadingListner->OnLoadingCompleted();
4487 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
4489 pLoadingListner->OnHttpAuthenticationCanceled();
4493 case WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED:
4495 std::unique_ptr<Bitmap> pFavicon(GetFaviconN());
4496 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4500 pLoadingListner->OnFaviconReceived(*pFavicon.get());
4516 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
4518 result r = E_SUCCESS;
4520 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
4521 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4523 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4525 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
4526 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
4528 switch (pEventArg->GetEventType())
4530 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
4532 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
4533 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4535 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
4539 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
4541 pWebDownloadListener->OnWebDataDownloadCompleted();
4545 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
4547 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
4548 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4550 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
4552 pWebDownloadListener->OnWebDownloadFailed(errorType);
4567 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
4569 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4570 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4572 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4574 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4576 switch (pEventArg->GetEventType())
4578 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
4580 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4582 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4583 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4585 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4586 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4588 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4592 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
4594 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4596 __pUserUiListener->OnWebPageShowRequested(*pWeb);
4600 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
4602 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4604 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
4608 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
4610 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4612 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4613 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4615 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4630 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
4632 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
4633 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4635 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4637 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
4639 switch (pEventArg->GetEventType())
4641 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
4643 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4645 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
4646 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4648 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
4649 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4651 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
4655 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
4657 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4659 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
4663 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
4665 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4667 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
4671 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
4673 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
4675 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
4676 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4678 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
4693 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
4695 result r = E_SUCCESS;
4697 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
4698 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
4700 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
4702 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
4703 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
4705 switch (pEventArg->GetEventType())
4707 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4709 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4710 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4712 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4713 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4715 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4730 _WebImpl::VibrationRequested(uint64_t duration)
4732 result r = E_SUCCESS;
4734 __pVibrator.reset();
4736 std::unique_ptr<Vibrator> pVibrator(new (std::nothrow) Vibrator());
4737 SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4739 r = pVibrator->Construct();
4740 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4742 __pVibrator = std::move(pVibrator);
4744 IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
4746 r = __pVibrator->Start(&pattern, 1);
4747 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4754 _WebImpl::VibrationCanceled(void)
4756 __pVibrator.reset();
4761 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4763 result r = E_SUCCESS;
4765 String host(ewk_auth_challenge_url_get(pChallenge));
4766 String realm(ewk_auth_challenge_realm_get(pChallenge));
4768 __pAuthChallenge.reset();
4770 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4771 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4773 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4774 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4776 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4777 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4779 __pAuthChallenge = std::move(pAuthChallenge);
4781 ewk_auth_challenge_suspend(pChallenge);
4782 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4784 __pAuthChallenge.release();
4788 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4789 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4797 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4799 result r = E_SUCCESS;
4801 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4802 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4804 r = pAuthPopup->Construct(host, realm, pAuthChallenge);
4805 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4807 __pAuthPopup.reset();
4808 __pAuthPopup = std::move(pAuthPopup);
4810 r = __pAuthPopup->ShowPopup();
4811 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4818 _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk_Certificate_Policy_Decision* pPolicy)
4820 result r = E_SUCCESS;
4822 std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
4823 SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4825 r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
4826 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4828 __pCertConfirmPopup = std::move(pCertConfirmPopup);
4830 int modalResult = 0;
4832 r = __pCertConfirmPopup->ShowAndWait(modalResult);
4833 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4835 if (__pCertConfirmPopup.get() && userConfirmMode == CERTIFICATE_POPUP_MODE_USER_CONFIRM)
4837 __isCertificateConfirmed = __pCertConfirmPopup->GetConfirmResult();
4841 if (__pCertConfirmPopup.get())
4843 __pCertConfirmPopup.reset();
4851 _WebImpl::ShowPromptPopup(String msg, String defVal)
4853 result r = E_SUCCESS;
4855 std::unique_ptr< _PromptPopup > pPromptPopup(new (std::nothrow) _PromptPopup());
4856 SysTryReturnResult(NID_WEB_CTRL, pPromptPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4858 r = pPromptPopup->Construct(msg, defVal, __pWebCore->GetWebNativeNode(), this);
4859 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4861 __pPromptPopup = std::move(pPromptPopup);
4863 r = __pPromptPopup->ShowPopup();
4864 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4869 __pPromptPopup.reset();
4877 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4879 result r = E_SUCCESS;
4881 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4882 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4884 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, true, msg);
4885 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4887 int modalResult = 0;
4889 switch(userConfirmMode)
4891 case USER_CONTENT_HANDLER:
4893 __pContentHandlerConfirmPopup = std::move(pUserConfirmPopup);
4895 r = __pContentHandlerConfirmPopup->ShowAndWait(modalResult);
4896 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pContentHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4898 __pContentHandlerConfirmPopup.reset();
4900 ewk_view_resume(__pWebCore->GetWebNativeNode());
4904 case USER_PROTOCOL_HANDLER:
4906 __pProtocolHandlerConfirmPopup = std::move(pUserConfirmPopup);
4908 r = __pProtocolHandlerConfirmPopup->ShowAndWait(modalResult);
4909 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pProtocolHandlerConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4911 __pProtocolHandlerConfirmPopup.reset();
4913 ewk_view_resume(__pWebCore->GetWebNativeNode());
4917 case USER_CONFIRM_APP_CACHE:
4919 __pAppCacheConfirmPopup = std::move(pUserConfirmPopup);
4921 r = __pAppCacheConfirmPopup->ShowAndWait(modalResult);
4922 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pAppCacheConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4924 __pAppCacheConfirmPopup.reset();
4926 ewk_view_resume(__pWebCore->GetWebNativeNode());
4930 case USER_CONFIRM_DB_QUOTA_EXCEDED:
4932 __pDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4934 r = __pDbQuotaConfirmPopup->ShowAndWait(modalResult);
4935 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4937 __pDbQuotaConfirmPopup.reset();
4939 ewk_view_resume(__pWebCore->GetWebNativeNode());
4943 case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
4945 __pLocalFsQuotaConfirmPopup = std::move(pUserConfirmPopup);
4947 r = __pLocalFsQuotaConfirmPopup->ShowAndWait(modalResult);
4948 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pLocalFsQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4950 __pLocalFsQuotaConfirmPopup.reset();
4952 ewk_view_resume(__pWebCore->GetWebNativeNode());
4956 case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
4958 __pIndexedDbQuotaConfirmPopup = std::move(pUserConfirmPopup);
4960 r = __pIndexedDbQuotaConfirmPopup->ShowAndWait(modalResult);
4961 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pIndexedDbQuotaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
4963 __pIndexedDbQuotaConfirmPopup.reset();
4965 ewk_view_resume(__pWebCore->GetWebNativeNode());
4978 _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
4980 result r = E_SUCCESS;
4982 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4983 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4985 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, this, false, msg);
4986 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4988 switch(userConfirmMode)
4990 case USER_CONFIRM_USERMEDIA:
4992 __pUserMediaConfirmPopup.reset();
4994 __pUserMediaConfirmPopup = std::move(pUserConfirmPopup);
4996 r = __pUserMediaConfirmPopup->ShowPopup();
4997 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pUserMediaConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5001 case USER_CONFIRM_GEOLOCATION:
5003 __pGeolocationConfirmPopup.reset();
5005 __pGeolocationConfirmPopup = std::move(pUserConfirmPopup);
5007 r = __pGeolocationConfirmPopup->ShowPopup();
5008 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pGeolocationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5012 case USER_CONFIRM_NOTIFICATION:
5014 __pNotificationConfirmPopup.reset();
5016 __pNotificationConfirmPopup = std::move(pUserConfirmPopup);
5018 r = __pNotificationConfirmPopup->ShowPopup();
5019 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pNotificationConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5023 case USER_SCRIPT_ALERT:
5025 __pScriptAlertConfirmPopup.reset();
5027 __pScriptAlertConfirmPopup = std::move(pUserConfirmPopup);
5029 r = __pScriptAlertConfirmPopup->ShowPopup();
5030 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptAlertConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5034 case USER_SCRIPT_CONFIRM:
5036 __pScriptConfirmPopup.reset();
5038 __pScriptConfirmPopup = std::move(pUserConfirmPopup);
5040 r = __pScriptConfirmPopup->ShowPopup();
5041 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pScriptConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5045 case USER_BEFORE_UNLOAD_CONFIRM:
5047 __pBeforeUnloadConfirmPopup.reset();
5049 __pBeforeUnloadConfirmPopup = std::move(pUserConfirmPopup);
5051 r = __pBeforeUnloadConfirmPopup->ShowPopup();
5052 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, __pBeforeUnloadConfirmPopup.reset(), r, "[%s] Propagating.", GetErrorMessage(r));
5068 _WebImpl::GetParentFormImpl(_ControlImpl* pControlImpl)
5071 _FormImpl* pFormImpl = null;
5073 _ControlImpl* pParentControlImpl = dynamic_cast< _ControlImpl* >(pControlImpl->GetParent());
5074 if (!pParentControlImpl)
5079 pFormImpl = dynamic_cast< _FormImpl* >(pParentControlImpl);
5085 return GetParentFormImpl(pParentControlImpl);
5090 _WebImpl::OnFocusGained(const _ControlImpl& source)
5097 _WebImpl::OnFocusLost(const _ControlImpl& source)
5099 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5105 if(IsKeypadVisible() == true)
5107 SetKeypadOpened(true);
5115 _WebImpl::HasValidNativeNode(void) const
5117 if (__pWebCore && __pWebCore->GetWebNativeNode())
5127 _WebImpl::OnPreAttachedToMainTree(void)
5129 result r = E_SUCCESS;
5131 r = _ContainerImpl::OnPreAttachedToMainTree();
5132 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5134 if (!HasValidNativeNode())
5136 r = __pWebCore->InitializeWebNativeNode();
5137 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5139 _ControlManager* pControlManager = _ControlManager::GetInstance();
5140 SysTryReturnResult(NID_WEB_CTRL, pControlManager, E_SYSTEM, "Failed to get the _ControlManager instance.");
5141 OnChangeLayout(pControlManager->GetScreenRotation());
5143 r = InitializeSetting();
5144 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5146 _SettingInfoImpl::AddSettingEventListener(*this);
5148 _WebManager* pWebManager = _WebManager::GetInstance();
5149 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5150 pWebManager->AddWeb(reinterpret_cast< int >(this));
5153 if (IsVisible() == true)
5155 _WebManager* pWebManager = _WebManager::GetInstance();
5156 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5157 pWebManager->SetActiveWeb(this);
5165 _WebImpl::OnDetachingFromMainTree(void)
5167 result r = E_SUCCESS;
5169 r = _ContainerImpl::OnDetachingFromMainTree();
5170 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5172 _WebManager* pWebManager = _WebManager::GetInstance();
5173 SysTryReturnResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "Failed to get the _WebManager instance.");
5174 pWebManager->RemoveActiveWeb(this);
5181 _WebImpl::OnSettingChanged(String& key)
5183 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5189 if (key == L"http://tizen.org/setting/font.type")
5191 ewk_view_use_settings_font(pWebview);
5197 _WebImpl::OnChangeLayout(_ControlRotation rotation)
5199 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5209 case _CONTROL_ROTATION_0:
5212 case _CONTROL_ROTATION_90:
5215 case _CONTROL_ROTATION_180:
5218 case _CONTROL_ROTATION_270:
5224 ewk_view_orientation_send(pWebview, degree);
5229 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
5231 _ContainerImpl::OnChangeLayout(orientation);
5233 if (__pColorPicker.get())
5235 __pColorPicker->ChangeLayout(orientation);
5238 HideFormDataWindow();
5240 std::unique_ptr< IEnumerator > pEnum(__webNotificationList.GetEnumeratorN());
5241 _WebNotification* pWebNotification = null;
5243 while (pEnum->MoveNext() == E_SUCCESS)
5245 pWebNotification = static_cast< _WebNotification* >(pEnum->GetCurrent());
5246 pWebNotification->OnChangeLayout();
5249 if (IsKeypadVisible())
5251 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
5252 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
5254 _FormImpl* pFormImpl = GetParentFormImpl(dynamic_cast< _ControlImpl* >(this));
5255 pFormImpl->DeflateClientRectHeight(pXformer->TransformVertical(GetPreviousKeypadBounds().height));
5261 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
5263 Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
5269 _WebManager* pWebManager = _WebManager::GetInstance();
5270 SysTryReturnVoidResult(NID_WEB_CTRL, pWebManager, E_SYSTEM, "[E_SYSTEM] Failed to get the _WebManager instance.");
5271 if (IsVisible() == true)
5273 pWebManager->SetActiveWeb(this);
5276 // ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, true);
5280 // ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
5285 pWebManager->RemoveActiveWeb(this);
5288 // ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, true);
5292 // ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
5299 _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
5301 _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
5305 case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
5306 __pCertConfirmPopup.reset();
5308 case ID_PROMPT_POPUP_CLOSE:
5309 __pPromptPopup.reset();
5311 case ID_USER_CONFIRM_USERMEDIA_CLOSE:
5312 __pUserMediaConfirmPopup.reset();
5314 case ID_USER_CONFIRM_GEOLOCATION_CLOSE:
5315 __pGeolocationConfirmPopup.reset();
5317 case ID_USER_CONFIRM_NOTIFICATION_CLOSE:
5318 __pNotificationConfirmPopup.reset();
5320 case ID_USER_SCRIPT_ALERT_CLOSE:
5321 __pScriptAlertConfirmPopup.reset();
5323 case ID_USER_SCRIPT_CONFIRM_CLOSE:
5324 __pScriptConfirmPopup.reset();
5327 case ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE:
5328 __pBeforeUnloadConfirmPopup.reset();
5331 case ID_USER_SCRIPT_SELECTBOX_CLOSE:
5332 __pSelectBox.reset();
5343 _WebImpl::GetDownloadHandler(void) const
5345 return __pWebDownloadHandler.get();
5350 _WebImpl::HideColorPicker(void)
5352 __pColorPicker.reset();
5361 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
5363 result r = E_SUCCESS;
5365 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
5366 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5368 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
5370 r = pColorHadler->Construct(colorVal, this);
5371 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5373 __pColorPicker = std::move(pColorHadler);
5375 int modalResult = 0;
5376 r = __pColorPicker->ShowAndWait(modalResult);
5377 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5381 color = __pColorPicker->GetColor();
5387 __pColorPicker.reset();
5396 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
5398 result r = E_SUCCESS;
5400 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
5401 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
5403 r = pInputPicker->Construct(String(inputValue), inputType, this);
5404 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5406 __pDatePicker = std::move(pInputPicker);
5408 int modalResult = 0;
5409 r = __pDatePicker->ShowAndWait(modalResult);
5410 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
5414 dateStr = __pDatePicker->GetDate();
5420 __pDatePicker.reset();
5429 _WebImpl::GetInstance(Web* pWeb)
5431 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5436 _WebImpl::GetInstance(const Web* pWeb)
5438 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
5443 _WebImpl::SearchHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5445 int checkReturn = 0;
5447 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5450 if( checkmime == true)
5452 table = CUSTOM_CONTENT_TABLE_NAME;
5456 table = CUSTOM_PROTOCOL_TABLE_NAME;
5459 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5460 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5461 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5463 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5465 result r = db.Construct(handlerPath, "r+", null);
5466 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5468 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"'"));
5469 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5473 r = pEnum->MoveNext();
5474 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5475 r = pEnum->GetIntAt(0, checkReturn);
5476 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));
5488 _WebImpl::UnregistrationHandler(Ewk_Custom_Handlers_Data* pHandlerData, bool checkmime)
5492 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5495 if( checkmime == true)
5497 table = CUSTOM_CONTENT_TABLE_NAME;
5501 table = CUSTOM_PROTOCOL_TABLE_NAME;
5504 String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
5505 String uri(ewk_custom_handlers_data_url_get(pHandlerData));
5506 String target(ewk_custom_handlers_data_target_get(pHandlerData));
5508 SysSecureLog(NID_WEB_CTRL, "BaseUrl : %s, Url : %s, mime : %s", baseUri.GetPointer(), uri.GetPointer(), target.GetPointer());
5510 result r = db.Construct(handlerPath, "r+", null);
5511 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5513 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"'"));
5514 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5518 r = pEnum->MoveNext();
5519 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5520 r = pEnum->GetIntAt(0, checkId);
5521 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5523 std::unique_ptr<DbStatement> pDeleteStmt(db.CreateStatementN(L"Delete From " + table + L" Where id = (?)"));
5524 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
5526 r = pDeleteStmt->BindInt(0, checkId);
5527 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5529 db.BeginTransaction();
5531 std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pDeleteStmt));
5533 db.CommitTransaction();
5540 const Tizen::Base::String
5541 _WebImpl::GetProtocolFromUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri)
5543 if (originUri == L"" || currentUri == L"")
5548 result r = E_SUCCESS;
5551 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5552 String originReplace(originUri);
5553 String table(CUSTOM_PROTOCOL_TABLE_NAME);
5557 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5558 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5560 r = currentUri.SubString(0, found + 1, baseUri);
5561 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5563 r = db.Construct(handlerPath, "r+", null);
5564 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5566 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select mime, url, allow From " + table + L" Where baseUrl = '" + baseUri + "'"));
5567 SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, L"", GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
5571 while (pEnum->MoveNext() == E_SUCCESS)
5576 String originScheme;
5578 r = pEnum->GetStringAt(0, protocol);
5579 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5581 r = pEnum->GetStringAt(1, queryUrl);
5582 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5584 r = pEnum->GetIntAt(2, allow);
5585 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5592 String protocolScheme(protocol + L":");
5594 r = originReplace.SubString(0, protocolScheme.GetLength(), originScheme);
5595 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5597 if ((originReplace.GetLength() >= protocolScheme.GetLength()) && originScheme.Equals(protocolScheme, false))
5599 if (queryUrl.IndexOf(L"%s", 0, foundQuery) == E_SUCCESS)
5601 r = originReplace.Replace(originScheme, "");
5602 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5604 queryUrl.Replace("%s", originReplace, 0);
5605 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5617 const Tizen::Base::String
5618 _WebImpl::GetRedirectUri(const Tizen::Base::String& originUri, const Tizen::Base::String& currentUri, const Tizen::Base::String& mime)
5620 if (originUri == L"" || currentUri == L"" || mime == L"")
5625 result r = E_SUCCESS;
5628 String originUrlStr = originUri;
5629 const String replaceStr = L"%s";
5631 String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
5632 String table(CUSTOM_CONTENT_TABLE_NAME);
5636 r = currentUri.LastIndexOf(L"/", currentUri.GetLength()-1, found);
5637 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5639 r = currentUri.SubString(0, found + 1, baseUri);
5640 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5642 r = db.Construct(handlerPath, "r+", null);
5643 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5645 std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select allow, url From " + table + L" Where baseUrl = '" + baseUri + "' AND mime = '" + mime + L"'"));
5649 r = pEnum->MoveNext();
5650 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5651 r = pEnum->GetIntAt(0, allow);
5652 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5653 r = pEnum->GetStringAt(1, contentUrl);
5654 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5662 if (contentUrl != L"")
5664 r = contentUrl.Replace(replaceStr, originUrlStr, 0);
5665 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, L"", r, "[%s] Propagating.", GetErrorMessage(r));
5677 _WebImpl::SetFormDataList(Eina_List* pFormDataList)
5679 __pFormDataList = pFormDataList;
5684 _WebImpl::IsFormDataWindowVisible(void) const
5686 return __isFormDataVisible;
5691 _WebImpl::ShowFormDataWindow(const Rectangle& windowRect, Evas_Object* pWebView)
5693 Rectangle rect(_CoordinateSystemUtils::InverseTransform(Rectangle(windowRect.x, windowRect.y + windowRect.height, windowRect.width, windowRect.height)));
5695 if (__isFormDataVisible)
5697 result r = __pFormDataWindow->UpdateList(__pFormDataList, rect);
5698 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5702 __pFormDataWindow.reset();
5704 std::unique_ptr<_FormDataWindow> pFormDataWindow( new (std::nothrow) _FormDataWindow());
5705 SysTryReturnResult(NID_WEB_CTRL, pFormDataWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
5707 result r = pFormDataWindow->Construct(rect, this, pWebView);
5708 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5710 r = pFormDataWindow->UpdateList(__pFormDataList, rect);
5711 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5713 r = pFormDataWindow->LaunchFormDataWindow();
5714 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
5716 __pFormDataWindow = std::move(pFormDataWindow);
5717 __isFormDataVisible = true;
5725 _WebImpl::HideFormDataWindow(bool delWindow)
5729 __pFormDataWindow.reset();
5732 __isFormDataVisible = false;
5737 _WebImpl::ClearWebNotification(_WebNotification* pWebNotification)
5739 __webNotificationList.Remove(*pWebNotification);
5744 _WebImpl::SetWebNotification(_WebNotification* pWebNotification)
5746 __webNotificationList.Add(pWebNotification);
5750 }}} // Tizen::Web::Controls