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 <FCntDownloadRequest.h>
41 #include <FGrpColor.h>
42 #include <FGrpPoint.h>
43 #include <FGrpRectangle.h>
44 #include <FIoDbEnumerator.h>
45 #include <FIoDbStatement.h>
47 #include <FMediaImage.h>
48 #include <FMediaImageTypes.h>
49 #include <FNetHttpHttpHeader.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 <FCnt_DownloadManagerImpl.h>
73 #include <FGrp_CoordinateSystem.h>
74 #include <FIo_DatabaseImpl.h>
75 #include <FIo_NormalFile.h>
76 #include <FUi_Control.h>
77 #include <FUi_CoordinateSystemUtils.h>
78 #include <FUi_EcoreEvasMgr.h>
79 #include <FUi_EcoreEvas.h>
80 #include <FUi_ResourceSizeInfo.h>
81 #include <FUi_Window.h>
82 #include <FUiAnim_EflNode.h>
83 #include <FUiAnim_VisualElement.h>
84 #include <FUiCtrl_FooterImpl.h>
85 #include <FUiCtrl_Form.h>
86 #include "FWeb_HistoryItemImpl.h"
87 #include "FWebCtrl_AppControlListener.h"
88 #include "FWebCtrl_AuthConfirmPopup.h"
89 #include "FWebCtrl_AuthenticationChallengeImpl.h"
90 #include "FWebCtrl_EflWebkit.h"
91 #include "FWebCtrl_GeolocationConfirmPopup.h"
92 #include "FWebCtrl_GeolocationPermissionManagerImpl.h"
93 #include "FWebCtrl_HitElementResultImpl.h"
94 #include "FWebCtrl_InputPickerPopup.h"
95 #include "FWebCtrl_PageNavigationListImpl.h"
96 #include "FWebCtrl_PromptPopup.h"
97 #include "FWebCtrl_SelectBox.h"
98 #include "FWebCtrl_Utility.h"
99 #include "FWebCtrl_Web.h"
100 #include "FWebCtrl_WebDataHandler.h"
101 #include "FWebCtrl_WebEvent.h"
102 #include "FWebCtrl_WebEventArg.h"
103 #include "FWebCtrl_WebImpl.h"
104 #include "FWebCtrl_WebPresenter.h"
105 #include "FWebCtrl_WebSettingImpl.h"
108 using namespace Tizen::App;
109 using namespace Tizen::Base;
110 using namespace Tizen::Base::Collection;
111 using namespace Tizen::Base::Runtime;
112 using namespace Tizen::Base::Utility;
113 using namespace Tizen::Content;
114 using namespace Tizen::Graphics;
115 using namespace Tizen::Io;
116 using namespace Tizen::Media;
117 using namespace Tizen::Net::Http;
118 using namespace Tizen::Ui;
119 using namespace Tizen::Ui::Animations;
120 using namespace Tizen::Ui::Controls;
121 using namespace Tizen::Web::Json;
124 namespace Tizen { namespace Web { namespace Controls
128 static const char WEB_CTRL[] = "webcontrol";
129 static const char PARENT_WEB_CTRL[] = "parentwebcontrol";
132 static const float MIN_ZOOM_LEVEL = 0.3;
133 static const float MAX_ZOOM_LEVEL = 2;
136 static const int REDIRECTION_HEADER_GROUP = 300;
139 static const int MAX_TEXT_MATCH = pow(2, 31) - 1;
142 static const int PORTRAIT_KEYPAD_HEIGHT = 444;
143 static const int LANDSCAPE_KEYPAD_HEIGHT = 316;
147 AddHttpHeaderData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
149 result r = E_SUCCESS;
151 String key(reinterpret_cast< const char* >(pKey));
152 String value(reinterpret_cast< char* >(pValue));
154 SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", key.GetPointer(), value.GetPointer());
156 r = reinterpret_cast< HttpHeader* >(pUserData)->AddField(key, value);
157 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
164 AddHttpAttributeData(const Eina_Hash* pHash, const void* pKey, void* pValue, void* pUserData)
166 result r = E_SUCCESS;
168 std::unique_ptr<String> pAttrKey(new (std::nothrow) String(reinterpret_cast< char* >(const_cast< void* >(pKey))));
169 std::unique_ptr<String> pAttrValue(new (std::nothrow) String(reinterpret_cast< char* >(pValue)));
170 SysTryReturn(NID_WEB_CTRL, pAttrKey.get() && pAttrValue.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
172 SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
174 r = reinterpret_cast< HashMap* >(pUserData)->Add(*pAttrKey, *pAttrValue);
175 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
177 pAttrValue.release();
184 FreeCharArray(void* pData)
186 delete[] reinterpret_cast<char*>(pData);
191 ConvertErrorCode(int error)
193 LoadingErrorType errorCode = WEB_ERROR_UNKNOWN;
197 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
199 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE:
201 case EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE_PROXY:
203 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT:
205 case EWK_ERROR_NETWORK_STATUS_CANT_CONNECT_PROXY:
207 case EWK_ERROR_NETWORK_STATUS_IO_ERROR:
209 case EWK_ERROR_NETWORK_STATUS_MALFORMED:
211 case EWK_ERROR_NETWORK_STATUS_TRY_AGAIN:
213 case EWK_ERROR_NETWORK_STATUS_TOO_MANY_REDIRECTS:
215 case EWK_ERROR_NETWORK_STATUS_TLS_FAILED:
217 case EWK_ERROR_NETWORK_STATUS_INTERNAL_SERVER_ERROR:
219 case EWK_ERROR_NETWORK_STATUS_BAD_GATEWAY:
221 case EWK_ERROR_NETWORK_STATUS_SERVICE_UNAVAILABLE:
223 case EWK_ERROR_NETWORK_STATUS_GATEWAY_TIMEOUT:
224 errorCode = WEB_NO_CONNECTION;
227 case EWK_ERROR_NETWORK_STATUS_BAD_REQUEST:
229 case EWK_ERROR_NETWORK_STATUS_REQUEST_URI_TOO_LONG:
230 errorCode = WEB_BAD_URL;
233 case EWK_ERROR_NETWORK_STATUS_FORBIDDEN:
234 errorCode = WEB_FILE_ACCESS_FAILED;
237 case EWK_ERROR_NETWORK_STATUS_REQUEST_TIMEOUT:
238 errorCode = WEB_REQUEST_TIMEOUT;
241 case EWK_ERROR_NETWORK_STATUS_UNSUPPORTED_MEDIA_TYPE:
242 errorCode = WEB_MIME_NOT_SUPPORTED;
245 case EWK_ERROR_NETWORK_STATUS_INSUFFICIENT_STORAGE:
246 errorCode = WEB_OUT_OF_MEMORY;
249 case EWK_ERROR_NETWORK_STATUS_REQUEST_ENTITY_TOO_LARGE:
250 errorCode = WEB_REQUEST_MAX_EXCEEDED;
253 case EWK_ERROR_NETWORK_STATUS_CONTINUE:
255 case EWK_ERROR_NETWORK_STATUS_SWITCHING_PROTOCOLS:
257 case EWK_ERROR_NETWORK_STATUS_PROCESSING:
259 case EWK_ERROR_NETWORK_STATUS_OK:
261 case EWK_ERROR_NETWORK_STATUS_CREATED:
263 case EWK_ERROR_NETWORK_STATUS_ACCEPTED:
265 case EWK_ERROR_NETWORK_STATUS_NON_AUTHORITATIVE:
267 case EWK_ERROR_NETWORK_STATUS_NO_CONTENT:
269 case EWK_ERROR_NETWORK_STATUS_RESET_CONTENT:
271 case EWK_ERROR_NETWORK_STATUS_PARTIAL_CONTENT:
273 case EWK_ERROR_NETWORK_STATUS_MULTI_STATUS:
275 case EWK_ERROR_NETWORK_STATUS_MULTIPLE_CHOICES:
277 case EWK_ERROR_NETWORK_STATUS_MOVED_PERMANENTLY:
279 case EWK_ERROR_NETWORK_STATUS_FOUND:
281 case EWK_ERROR_NETWORK_STATUS_SEE_OTHER:
283 case EWK_ERROR_NETWORK_STATUS_NOT_MODIFIED:
285 case EWK_ERROR_NETWORK_STATUS_USE_PROXY:
287 case EWK_ERROR_NETWORK_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL:
289 case EWK_ERROR_NETWORK_STATUS_TEMPORARY_REDIRECT:
290 errorCode = WEB_HTTP_RESPONSE;
293 case EWK_ERROR_NETWORK_STATUS_SSL_FAILED:
294 errorCode = WEB_INVALID_CERTIFICATE;
298 errorCode = WEB_ERROR_UNKNOWN;
307 FireLoadingErrorOccurredEvent(_WebImpl* pImpl, int code, const char* pDescription)
309 result r = E_SUCCESS;
311 std::unique_ptr<Integer> pErrorCode(new (std::nothrow) Integer(code));
312 std::unique_ptr<String> pErrorDescription(new (std::nothrow) String(pDescription));
313 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED));
314 SysTryReturnResult(NID_WEB_CTRL, pErrorCode.get() && pErrorDescription.get() && pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
316 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_TYPE, *pErrorCode.get());
317 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
318 pErrorCode.release();
320 r = pEventArg->SetEventInfo(_LoadingEventArg::ERROR_MESSAGE, *pErrorDescription.get());
321 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
322 pErrorDescription.release();
324 r = pImpl->GetWebEvent()->FireAsync(*pEventArg);
325 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
333 OnScriptAlertRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
335 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
337 result r = E_SUCCESS;
339 String msg(pMessage);
341 MessageBox messageBox;
342 r = messageBox.Construct(L"", msg, MSGBOX_STYLE_OK);
343 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
346 r = messageBox.ShowAndWait(modalResult);
347 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
349 ewk_view_javascript_alert_reply(pView);
356 OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserData)
358 SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
360 result r = E_SUCCESS;
362 String msg(pMessage);
364 MessageBox messageBox;
365 r = messageBox.Construct(L"", msg, MSGBOX_STYLE_OKCANCEL);
366 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
369 r = messageBox.ShowAndWait(modalResult);
370 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
372 if (modalResult == MSGBOX_RESULT_OK)
374 ewk_view_javascript_confirm_reply(pView, EINA_TRUE);
378 ewk_view_javascript_confirm_reply(pView, EINA_FALSE);
386 OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pDefaultValue, void* pUserData)
388 SysLog(NID_WEB_CTRL, "The current value of message is %s, defaulValue is %s", pMessage, pDefaultValue);
390 result r = E_SUCCESS;
392 String msg(pMessage);
393 String defVal(pDefaultValue);
395 int modalResult = -1;
396 Eina_Bool returnValue = EINA_TRUE;
397 _PromptPopup pPromptPopup;
399 r = pPromptPopup.Construct(msg, defVal);
400 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, returnValue = EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
402 r = pPromptPopup.ShowAndWait(modalResult);
403 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, returnValue = EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
405 if (modalResult == ID_BUTTON_PROMPT_OK)
407 std::unique_ptr<char[]> pResult(_StringConverter::CopyToCharArrayN(pPromptPopup.GetPromptText()));
408 SysTryCatch(NID_WEB_CTRL, pResult.get(), returnValue = EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
410 ewk_view_javascript_prompt_reply(pView, pResult.get());
415 ewk_view_javascript_prompt_reply(pView, null);
421 OnCertificateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
423 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
424 Ewk_Certificate_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Certificate_Policy_Decision* >(pEventInfo);
425 SysAssertf(pImpl && pPolicy, "Failed to request");
427 ewk_certificate_policy_decision_suspend(pPolicy);
429 switch (pImpl->GetSetting().GetCertificateErrorHandlingMode())
431 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM:
433 result r = E_SUCCESS;
435 r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_CERTIFICATE, pEventInfo);
436 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
439 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CANCEL:
441 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_FALSE);
443 case WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE :
444 ewk_certificate_policy_decision_allowed_set(pPolicy, EINA_TRUE);
453 OnHttpAuthenticationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
455 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
456 Ewk_Auth_Challenge* pChallenge = reinterpret_cast< Ewk_Auth_Challenge* >(pEventInfo);
457 SysAssertf(pImpl && pChallenge, "Failed to request");
459 result r = E_SUCCESS;
461 r = pImpl->HttpAuthenticationRequested(pChallenge);
462 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
466 ewk_auth_challenge_credential_cancel(pChallenge);
467 evas_object_smart_callback_call(pView, "authentication,canceled", NULL);
472 OnHttpAuthenticationCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
474 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
475 SysAssertf(pImpl , "Failed to request");
477 if (pImpl->GetLoadingListener())
479 result r = E_SUCCESS;
481 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED));
482 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
484 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
485 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
492 OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
494 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
495 Ewk_Geolocation_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(pEventInfo);
496 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
498 if (pImpl->GetSetting().IsGeolocationEnabled())
500 result r = E_SUCCESS;
502 std::unique_ptr<DbEnumerator> pEnum;
504 String geolocationPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
505 String table(GEOLOCATION_TABLE_NAME);
508 const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pPermissionRequest);
509 String origin = _Utility::CreateOrigin(pSecurityOrigin);
511 r = db.Construct(geolocationPath, "r", null);
512 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
514 pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select permission From " + table + L" Where origin = '" + origin + L"'"));
517 r = pEnum->MoveNext();
518 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
521 r = pEnum->GetIntAt(0, permission);
522 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
524 SysLog(NID_WEB_CTRL, "The current value of permission is %d", permission);
526 ewk_geolocation_permission_request_set(pPermissionRequest, static_cast < Eina_Bool >(permission));
530 ewk_geolocation_permission_request_suspend(pPermissionRequest);
532 r = pImpl->ShowGeolocationPopup(pPermissionRequest);
533 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
540 ewk_geolocation_permission_request_set(pPermissionRequest, EINA_FALSE);
545 OnGetUserMediaPermissionRequsted(void* pUserData, Evas_Object* pView, void* pEventInfo)
547 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
548 Ewk_User_Media_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_User_Media_Permission_Request* >(pEventInfo);
549 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
551 result r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_USERMEDIA, pEventInfo);
552 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
556 ewk_user_media_permission_request_set(pPermissionRequest, EINA_FALSE);
561 OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
563 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
564 Ewk_Notification_Permission_Request* pPermissionRequest = reinterpret_cast< Ewk_Notification_Permission_Request* >(pEventInfo);
565 SysAssertf(pImpl && pPermissionRequest, "Failed to request");
567 SysLog(NID_WEB_CTRL, "The permission popup has not Implemented yet. allow is the default value now.");
569 //ToDo : Show NotificationPermissionPopup
571 Ewk_Context* pContext = ewk_view_context_get(pView);
572 SysAssertf(pContext, "Failed to get webkit instance.");
574 //ewk_notification_permission_request_origin_get(pPermissionRequest);
576 ewk_notification_permission_request_set(pPermissionRequest, EINA_TRUE);
581 OnNotificationShow(void* pUserData, Evas_Object* pView, void* pEventInfo)
583 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
584 Ewk_Notification* pNotification = reinterpret_cast< Ewk_Notification* >(pEventInfo);
585 SysAssertf(pImpl && pNotification, "Failed to request");
587 Ewk_Context* pContext = ewk_view_context_get(pView);
588 SysAssertf(pContext, "Failed to get webkit instance.");
590 //ToDo : Show Notification
591 //Perform ewk_notification_clicked
592 //ewk_notification_security_origin_get(pNotification)
593 SysLog(NID_WEB_CTRL, "The current value of title is %s", ewk_notification_title_get(pNotification));
594 SysLog(NID_WEB_CTRL, "The current value of body is %s", ewk_notification_body_get(pNotification));
595 SysLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
597 uint64_t notificationId = ewk_notification_id_get(pNotification);
598 ewk_notification_showed(pContext, notificationId);
603 OnNotificationCancel(void* pUserData, Evas_Object* pView, void* pEventInfo)
605 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
606 uint64_t* pNotificationID = reinterpret_cast< uint64_t* >(pEventInfo);
607 SysAssertf(pImpl && pNotificationID, "Failed to request");
609 //ToDo : Where is ewk API for cancel operation?
614 OnProtocolHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
616 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
617 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
618 SysAssertf(pImpl && pHandlerData, "Failed to request");
620 ewk_custom_handlers_data_target_get(pHandlerData);
621 ewk_custom_handlers_data_base_url_get(pHandlerData);
622 ewk_custom_handlers_data_url_get(pHandlerData);
623 ewk_custom_handlers_data_title_get(pHandlerData);
628 OnIsProtocolHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
630 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
631 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
632 SysAssertf(pImpl && pHandlerData, "Failed to request");
634 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
639 OnProtocolHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
641 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
642 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
643 SysAssertf(pImpl && pHandlerData, "Failed to request");
648 OnContentHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
650 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
651 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
652 SysAssertf(pImpl && pHandlerData, "Failed to request");
657 OnIsContentHandlerRegistered(void* pUserData, Evas_Object* pView, void* pEventInfo)
659 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
660 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
661 SysAssertf(pImpl && pHandlerData, "Failed to request");
663 ewk_custom_handlers_data_result_set(pHandlerData, EWK_CUSTOM_HANDLERS_REGISTERED);
668 OnContentHandlerUnregistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
670 _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
671 Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(pEventInfo);
672 SysAssertf(pImpl && pHandlerData, "Failed to request");
677 OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
679 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
680 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
681 SysAssertf(pImpl && pPolicy, "Failed to request");
683 String url(ewk_policy_decision_url_get(pPolicy));
684 SysLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
686 if (url == L"about:blank")
688 ewk_policy_decision_use(pPolicy);
692 if (pImpl->GetLoadingListener() && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
693 && !pImpl->IsRedirectRequested())
695 if (pImpl->GetTextSearchListener())
697 pImpl->DisableAsyncSearch();
700 WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
701 Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
703 switch (ewkNavigationType)
705 case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
706 navigationType = WEB_NAVIGATION_LINK_CLICKED;
708 case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
709 navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
711 case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
712 navigationType = WEB_NAVIGATION_BACKFORWARD;
714 case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
715 navigationType = WEB_NAVIGATION_RELOAD;
717 case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
718 navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
720 case EWK_POLICY_NAVIGATION_TYPE_OTHER:
721 navigationType = WEB_NAVIGATION_OTHER;
727 if (pImpl->GetLoadingListener()->OnLoadingRequested(url, navigationType))
729 ewk_policy_decision_ignore(pPolicy);
738 String uriScheme(uri.GetScheme());
739 SysLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
741 if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file"))
743 ewk_policy_decision_ignore(pPolicy);
745 if (uriScheme == L"")
750 result r = E_SUCCESS;
752 _WebEventType eventType = WEB_EVENT_REQUEST_UNKNOWN;
754 if (uriScheme == L"rtsp")
756 eventType = WEB_EVENT_REQUEST_RTSP;
758 else if (uriScheme == L"mailto")
760 eventType = WEB_EVENT_REQUEST_EMAIL;
762 else if (uriScheme == L"tel")
764 eventType = WEB_EVENT_REQUEST_TEL;
766 else if (uriScheme == L"sms" || uriScheme == L"smsto" )
768 eventType = WEB_EVENT_REQUEST_SMS;
770 else if (uriScheme == L"mms" || uriScheme == L"mmsto" )
772 eventType = WEB_EVENT_REQUEST_MMS;
775 std::unique_ptr<_WebEventArg> pEventArg(new _WebEventArg(eventType, url));
776 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
778 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
779 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
785 ewk_policy_decision_use(pPolicy);
790 OnLoadingStarted(void* pUserData, Evas_Object* pView, void* pEventInfo)
792 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
793 SysAssertf(pImpl, "Failed to request");
795 if (pImpl->GetLoadingListener())
797 result r = E_SUCCESS;
799 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_STARTED));
800 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
802 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
803 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
810 OnPageTitleReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
812 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
813 char* pTitle = reinterpret_cast< char* >(pEventInfo);
814 SysAssertf(pImpl, "Failed to request");
816 SysLog(NID_WEB_CTRL, "The current value of title is %s", pTitle);
818 if (pImpl->GetLoadingListener())
820 result r = E_SUCCESS;
822 std::unique_ptr<String> pPageTitle(new (std::nothrow) String(pTitle));
823 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED));
824 SysTryReturnVoidResult(NID_WEB_CTRL, pPageTitle.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
826 r = pEventArg->SetEventInfo(_LoadingEventArg::PAGE_TITLE, *pPageTitle.get());
827 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
828 pPageTitle.release();
830 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
831 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
838 OnEstimatedProgress(void* pUserData, Evas_Object* pView, void* pEventInfo)
840 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
841 double* pProgress = reinterpret_cast< double* >(pEventInfo);
842 SysAssertf(pImpl, "Failed to request");
844 SysLog(NID_WEB_CTRL, "The current value of progress is %lf", *pProgress);
846 if (pImpl->GetLoadingListener())
848 result r = E_SUCCESS;
850 std::unique_ptr<Integer> pProgressPercentage(new (std::nothrow) Integer(static_cast< int >(*pProgress * 100)));
851 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_PROGRESS));
852 SysTryReturnVoidResult(NID_WEB_CTRL, pProgressPercentage.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
854 r = pEventArg->SetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS, *pProgressPercentage.get());
855 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
856 pProgressPercentage.release();
858 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
859 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
866 OnWebDataReceived(void* pUserData, Evas_Object* pView, void* pEventInfo)
868 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
869 Ewk_Policy_Decision* pPolicy = reinterpret_cast< Ewk_Policy_Decision* >(pEventInfo);
870 SysAssertf(pImpl && pPolicy, "Failed to request");
872 result r = E_SUCCESS;
874 const char* pUrl = ewk_policy_decision_url_get(pPolicy);
875 int code = ewk_policy_decision_response_status_code_get(pPolicy);
876 String mime(ewk_policy_decision_response_mime_get(pPolicy));
877 SysLog(NID_WEB_CTRL, "url : %s, mime : %ls, code : %d", pUrl, mime.GetPointer(), code);
879 ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
880 if (pLoadingListener && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
882 const Eina_Hash* pHeader = ewk_policy_decision_response_headers_get(pPolicy);
884 DecisionPolicy policy;
885 HttpHeader httpHeader;
887 if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
889 pImpl->SetRedirectRequested(true);
893 eina_hash_foreach(pHeader, AddHttpHeaderData, &httpHeader);
894 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
896 policy = pLoadingListener->OnWebDataReceived(mime, httpHeader);
897 pImpl->SetPolicyDecision(policy);
900 switch (pImpl->GetPolicyDecision())
902 case WEB_DECISION_CONTINUE:
904 if (pImpl->IsMimeSupported(mime) || mime == L"")
911 SysLog(NID_WEB_CTRL, "Lauch native app to handle the mime");
913 ewk_policy_decision_ignore(pPolicy);
915 AppControl* pAppControl = null;
916 _SelectBox selectBox;
918 int selectedIndex = 0;
920 std::unique_ptr<IList, AllElementsDeleter> pList(_AppManagerImpl::FindAppControlsN(NULL, NULL, &mime, NULL));
924 appCount = pList->GetCount();
927 r = selectBox.Construct(false, L"", appCount+1); //+1 for Downloader
928 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
930 selectBox.AddListItem(L"Download", _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
931 for (int i = 0; i < appCount; i++)
933 pAppControl = dynamic_cast< AppControl* >(pList->GetAt(i));
934 SysTryReturnVoidResult(NID_WEB_CTRL, pAppControl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
936 String text = pAppControl->GetAppName();
937 SysLog(NID_WEB_CTRL, "AppName : %S", text.GetPointer());
939 selectBox.AddListItem(text, _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
941 r = selectBox.ShowAndWait(selectedIndex);
942 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
944 if (selectedIndex == 0) //download
947 DownloadRequest request(pUrl);
949 _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
950 SysTryReturnVoidResult(NID_WEB_CTRL, pManagerImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
952 r = pManagerImpl->Start(request, reqId);
953 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
955 else if (selectedIndex != -1) // -1 for cancel
958 String pathVal(pUrl);
961 r = dataList.Construct();
962 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
964 r = dataList.Add(path, pathVal);
965 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
967 pAppControl = dynamic_cast< AppControl* >(pList->GetAt(selectedIndex));
968 SysTryReturnVoidResult(NID_WEB_CTRL, pAppControl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
970 _AppControlImpl* pAcImpl = _AppControlImpl::GetInstance(*pAppControl);
971 SysTryReturnVoidResult(NID_WEB_CTRL, pAcImpl, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
973 r = pAcImpl->Start(null, null, &dataList, null);
974 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
981 case WEB_DECISION_DOWNLOAD:
983 ewk_policy_decision_ignore(pPolicy);
985 _WebDataHandler* pDownloadHandler = pImpl->GetDownloadHandler();
986 SysTryReturnVoidResult(NID_WEB_CTRL, pDownloadHandler, E_SYSTEM, "[%s] A system error has been occurred. Failed to get DownloadHandler.", GetErrorMessage(E_SYSTEM));
988 Ewk_Context* pContext = ewk_view_context_get(pView);
989 SysAssertf(pContext, "Failed to get webkit instance.");
991 pDownloadHandler->StartDownload(pUrl);
995 case WEB_DECISION_IGNORE:
997 ewk_policy_decision_ignore(pPolicy);
1007 ewk_policy_decision_use(pPolicy);
1012 ewk_policy_decision_ignore(pPolicy);
1017 OnProgressCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1019 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1020 SysAssertf(pImpl, "Failed to request");
1022 if (pImpl->IsRedirectRequested())
1024 pImpl->SetRedirectRequested(false);
1027 if (pImpl->IsLoadingErrorOccurred())
1029 pImpl->SetLoadingErrorOccurred(false);
1030 evas_object_smart_callback_call(pView, "load,finished", NULL);
1036 OnLoadingErrorOccurred(void* pUserData, Evas_Object* pView, void* pEventInfo)
1038 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1039 Ewk_Error* pErrorData = reinterpret_cast< Ewk_Error* >(pEventInfo);
1040 SysAssertf(pImpl && pErrorData, "Failed to request");
1042 int code = ewk_error_code_get(pErrorData);
1043 const char* pDescription = ewk_error_description_get(pErrorData);
1045 SysLog(NID_WEB_CTRL, "The current value of code is %d, description is %s", code, pDescription);
1047 pImpl->SetLoadingErrorOccurred(true);
1050 case EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE:
1052 case EWK_ERROR_CODE_PLUGINWILLHANDLELOAD:
1055 case EWK_ERROR_NETWORK_STATUS_CANCELLED:
1056 evas_object_smart_callback_call(pView, "load,stop", NULL);
1060 if (pImpl->GetLoadingListener())
1062 result r = E_SUCCESS;
1064 r = FireLoadingErrorOccurredEvent(pImpl, code, pDescription);
1065 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1073 OnLoadingCanceled(void* pUserData, Evas_Object* pView, void* pEventInfo)
1075 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1076 SysAssertf(pImpl, "Failed to request");
1078 if (pImpl->GetLoadingListener())
1080 result r = E_SUCCESS;
1082 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_CANCELED));
1083 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1085 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1086 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1087 pEventArg.release();
1094 OnLoadingCompleted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1096 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1097 SysAssertf(pImpl, "Failed to request");
1099 if (pImpl->GetLoadingListener())
1101 result r = E_SUCCESS;
1103 std::unique_ptr<_LoadingEventArg> pEventArg(new (std::nothrow) _LoadingEventArg(WEB_EVENT_LOADINGLISTENER_COMPLETED));
1104 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1106 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1107 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1108 pEventArg.release();
1115 OnLoadingCommitted(void* pUserData, Evas_Object* pView, void* pEventInfo)
1117 evas_object_focus_set(pView, EINA_FALSE);
1122 OnDidStartDownloadCallback(const char* pUrl, void* pUserData)
1124 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1125 SysAssertf(pUrl && pImpl != null, "Failed to request");
1127 SysLog(NID_WEB_CTRL, "The current value of url is %s", pUrl);
1132 FireWebPageShowRequestedEvent(_WebImpl* pImpl, int event)
1134 result r = E_SUCCESS;
1136 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1137 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1139 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1140 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1141 pEventArg.release();
1148 OnWebPageShowRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1150 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1151 SysAssertf(pImpl, "Failed to request");
1153 if (pImpl->GetUiEventListener())
1155 result r = E_SUCCESS;
1157 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED);
1158 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1160 if (pImpl->GetUiEventListenerF())
1162 result r = E_SUCCESS;
1164 r = FireWebPageShowRequestedEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT);
1165 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1171 OnWebWindowCreateRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1173 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(pUserData);
1174 Evas_Object** pChildView = reinterpret_cast< Evas_Object** >(pEventInfo);
1175 SysAssertf(pParentImpl && pChildView, "Failed to request");
1177 IWebUiEventListener* pUserUiListener = pParentImpl->GetUiEventListener();
1178 IWebUiEventListenerF* pUserUiListenerF = pParentImpl->GetUiEventListenerF();
1179 if (pUserUiListener)
1181 Web* pWeb = pUserUiListener->OnWebWindowCreateRequested();
1184 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1185 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1187 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1188 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1191 if (pUserUiListenerF)
1193 Web* pWeb = pUserUiListenerF->OnWebWindowCreateRequested();
1196 _WebImpl* pChildImpl = _WebImpl::GetInstance(pWeb);
1197 SysTryReturnVoidResult(NID_WEB_CTRL, pChildImpl, E_SYSTEM, "[%s] A system error has been occurred. Failed to get ChildImpl object.", GetErrorMessage(E_SYSTEM));
1199 *pChildView = dynamic_cast< _Web* >(&pChildImpl->GetCore())->GetWebNativeNode();
1200 evas_object_data_set(*pChildView, PARENT_WEB_CTRL, pParentImpl);
1207 FireWebWindowClosedRequestedEvent(_WebImpl* pImpl, int event)
1209 result r = E_SUCCESS;
1211 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1212 SysTryReturnResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1214 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1215 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1216 pEventArg.release();
1223 OnWebWindowClosedRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
1225 _WebImpl* pChildImpl = reinterpret_cast< _WebImpl* >(pUserData);
1226 _WebImpl* pParentImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, PARENT_WEB_CTRL));
1227 SysAssertf(pChildImpl && pParentImpl, "Failed to request");
1229 if (pParentImpl->GetUiEventListener())
1231 result r = E_SUCCESS;
1233 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED);
1234 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1236 if (pParentImpl->GetUiEventListenerF())
1238 result r = E_SUCCESS;
1240 r = FireWebWindowClosedRequestedEvent(pChildImpl, WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT);
1241 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1247 FireWebPreventDefaultTriggeredEvent(_WebImpl* pImpl, int event, bool trigger)
1249 result r = E_SUCCESS;
1251 std::unique_ptr<Boolean> pPreventTrigger(new (std::nothrow) Boolean(trigger));
1252 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(event));
1253 SysTryReturnResult(NID_WEB_CTRL, pPreventTrigger.get() && pEventArg.get(), E_OUT_OF_MEMORY, " Memory allocation failed." );
1255 r = pEventArg->SetEventInfo(_WebUiEventArg::PREVENT_DEFAULT, *pPreventTrigger.get());
1256 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1258 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1259 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1266 OnWebPreventDefaultTriggered(void* pUserData, Evas_Object* pView, void* pEventInfo)
1268 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1269 Eina_Bool* pTrigger = reinterpret_cast< Eina_Bool* >(pEventInfo);
1270 SysAssertf(pImpl && pTrigger, "Failed to request");
1272 if (pImpl->GetUiEventListener())
1274 result r = E_SUCCESS;
1276 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED, static_cast< bool >(*pTrigger));
1277 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1279 if (pImpl->GetUiEventListenerF())
1281 result r = E_SUCCESS;
1283 r = FireWebPreventDefaultTriggeredEvent(pImpl, WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT, static_cast< bool >(*pTrigger));
1284 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1290 OnSelectUploadFile(Evas_Object* pView, Eina_Bool multipleFile, Eina_List* pAcceptTypes, const char* pCapture, void* pUserData)
1292 Eina_Bool ret = EINA_FALSE;
1293 Eina_List* pSelectedFileNames = null;
1294 String isMultipleSelection(L"single");
1298 isMultipleSelection.Append(L"multiple");
1301 std::unique_ptr<_MediaSelectionListener> pMediaListener(new (std::nothrow) _MediaSelectionListener());
1302 SysTryCatch(NID_WEB_CTRL, pMediaListener.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1305 int itemCount = eina_list_count(pAcceptTypes);
1306 String fileType = L"all";
1310 String item((char*)eina_list_nth(pAcceptTypes, 0));
1311 if (item.StartsWith("image/",0))
1313 fileType = L"image";
1315 else if (item.StartsWith("audio/",0))
1317 fileType = L"audio";
1319 else if (item.StartsWith("video/",0))
1321 fileType = L"video";
1326 result r = dataList.Construct();
1327 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1329 String mode(L"selectionType");
1330 r = dataList.Add(mode, isMultipleSelection);
1331 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1333 String type(L"type");
1334 r = dataList.Add(type, fileType);
1335 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1337 std::unique_ptr<AppControl> pMediaAppControl(_AppManagerImpl::FindAppControlN(L"tizen.filemanager", L"http://tizen.org/appcontrol/operation/pick"));
1338 SysTryCatch(NID_WEB_CTRL, pMediaAppControl.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
1340 _AppControlImpl* pMediaAppControlImpl = _AppControlImpl::GetInstance(*pMediaAppControl);
1341 r = pMediaAppControlImpl->Start(null, null, &dataList, pMediaListener.get());
1342 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1346 if (pMediaListener->IsSelectionCompleted())
1348 const ArrayList* pSelectedFiles = pMediaListener->GetSelectedFiles();
1349 SysTryCatch(NID_WEB_CTRL, pSelectedFiles, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
1351 int fileCount = pSelectedFiles->GetCount();
1353 for (int i = 0; i < fileCount; i++)
1355 String* pFile = (String*)pSelectedFiles->GetAt(i);
1356 SysTryCatch(NID_WEB_CTRL, pFile, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
1358 std::unique_ptr<ByteBuffer> pByteBuf(StringUtil::StringToUtf8N(*pFile));
1359 SysTryCatch(NID_WEB_CTRL, pByteBuf.get(), r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
1361 pSelectedFileNames = eina_list_append(pSelectedFileNames, strdup((const char*)pByteBuf->GetPointer()));
1368 ecore_main_loop_iterate();
1371 ewk_view_open_panel_reply(pView, pSelectedFileNames, ret);
1376 ewk_view_open_panel_reply(pView, null, ret);
1377 eina_list_free(pSelectedFileNames);
1383 OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
1385 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1386 char* pJsonText = reinterpret_cast< char* >(pEventInfo);
1387 SysAssertf(pImpl && pJsonText, "Failed to request");
1389 result r = E_SUCCESS;
1391 SysLog(NID_WEB_CTRL, "The current value of jsontext is %s", pJsonText);
1393 std::unique_ptr<_JsBridgeArg> pEventArg(new (std::nothrow) _JsBridgeArg());
1394 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1396 r = pEventArg->Construct(pJsonText);
1397 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1399 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1400 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1401 pEventArg.release();
1406 OnWebKeypadStateChanged(void* pUserData, Evas_Object* pView, void* pEventInfo)
1408 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1409 Eina_Rectangle* pEinaRect = reinterpret_cast< Eina_Rectangle* >(pEventInfo);
1410 SysAssertf(pImpl && pEinaRect, "Failed to request");
1412 if (pImpl->GetSetting().GetInputStyle() == INPUT_STYLE_OVERLAY)
1414 _ICoordinateSystemTransformer* pXformer = _CoordinateSystem::GetInstance()->GetInverseTransformer();
1415 SysAssertf(pXformer, "Failed to get CoordinateTransformer");
1417 Rectangle rect(pEinaRect->x, pEinaRect->y, pEinaRect->w, pEinaRect->h);
1419 if (rect.height == 0)
1424 _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
1425 SysAssertf(pFormCore != null, "Failed to get FormCore");
1427 if (pFormCore->HasFooter() && pFormCore->IsFooterVisible())
1429 pImpl->SetFooterVisibleState(true);
1430 pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
1433 if (pImpl->GetWebKeypadEventListener())
1435 if (pImpl->IsKeypadVisible() == true)
1437 if ((pImpl->GetPreviousKeypadBounds().width == rect.width) && (pImpl->GetPreviousKeypadBounds().height != rect.height))
1439 pImpl->GetWebKeypadEventListener()->OnWebKeypadBoundsChanged(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1444 pFormCore->DeflateClientRectHeight(pXformer->TransformVertical(rect.height));
1445 pImpl->GetWebKeypadEventListener()->OnWebKeypadWillOpen(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1448 pImpl->SetKeypadVisibleState(true);
1449 pImpl->SetPreviousKeypadBounds(rect);
1453 result r = pImpl->SetFullScreenKeypad();
1454 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1460 OnWebKeypadOpened(void* pUserData, Evas_Object* pView, void* pEventInfo)
1462 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1463 SysAssertf(pImpl, "Failed to request");
1465 if (pImpl->GetWebKeypadEventListener())
1467 pImpl->GetWebKeypadEventListener()->OnWebKeypadOpened(*static_cast< Web* >(&pImpl->GetPublic()));
1473 OnWebKeypadClosed(void* pUserData, Evas_Object* pView, void* pEventInfo)
1475 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1476 SysAssertf(pImpl, "Failed to request");
1478 _Form* pFormCore = pImpl->GetParentFormCore(dynamic_cast< _Control* >(&pImpl->GetCore()));
1479 SysAssertf(pFormCore != null, "Failed to get FormCore");
1481 if (pFormCore->HasFooter() && pImpl->IsFooterVisible())
1483 pImpl->SetFooterVisibleState(false);
1484 pFormCore->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
1487 pFormCore->DeflateClientRectHeight(0);
1489 if (pImpl->GetWebKeypadEventListener())
1491 pImpl->GetWebKeypadEventListener()->OnWebKeypadClosed(*dynamic_cast< Web* >(&pImpl->GetPublic()));
1494 pImpl->SetKeypadVisibleState(false);
1499 OnWindowObjectFocusGained(void *pUserData, Evas_Object *pWin, void *pEvent_info)
1501 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1502 SysAssertf(pImpl, "Failed to request");
1504 if (pImpl->IsKeypadOpened() == true)
1506 _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
1507 SysAssertf(pWebCore, "Failed to get Web core object");
1509 evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
1511 pImpl->SetKeypadOpened(false);
1517 OnWebNativeNodeFocusGained(void *pUserData, Evas *pCanvas, Evas_Object* pView, void* pEventInfo)
1519 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1520 SysAssertf(pImpl, "Failed to request");
1522 if (pImpl->IsKeypadOpened() == true)
1524 pImpl->SetKeypadOpened(false);
1530 OnColorPickerProviderRequested(Ewk_View_Smart_Data *pSmartData, int red, int green, int blue, int alpha)
1532 SysAssertf(pSmartData, "invalid smartdata");
1533 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1534 SysAssertf(pWebImpl, "Failed to get Impl");
1536 result r = E_SUCCESS;
1538 if (pWebImpl->GetColorpicker())
1545 r = pWebImpl->ShowColorPicker(red, green, blue, alpha, color);
1546 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1548 byte r1, g1, b1, a1;
1549 color.GetColorComponents(r1, g1, b1, a1);
1550 ewk_view_color_picker_color_set(pSmartData->self, r1, g1, b1, a1);
1557 OnColorPickerProviderDismissed(Ewk_View_Smart_Data *pSmartData)
1559 SysAssertf(pSmartData, "invalid smartdata");
1561 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1562 SysAssertf(pWebImpl, "Failed to get Impl");
1564 return pWebImpl->HideColorPicker();
1569 OnDatePickerProviderRequested(Ewk_View_Smart_Data *pSmartData, Ewk_Input_Type inputType, const char* inputValue)
1571 SysAssertf(pSmartData, "Failed to request");
1572 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1573 SysAssertf(pWebImpl, "Failed to get Impl");
1575 result r = E_SUCCESS;
1577 if (pWebImpl->GetDatepicker())
1579 ewk_view_focused_input_element_value_set(pSmartData->self, inputValue);
1586 r = pWebImpl->ShowDatePicker(inputType, inputValue, dateStr);
1587 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Memory allocation failed.", GetErrorMessage(r));
1589 std::unique_ptr<char[]> pDateStr(_StringConverter::CopyToCharArrayN(dateStr));
1590 SysTryReturn(NID_WEB_CTRL, pDateStr.get(), EINA_FALSE, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1592 ewk_view_focused_input_element_value_set(pSmartData->self, pDateStr.get());
1599 OnSelectBoxRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, double pageScaleFactor, Eina_List* pItems, int selectedIndex)
1601 SysAssertf(pSmartData, "Failed to request");
1603 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1604 SysAssertf(pWebImpl, "Failed to get Impl");
1606 result r = pWebImpl->ShowSelectBoxPopup(false, L"", pItems, pSmartData->self, selectedIndex);
1607 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1614 OnSelectBoxClosed(Ewk_View_Smart_Data *pSmartData)
1616 SysAssertf(pSmartData, "invalid smartdata");
1618 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1619 SysAssertf(pWebImpl, "Failed to get Impl");
1621 result r = pWebImpl->ClearSelectBoxPopup();
1622 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1629 OnSelectBoxUpdateRequested(Ewk_View_Smart_Data *pSmartData, Eina_Rectangle rect, Ewk_Text_Direction textDirection, Eina_List* pItems, int selectedIndex)
1631 SysAssertf(pSmartData, "invalid smartdata");
1633 _WebImpl* pWebImpl = reinterpret_cast<_WebImpl*>(evas_object_data_get(pSmartData->self, WEB_CTRL));
1634 SysAssertf(pWebImpl, "Failed to get Impl");
1636 result r = pWebImpl->UpdateSelectBoxPopup(pItems, selectedIndex, false);
1637 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
1644 OnCookiesPolicyGot(Ewk_Cookie_Accept_Policy policy, Ewk_Web_Error *pError, void *pUserData)
1646 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
1647 SysAssertf(pPresenter && !pError, "Failed to request");
1649 bool ret = EINA_TRUE;
1653 case EWK_COOKIE_ACCEPT_POLICY_ALWAYS:
1655 case EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY:
1659 case EWK_COOKIE_ACCEPT_POLICY_NEVER:
1668 SysLog(NID_WEB_CTRL, "The current value of policy is %d", ret);
1670 pPresenter->EndAsyncProcess(ret);
1675 OnScriptExecuted(Evas_Object* pView, const char* pResult, void* pUserData)
1677 _WebPresenter* pPresenter = reinterpret_cast< _WebPresenter* >(pUserData);
1678 SysAssertf(pPresenter, "Failed to request");
1680 String result(pResult);
1681 SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
1683 pPresenter->EndAsyncProcess(result);
1688 OnTextFound(void* pUserData, Evas_Object* pView, void* pEventInfo)
1690 _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
1691 SysAssertf(pImpl, "Failed to request");
1693 int* pTotalCount = reinterpret_cast< int* >(pEventInfo);
1694 SysLog(NID_WEB_CTRL, "The current value of totalCount is %d", *pTotalCount);
1696 _WebPresenter* pWebPresenter = pImpl->GetSearchPresenter();
1700 pWebPresenter->EndAsyncProcess(*pTotalCount);
1704 if (pImpl->GetTextSearchListener())
1706 result r = E_SUCCESS;
1710 if (*pTotalCount > 0)
1712 ordinal = pImpl->GetAsyncSearchOrdinal();
1713 pImpl->SetAsyncSearchResult(*pTotalCount);
1716 if (pImpl->GetPendingAsyncSearchCount() > 0)
1721 std::unique_ptr<Integer> pCount(new (std::nothrow) Integer(*pTotalCount));
1722 std::unique_ptr<Integer> pOrdinal(new (std::nothrow) Integer(ordinal));
1723 std::unique_ptr<_TextSearchEventArg> pEventArg(new (std::nothrow) _TextSearchEventArg(WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND));
1724 SysTryReturnVoidResult(NID_WEB_CTRL, pCount.get() && pOrdinal.get() && pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1726 r = pEventArg->SetEventInfo(_TextSearchEventArg::TOTAL_COUNT, *pCount.get());
1727 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1730 r = pEventArg->SetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL, *pOrdinal.get());
1731 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1734 r = pImpl->GetWebEvent()->FireAsync(*pEventArg.get());
1735 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1736 pEventArg.release();
1742 class _JsBridgeHashCodeProvider
1743 : public Tizen::Base::Collection::IHashCodeProviderT< Tizen::Base::String >
1746 _JsBridgeHashCodeProvider(){}
1747 virtual ~_JsBridgeHashCodeProvider(void) {}
1750 int GetHashCode(const Tizen::Base::String& obj) const
1752 return obj.GetHashCode();
1758 //Comparer implementation
1759 class _JsBridgeComparer
1760 : public Tizen::Base::Collection::IComparerT< Tizen::Base::String >
1763 _JsBridgeComparer(){}
1764 virtual ~_JsBridgeComparer(void) {}
1767 result Compare(const Tizen::Base::String& obj1, const Tizen::Base::String& obj2, int& cmp) const
1784 _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
1785 : _ContainerImpl(pWeb, pCore)
1786 , __isFooterVisible(false)
1787 , __isKeypadVisible(false)
1788 , __isKeypadOpened(false)
1789 , __isLoadingErrorOccurred(false)
1790 , __isRedirectRequested(false)
1791 , __keypadBounds(0, 0, 0, 0)
1793 , __pUserLoadingListener(null)
1794 , __pUserUiListener(null)
1795 , __pUserUiListenerF(null)
1796 , __pUserKeypadEventListener(null)
1797 , __pTextSearchListener(null)
1799 , __pWebSetting(null)
1800 , __pJsBridgeList(null)
1801 , __pJsProvider(null)
1802 , __pJsComparer(null)
1803 , __pWebDownloadHandler(null)
1805 , __pAuthChallenge(null)
1806 , __pAuthPopup(null)
1807 , __pUserConfirmPopup(null)
1808 , __pGeolocationPopup(null)
1809 , __pSelectBox(null)
1810 , __pDatePicker(null)
1811 , __pColorPicker(null)
1812 , __policy(WEB_DECISION_CONTINUE)
1814 __textSearch.__searchAll = false;
1815 __textSearch.__searchForward = true;
1816 __textSearch.__caseSensitive = false;
1817 __textSearch.__pending = 0;
1818 __textSearch.__currentIndex = 1;
1819 __textSearch.__totalCount = -1;
1820 __textSearch.__text = L"";
1824 _WebImpl::~_WebImpl()
1826 RemoveEventListenerCallback();
1830 _WebImpl::CreateWebImplN(Web* pControl, const Rectangle& bounds)
1832 result r = E_SUCCESS;
1834 r = GET_SIZE_INFO(Web).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
1835 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1837 _Web* pCore = _Web::CreateWebN();
1838 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1840 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
1842 r = CheckConstruction(pCore, pImpl);
1843 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1845 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
1846 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1848 r = pImpl->Construct();
1849 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1861 _WebImpl::CreateWebImplN(Web* pControl, const FloatRectangle& bounds)
1863 result r = E_SUCCESS;
1865 r = GET_SIZE_INFO(Web).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
1866 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1868 _Web* pCore = _Web::CreateWebN();
1869 SysTryReturn(NID_WEB_CTRL, pCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1871 _WebImpl* pImpl = new (std::nothrow) _WebImpl(pControl, pCore);
1873 r = CheckConstruction(pCore, pImpl);
1874 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1876 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Web), bounds, pCore->GetOrientation());
1877 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1879 r = pImpl->Construct();
1880 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1892 _WebImpl::Construct(void)
1894 result r = E_SUCCESS;
1896 r = __mutex.Create();
1897 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1899 r = __textSearch.__searchQueue.Construct();
1900 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1902 __pWebSetting = std::unique_ptr<WebSetting>(new (std::nothrow) WebSetting());
1903 SysTryReturn(NID_WEB_CTRL, __pWebSetting.get(), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1905 r = InitJsBridgeList();
1906 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1909 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1911 __pWebCore = dynamic_cast< _Web* >(&(GetCore()));
1912 SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
1914 __pWebCore->SetWebSettingImpl(_WebSettingImpl::GetInstance(__pWebSetting.get()));
1921 _WebImpl::InitializeSetting(void)
1923 result r = E_SUCCESS;
1925 r = SetSetting(*__pWebSetting.get());
1926 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1928 SetCookieEnabled(_WebSettingImpl::GetInstance(__pWebSetting.get())->IsCookieEnabled());
1929 SetPrivateBrowsingEnabled(_WebSettingImpl::GetInstance(__pWebSetting.get())->IsPrivateBrowsingEnabled());
1930 SetZoomLevel(_WebSettingImpl::GetInstance(__pWebSetting.get())->GetZoomLevel());
1932 SetEventListenerCallback();
1934 _Form* pFormCore = GetParentFormCore(dynamic_cast< _Control* >(&this->GetCore()));
1935 SysAssertf(pFormCore != null, "Failed to get FormCore");
1942 _WebImpl::IsLayoutable(void) const
1949 _WebImpl::InitWebEvent(void)
1951 __pWebEvent = std::unique_ptr<_WebEvent>(new (std::nothrow) _WebEvent());
1952 SysTryReturnResult(NID_WEB_CTRL, __pWebEvent.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
1954 return __pWebEvent->Construct(*this);
1959 _WebImpl::GetWebEvent(void) const
1961 return __pWebEvent.get();
1966 _WebImpl::ConvertToSlpHeaderN(const HttpHeader& header) const
1968 Eina_Hash* pHttpHeader = null;
1970 std::unique_ptr<IList> pFieldNameList(header.GetFieldNamesN());
1971 if (pFieldNameList.get())
1973 pHttpHeader = eina_hash_string_small_new(FreeCharArray);
1974 SysTryReturn(NID_WEB_CTRL, pHttpHeader, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1976 int count = pFieldNameList->GetCount();
1978 for (int i = 0; i < count; i++)
1980 String* pFieldName = dynamic_cast< String* >(pFieldNameList->GetAt(i));
1981 SysTryCatch(NID_WEB_CTRL, pFieldName, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1983 std::unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pFieldName));
1984 SysTryCatch(NID_WEB_CTRL, pKey.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1986 std::unique_ptr<IEnumerator> pFieldValueEnum(header.GetFieldValuesN(*pFieldName));
1987 SysTryCatch(NID_WEB_CTRL, pFieldValueEnum.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1989 while (pFieldValueEnum->MoveNext() == E_SUCCESS)
1991 Eina_Bool ret = false;
1993 String* pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
1994 SysTryCatch(NID_WEB_CTRL, pFieldValue, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1996 std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pFieldValue));
1997 SysTryCatch(NID_WEB_CTRL, pValue.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1999 ret = eina_hash_add(pHttpHeader, pKey.get(), pValue.release());
2000 SysTryCatch(NID_WEB_CTRL, ret == EINA_TRUE, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2007 eina_hash_free(pHttpHeader);
2014 _WebImpl::LoadUrl(const String& url) const
2016 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2017 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2019 ewk_view_url_set(__pWebCore->GetWebNativeNode(), pUrl.get());
2026 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
2028 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2029 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2031 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2033 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
2035 eina_hash_free(pHttpHeader);
2042 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
2045 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
2046 SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2048 Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
2050 ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
2052 eina_hash_free(pHttpHeader);
2059 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
2061 std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
2062 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2063 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
2064 SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2066 ewk_view_contents_set(__pWebCore->GetWebNativeNode(), reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
2073 _WebImpl::Pause(void)
2075 ewk_view_suspend(__pWebCore->GetWebNativeNode());
2080 _WebImpl::Resume(void)
2082 ewk_view_resume(__pWebCore->GetWebNativeNode());
2087 _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* pItems, Evas_Object* pWebView, int selectedIndex)
2089 __pSelectBox.reset();
2091 int itemCount = eina_list_count(pItems);
2092 SysTryReturnResult(NID_WEB_CTRL, itemCount > 0, E_SYSTEM, "ItemCount is invalid.");
2094 result r = E_SUCCESS;
2096 std::unique_ptr<_SelectBox> pSelectBox(new (std::nothrow) _SelectBox());
2097 SysTryReturnResult(NID_WEB_CTRL, pSelectBox.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
2099 r = pSelectBox->Construct(isMultiSelect, title, itemCount, pWebView);
2100 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2102 r = pSelectBox->UpdateList(pItems, selectedIndex, false, false);
2103 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2105 __pSelectBox = std::move(pSelectBox);
2107 return __pSelectBox->ShowPopup();
2112 _WebImpl::UpdateSelectBoxPopup(Eina_List* pItems, int selectedIndex, bool isGroupedList)
2114 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2116 return __pSelectBox->UpdateList(pItems, selectedIndex, true, isGroupedList);
2121 _WebImpl::ClearSelectBoxPopup(void)
2123 SysTryReturnResult(NID_WEB_CTRL, __pSelectBox.get(), E_SYSTEM, "SlectBox instance does not exist.");
2125 __pSelectBox.reset();
2132 _WebImpl::GetDatepicker(void)
2134 _InputPickerPopup* pInputPicker =null;
2137 pInputPicker = __pDatePicker.get();
2139 return pInputPicker;
2144 _WebImpl::GetColorpicker(void)
2146 _InputPickerPopup* pInputPicker =null;
2149 pInputPicker = __pColorPicker.get();
2151 return pInputPicker;
2156 _WebImpl::CanGoBack(void) const
2158 return static_cast< bool >(ewk_view_back_possible(__pWebCore->GetWebNativeNode()));
2163 _WebImpl::CanGoForward(void) const
2165 return static_cast< bool >(ewk_view_forward_possible(__pWebCore->GetWebNativeNode()));
2170 _WebImpl::GoBack(void) const
2172 ewk_view_back(__pWebCore->GetWebNativeNode());
2177 _WebImpl::GoForward(void) const
2179 ewk_view_forward(__pWebCore->GetWebNativeNode());
2184 _WebImpl::GetUrl(void) const
2186 return ewk_view_url_get(__pWebCore->GetWebNativeNode());
2191 _WebImpl::GetTitle(void) const
2193 return ewk_view_title_get(__pWebCore->GetWebNativeNode());
2198 _WebImpl::StopLoading(void) const
2200 ewk_view_stop(__pWebCore->GetWebNativeNode());
2205 _WebImpl::Reload(void) const
2207 ewk_view_reload_bypass_cache(__pWebCore->GetWebNativeNode());
2212 _WebImpl::EvaluateJavascriptN(const String& scriptCode) const
2214 if (scriptCode.GetLength())
2216 std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
2217 SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2219 _WebPresenter presenter;
2220 presenter.InitAsyncProcess();
2222 ewk_view_script_execute(__pWebCore->GetWebNativeNode(), pScript.get(), OnScriptExecuted, &presenter);
2224 Tizen::Base::String* pResult = new (std::nothrow) Tizen::Base::String(L"");
2225 SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2226 presenter.WaitAsyncProcess(*pResult);
2236 _WebImpl::SetZoomLevel(float level)
2238 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);
2240 ewk_view_scale_set(__pWebCore->GetWebNativeNode(), static_cast< double >(level), 0, 0);
2247 _WebImpl::GetZoomLevel(void) const
2249 return static_cast< float >(ewk_view_scale_get(__pWebCore->GetWebNativeNode()));
2253 const PageNavigationList*
2254 _WebImpl::GetBackForwardListN(void) const
2256 result r = E_SUCCESS;
2258 _PageNavigationListImpl* pNavigationListImpl = null;
2259 _HistoryItemImpl* pHistoryItemImpl = null;
2261 std::unique_ptr<PageNavigationList> pNavigationList;
2262 std::unique_ptr<ArrayList, AllElementsDeleter> pHistoryList;
2265 int forwardCount = 0;
2270 Ewk_History* pEwkHistoryList = ewk_view_history_get(__pWebCore->GetWebNativeNode());
2271 SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
2273 Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
2274 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_DATA_NOT_FOUND, "[%s] There is no history.", GetErrorMessage(E_DATA_NOT_FOUND));
2276 pNavigationList = std::unique_ptr<PageNavigationList>(new (std::nothrow) PageNavigationList());
2277 SysTryCatch(NID_WEB_CTRL, pNavigationList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2279 pNavigationListImpl = _PageNavigationListImpl::GetInstance(pNavigationList.get());
2280 SysTryCatch(NID_WEB_CTRL, pNavigationListImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2282 pHistoryList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
2283 SysTryCatch(NID_WEB_CTRL, pHistoryList.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2285 r = pHistoryList->Construct();
2286 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2288 backCount = ewk_history_back_list_length_get(pEwkHistoryList);
2289 forwardCount = ewk_history_forward_list_length_get(pEwkHistoryList);
2290 SysLog(NID_WEB_CTRL, "The current value of backCount is %d, forwardCount is %d", backCount, forwardCount);
2292 for (int i = -backCount; i < forwardCount + 1; i++)
2294 std::unique_ptr<HistoryItem> pHistoryItem(new (std::nothrow) HistoryItem());
2295 SysTryCatch(NID_WEB_CTRL, pHistoryItem.get(), , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2297 pHistoryItemImpl = _HistoryItemImpl::GetInstance(pHistoryItem.get());
2298 SysTryCatch(NID_WEB_CTRL, pHistoryItemImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2300 pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, i);
2301 SysTryCatch(NID_WEB_CTRL, pEwkItem, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2303 url = ewk_history_item_uri_get(pEwkItem);
2304 title = ewk_history_item_title_get(pEwkItem);
2305 SysLog(NID_WEB_CTRL, "The current value of url is %s, title is %s", url.GetPointer(), title.GetPointer());
2307 pHistoryItemImpl->SetHistoryItem(url, title);
2309 r = pHistoryList->Add(*pHistoryItem.get());
2310 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2311 pHistoryItem.release();
2314 pNavigationListImpl->SetPageNavigationList(pHistoryList.release(), backCount);
2316 ewk_history_free(pEwkHistoryList);
2318 return pNavigationList.release();
2321 ewk_history_free(pEwkHistoryList);
2328 _WebImpl::SearchText(const String& text, bool searchForward)
2330 result r = E_SUCCESS;
2332 Ewk_Find_Options condition = static_cast< Ewk_Find_Options >(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2336 condition = static_cast < Ewk_Find_Options >(condition | EWK_FIND_OPTIONS_BACKWARDS);
2339 _WebPresenter presenter;
2340 presenter.InitAsyncProcess();
2342 r = SynchronizeSearch(SEARCH_SYNC, __pWebCore->GetWebNativeNode(), condition, text, searchForward, false, &presenter);
2343 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2346 presenter.WaitAsyncProcess(result);
2348 return static_cast < bool >(result);
2353 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
2355 result r = E_SUCCESS;
2357 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2361 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2364 r = SynchronizeSearch(SEARCH_ALL_ASYNC, __pWebCore->GetWebNativeNode(), condition, text, true, caseSensitive);
2365 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2372 _WebImpl::SearchNextAsync(bool searchForward)
2374 SysTryReturnResult(NID_WEB_CTRL, __textSearch.__searchAll && __textSearch.__totalCount > -1, E_INVALID_OPERATION, "The SearchTextAllAsync() method is not called or completed.");
2375 SysTryReturnResult(NID_WEB_CTRL, (searchForward && __textSearch.__currentIndex < __textSearch.__totalCount) || (!searchForward && __textSearch.__currentIndex > 1)
2376 , E_OBJ_NOT_FOUND, "The Next instance is not available.");
2378 result r = E_SUCCESS;
2380 Ewk_Find_Options condition = EWK_FIND_OPTIONS_SHOW_HIGHLIGHT;
2382 if (__textSearch.__caseSensitive)
2384 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
2389 condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
2392 r = SynchronizeSearch(SEARCH_NEXT_ASYNC, __pWebCore->GetWebNativeNode(), condition, __textSearch.__text, searchForward);
2393 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2400 _WebImpl::SynchronizeSearch(_SearchType type, Evas_Object* pView, Ewk_Find_Options condition, const Tizen::Base::String& text, bool searchForward, bool caseSensitive, _WebPresenter* pWebPresenter)
2402 MutexGuard lock(__mutex);
2404 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(text));
2405 SysTryReturn(NID_WEB_CTRL, pText.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2410 if (__textSearch.__searchAll)
2412 DisableAsyncSearch();
2414 __textSearch.__searchQueue.Enqueue(this);
2415 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2417 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2418 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2422 __textSearch.__searchQueue.Enqueue(pWebPresenter);
2424 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2428 case SEARCH_ALL_ASYNC:
2429 __textSearch.__searchAll = true;
2430 __textSearch.__text = text;
2431 __textSearch.__searchForward = true;
2432 __textSearch.__caseSensitive = caseSensitive;
2433 __textSearch.__totalCount = -1;
2434 __textSearch.__currentIndex = 1;
2436 __textSearch.__searchQueue.Enqueue(this);
2437 __textSearch.__searchQueue.Enqueue(this);
2439 ewk_view_text_find(pView, "", condition, MAX_TEXT_MATCH);
2440 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2443 case SEARCH_NEXT_ASYNC:
2444 __textSearch.__searchForward = searchForward;
2446 CalculateAsyncSearchOrdinal();
2448 __textSearch.__searchQueue.Enqueue(this);
2450 ewk_view_text_find(pView, pText.get(), condition, MAX_TEXT_MATCH);
2462 _WebImpl::SetAsyncSearchResult(int totalCount)
2464 __textSearch.__totalCount = totalCount;
2469 _WebImpl::GetSearchPresenter(void)
2471 MutexGuard lock(__mutex);
2473 return dynamic_cast< _WebPresenter* >(__textSearch.__searchQueue.Dequeue());
2478 _WebImpl::GetPendingAsyncSearchCount(void) const
2480 return __textSearch.__searchQueue.GetCount();
2485 _WebImpl::CalculateAsyncSearchOrdinal(void)
2487 if (__textSearch.__searchForward)
2489 __textSearch.__currentIndex++;
2493 __textSearch.__currentIndex--;
2499 _WebImpl::GetAsyncSearchOrdinal(void) const
2501 return __textSearch.__currentIndex;
2506 _WebImpl::DisableAsyncSearch(void)
2508 __textSearch.__searchAll = false;
2513 _WebImpl::SetSetting(const WebSetting& setting)
2515 if (__pWebCore->GetWebNativeNode())
2517 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2518 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
2519 SysAssertf(pContext && pSettings, "Failed to get webkit instance.");
2521 std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(setting.GetDefaultTextEncoding()));
2522 SysTryReturn(NID_WEB_CTRL, pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2524 ewk_settings_default_encoding_set(pSettings, pEncoding.get());
2526 switch (setting.GetCacheControl())
2528 case WEB_CACHE_VALIDATED:
2529 ewk_context_cache_disabled_set(pContext, EINA_FALSE);
2532 case WEB_CACHE_IGNORE:
2533 ewk_context_cache_disabled_set(pContext, EINA_TRUE);
2540 if (setting.GetInputStyle() == INPUT_STYLE_OVERLAY)
2542 ewk_settings_default_keypad_enabled_set(pSettings, EINA_TRUE);
2546 ewk_settings_default_keypad_enabled_set(pSettings, EINA_FALSE);
2549 ewk_settings_font_default_size_set(pSettings, static_cast< Eina_Bool >(setting.GetFontSize()));
2551 ewk_settings_javascript_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsJavascriptEnabled()));
2553 ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
2555 std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
2556 SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2558 ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
2560 ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
2562 ewk_settings_scripts_window_open_set(pSettings, static_cast< Eina_Bool >(setting.IsJavaScriptPopupEnabled()));
2564 ewk_settings_form_candidate_data_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFormDataShowEnabled()));
2566 ewk_settings_autofill_password_form_enabled_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoLoginFormFillEnabled()));
2569 __pWebSetting->SetCertificateErrorHandlingMode(setting.GetCertificateErrorHandlingMode());
2570 __pWebSetting->SetDefaultTextEncoding(setting.GetDefaultTextEncoding());
2571 __pWebSetting->SetCacheControl(setting.GetCacheControl());
2572 __pWebSetting->SetFontSize(setting.GetFontSize());
2573 __pWebSetting->SetJavascriptEnabled(setting.IsJavascriptEnabled());
2574 __pWebSetting->SetAutoImageLoadEnabled(setting.IsAutoImageLoadEnabled());
2575 __pWebSetting->SetInputStyle(setting.GetInputStyle());
2576 __pWebSetting->SetUserAgent(setting.GetUserAgent());
2577 __pWebSetting->SetAutoFittingEnabled(setting.IsAutoFittingEnabled());
2578 __pWebSetting->SetJavaScriptPopupEnabled(setting.IsJavaScriptPopupEnabled());
2579 __pWebSetting->SetGeolocationEnabled(setting.IsGeolocationEnabled());
2580 __pWebSetting->SetAutoFormDataShowEnabled(setting.IsAutoFormDataShowEnabled());
2581 __pWebSetting->SetAutoLoginFormFillEnabled(setting.IsAutoLoginFormFillEnabled());
2588 _WebImpl::GetSetting(void) const
2590 return *__pWebSetting;
2594 const HitElementResult*
2595 _WebImpl::GetElementByPointN(const Point& point) const
2597 result r = E_SUCCESS;
2599 _HitElementResultImpl* pHitElementResultImpl = null;
2601 std::unique_ptr<HitElementResult> pHitElementResult;
2602 std::unique_ptr<Bitmap> pImage;
2603 std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
2605 Point absPoint(__pWebCore->GetAbsoluteCoordinate(point));
2607 Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
2608 SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
2610 Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
2611 Ewk_Hit_Test_Result_Context context = ewk_hit_test_result_context_get(pEwkHitTest);
2612 String url(ewk_hit_test_link_uri_get(pEwkHitTest));
2613 String tagName(ewk_hit_test_tag_name_get(pEwkHitTest));
2614 String nodeValue(ewk_hit_test_node_value_get(pEwkHitTest));
2616 SysLog(NID_WEB_CTRL, "The current value of url is %ls, tag is %ls, value is %ls", url.GetPointer(), tagName.GetPointer(), nodeValue.GetPointer());
2618 pHitElementResult = std::unique_ptr<HitElementResult>(new (std::nothrow) HitElementResult());
2619 SysTryCatch(NID_WEB_CTRL, pHitElementResult.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2621 pHitElementResultImpl = _HitElementResultImpl::GetInstance(pHitElementResult.get());
2622 SysTryCatch(NID_WEB_CTRL, pHitElementResultImpl, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2624 if (context & EWK_HIT_TEST_RESULT_CONTEXT_IMAGE)
2630 int imageLength = ewk_hit_test_image_buffer_length_get(pEwkHitTest);
2631 void* pImageBuffer = ewk_hit_test_image_buffer_get(pEwkHitTest);
2632 const char* pExtension = ewk_hit_test_image_file_name_extension_get(pEwkHitTest);
2633 SysLog(NID_WEB_CTRL, "The current value of imageBuffer is %u, bufferLength is %d, extension is %s", pImageBuffer, imageLength, pExtension);
2635 r = buf.Construct(imageLength);
2636 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2638 r = buf.SetArray(reinterpret_cast< byte* >(pImageBuffer), 0, imageLength);
2639 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2643 // ToDo : webkit doesn't support types such as IMG_FORMAT_WBMP and IMG_FORMAT_TIFF
2644 // webkit support types such as ico and vp8 additionally
2645 if (strcmp(pExtension, "gif") == 0)
2647 format = IMG_FORMAT_GIF;
2649 else if (strcmp(pExtension, "jpg") == 0)
2651 format = IMG_FORMAT_JPG;
2653 else if (strcmp(pExtension, "png") == 0)
2655 format = IMG_FORMAT_PNG;
2657 else if (strcmp(pExtension, "bmp") == 0)
2659 format = IMG_FORMAT_BMP;
2663 SysLogException(NID_WEB_CTRL, E_UNSUPPORTED_FORMAT, "[%s] The %s format is not supported", GetErrorMessage(E_UNSUPPORTED_FORMAT), pExtension);
2667 r = image.Construct();
2668 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2670 pImage = std::unique_ptr<Bitmap>(image.DecodeN(buf, format, BITMAP_PIXEL_FORMAT_RGB565));
2671 SysTryCatch(NID_WEB_CTRL, pImage.get(), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2676 pAttributeMap = std::unique_ptr<HashMap, AllElementsDeleter>(new (std::nothrow) HashMap());
2677 SysTryCatch(NID_WEB_CTRL, pAttributeMap.get(), , E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2679 r = pAttributeMap->Construct(eina_hash_population(pAttrHash));
2680 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2682 eina_hash_foreach(pAttrHash, AddHttpAttributeData, pAttributeMap.get());
2683 SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2686 pHitElementResultImpl->SetHitElementResult(pAttributeMap.release(), pImage.release(), tagName, nodeValue, url);
2688 ewk_hit_test_free(pEwkHitTest);
2690 return pHitElementResult.release();
2693 ewk_hit_test_free(pEwkHitTest);
2699 const HitElementResult*
2700 _WebImpl::GetElementByPointN(const FloatPoint& point) const
2702 const Point integerPoint(_CoordinateSystemUtils::ConvertToInteger(point));
2704 std::unique_ptr<const HitElementResult> pHitElementResult(GetElementByPointN(integerPoint));
2705 SysTryReturn(NID_WEB_CTRL, pHitElementResult.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2707 return pHitElementResult.release();
2712 _WebImpl::IsLoading(void) const
2714 double percent = ewk_view_load_progress_get(__pWebCore->GetWebNativeNode());
2716 if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
2728 _WebImpl::GetTextFromBlock(void) const
2730 return ewk_view_text_selection_text_get(__pWebCore->GetWebNativeNode());
2735 _WebImpl::IsPrivateBrowsingEnabled(void) const
2737 if (__pWebCore->GetWebNativeNode() == null)
2739 return _WebSettingImpl::GetInstance(__pWebSetting.get())->IsPrivateBrowsingEnabled();
2742 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
2743 SysAssertf(pSettings, "Failed to get webkit instance.");
2745 return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
2750 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
2752 if (__pWebCore->GetWebNativeNode() == null)
2754 _WebSettingImpl::GetInstance(__pWebSetting.get())->SetPrivateBrowsingEnabled(enable);
2758 Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
2759 SysAssertf(pSettings, "Failed to get webkit instance.");
2761 ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
2766 _WebImpl::ClearHistory(void)
2768 ewk_view_back_forward_list_clear(__pWebCore->GetWebNativeNode());
2773 _WebImpl::ClearCache(void)
2775 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2776 SysAssertf(pContext, "Failed to get webkit instance.");
2778 ewk_context_cache_clear(pContext);
2783 _WebImpl::ClearCookie(void)
2785 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2786 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
2787 SysAssertf(pCookieManager, "Failed to get webkit instance.");
2789 ewk_cookie_manager_cookies_clear(pCookieManager);
2794 _WebImpl::ClearFormData(void)
2796 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2797 SysAssertf(pContext, "Failed to get webkit instance.");
2799 ewk_context_form_candidate_data_clear(pContext);
2804 _WebImpl::ClearLoginFormData(void)
2806 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2807 SysAssertf(pContext, "Failed to get webkit instance.");
2809 ewk_context_form_password_data_clear(pContext);
2814 _WebImpl::IsCookieEnabled(void) const
2816 if (__pWebCore->GetWebNativeNode() == null)
2818 return _WebSettingImpl::GetInstance(__pWebSetting.get())->IsCookieEnabled();
2821 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2822 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
2823 SysAssertf(pCookieManager, "Failed to get webkit instance.");
2825 _WebPresenter presenter;
2826 presenter.InitAsyncProcess();
2828 ewk_cookie_manager_async_accept_policy_get(pCookieManager, OnCookiesPolicyGot, &presenter);
2830 bool result = false;
2831 presenter.WaitAsyncProcess(result);
2838 _WebImpl::SetCookieEnabled(bool enable)
2840 if (__pWebCore->GetWebNativeNode() == null)
2842 _WebSettingImpl::GetInstance(__pWebSetting.get())->SetCookiEnabled(enable);
2847 Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
2848 Ewk_Cookie_Manager* pCookieManager = ewk_context_cookie_manager_get(pContext);
2849 SysAssertf(pCookieManager, "Failed to get webkit instance.");
2853 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY);
2857 ewk_cookie_manager_accept_policy_set(pCookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
2858 ewk_cookie_manager_cookies_clear(pCookieManager);
2864 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
2866 result r = E_SUCCESS;
2868 std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
2869 SysTryReturn(NID_WEB_CTRL, pFilePath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2872 String fileExtension = File::GetFileExtension(filePath);
2873 int pathLength = filePath.GetLength();
2876 SysTryReturnResult(NID_WEB_CTRL, fileExtension.Equals("pdf", false), E_INVALID_ARG, "Invalid argument(s) is used. File extension is not pdf.");
2878 r = filePath.LastIndexOf(L"/", pathLength - 1, index);
2879 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
2880 r = filePath.SubString(0, index + 1, dirPath);
2881 SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_INVALID_ARG, "Invalid argument(s) is used. Directory path is invalid.");
2883 std::unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(dirPath));
2884 SysTryReturnResult(NID_WEB_CTRL, access(pDirPath.get(), W_OK) == 0, E_INACCESSIBLE_PATH, "Directory permission is read-only.");
2888 SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
2890 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), pSize->width, pSize->height, pFilePath.get());
2894 Evas_Coord contentsWidth;
2895 Evas_Coord contentsHeight;
2897 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &contentsWidth, &contentsHeight);
2898 ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), contentsWidth, contentsHeight, pFilePath.get());
2906 _WebImpl::IsMimeSupported(const String& mime) const
2908 std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
2909 SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2911 return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(__pWebCore->GetWebNativeNode()), pMime.get()));
2916 _WebImpl::SetLoadingListener(ILoadingListener* pLoadingListener)
2918 __pUserLoadingListener = const_cast< ILoadingListener* >(pLoadingListener);
2923 _WebImpl::SetWebUiEventListener(IWebUiEventListener* pUiEventListener)
2925 __pUserUiListener = pUiEventListener;
2930 _WebImpl::SetWebUiEventListenerF(IWebUiEventListenerF* pUiEventListener)
2932 __pUserUiListenerF = pUiEventListener;
2937 _WebImpl::SetWebKeypadEventListener(IWebKeypadEventListener* pKeypadEventListener)
2939 __pUserKeypadEventListener = pKeypadEventListener;
2944 _WebImpl::SetDownloadListener(IWebDownloadListener* pDownLoadListener)
2946 if (__pWebDownloadHandler.get() == null)
2948 __pWebDownloadHandler = std::unique_ptr<_WebDataHandler>(new (std::nothrow) _WebDataHandler());
2949 SysTryReturnVoidResult(NID_WEB_CTRL, __pWebDownloadHandler.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
2952 __pWebDownloadHandler->SetDownloadListener(pDownLoadListener);
2953 __pWebDownloadHandler->SetWebEvent(__pWebEvent.get());
2958 _WebImpl::SetTextSearchListener(ITextSearchListener* pTextSearchListener)
2960 __pTextSearchListener = pTextSearchListener;
2965 _WebImpl::SetScrollEnabled(bool enable)
2967 _WebSettingImpl::GetInstance(__pWebSetting.get())->SetScrollEnabled(enable);
2972 _WebImpl::IsScrollEnabled(void) const
2974 return _WebSettingImpl::GetInstance(__pWebSetting.get())->IsScrollEnabled();
2979 _WebImpl::InitJsBridgeList(void)
2981 result r = E_SUCCESS;
2983 __pJsProvider = std::unique_ptr<_JsBridgeHashCodeProvider>(new (std::nothrow) _JsBridgeHashCodeProvider());
2984 SysTryReturnResult(NID_WEB_CTRL, __pJsProvider.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
2986 __pJsComparer = std::unique_ptr<_JsBridgeComparer>(new (std::nothrow) _JsBridgeComparer());
2987 SysTryReturnResult(NID_WEB_CTRL, __pJsComparer.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
2989 std::unique_ptr<HashMapT< String, IJavaScriptBridge* > > pJsBridgeList(new (std::nothrow) HashMapT< String, IJavaScriptBridge* >);
2990 SysTryReturnResult(NID_WEB_CTRL, pJsBridgeList.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
2992 r = pJsBridgeList->Construct(0, 0, *__pJsProvider.get(), *__pJsComparer.get());
2993 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2995 __pJsBridgeList = std::move(pJsBridgeList);
3002 _WebImpl::AddJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3004 result r = E_SUCCESS;
3006 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3007 String key(pJsBridge->GetName());
3009 r = __pJsBridgeList->Add(key, pJsBridge);
3010 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3017 _WebImpl::RemoveJavaScriptBridge(const IJavaScriptBridge& jsBridge)
3019 result r = E_SUCCESS;
3021 IJavaScriptBridge* pJsBridge = const_cast< IJavaScriptBridge* >(&jsBridge);
3022 String key(pJsBridge->GetName());
3024 r = __pJsBridgeList->Remove(key);
3025 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3032 _WebImpl::FindJsInterface(const IJsonValue* pValue) const
3034 result r = E_SUCCESS;
3036 IJsonValue* pJsonValue = null;
3037 IJavaScriptBridge* pJsBridge = null;
3039 String key(L"name");
3041 const JsonObject* pJsonObject = dynamic_cast< const JsonObject* >(pValue);
3042 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));
3044 r = pJsonObject->GetValue(&key, pJsonValue);
3045 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS && pJsonValue, null, r, "[%s] Propagating.", GetErrorMessage(r));
3047 JsonString* pBridgeName = dynamic_cast< JsonString* >(pJsonValue);
3048 SysTryReturn(NID_WEB_CTRL, pBridgeName, null, E_INVALID_ARG, "[%s] Invalid argument(s) is used. name key is missing." , GetErrorMessage(E_INVALID_ARG));
3050 r = __pJsBridgeList->GetValue(static_cast< String >(*pBridgeName), pJsBridge);
3051 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3058 _WebImpl::GetLoadingListener(void) const
3060 return __pUserLoadingListener;
3064 IWebUiEventListener*
3065 _WebImpl::GetUiEventListener(void) const
3067 return __pUserUiListener;
3071 IWebUiEventListenerF*
3072 _WebImpl::GetUiEventListenerF(void) const
3074 return __pUserUiListenerF;
3078 IWebKeypadEventListener*
3079 _WebImpl::GetWebKeypadEventListener(void) const
3081 return __pUserKeypadEventListener;
3085 ITextSearchListener*
3086 _WebImpl::GetTextSearchListener(void) const
3088 return __pTextSearchListener;
3093 _WebImpl::SetEventListenerCallback(void) const
3095 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3098 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3099 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3101 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3102 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3104 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3105 SysAssertf(pSmartData, "Failed to request");
3107 Ewk_View_Smart_Class *pSmart = const_cast<Ewk_View_Smart_Class*>(pSmartData->api);
3108 SysAssertf(pSmart, "Failed to request");
3110 pSmart->popup_menu_show = OnSelectBoxRequested;
3111 pSmart->popup_menu_hide = OnSelectBoxClosed;
3112 pSmart->popup_menu_update = OnSelectBoxUpdateRequested;
3114 pSmart->input_picker_show = OnDatePickerProviderRequested;
3115 pSmart->input_picker_color_request = OnColorPickerProviderRequested;
3116 pSmart->input_picker_color_dismiss = OnColorPickerProviderDismissed;
3118 evas_object_data_set(pWebNativeNode, WEB_CTRL, this);
3120 // add loading event callbacks for ILoadingListener
3121 evas_object_smart_callback_add(pWebNativeNode, "create,window", OnWebWindowCreateRequested, this);
3122 evas_object_smart_callback_add(pWebNativeNode, "close,window", OnWebWindowClosedRequested, this);
3124 evas_object_smart_callback_add(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested, this);
3125 evas_object_smart_callback_add(pWebNativeNode, "load,started", OnLoadingStarted, this);
3126 evas_object_smart_callback_add(pWebNativeNode, "load,finished", OnLoadingCompleted, this);
3127 evas_object_smart_callback_add(pWebNativeNode, "load,progress", OnEstimatedProgress, this);
3128 evas_object_smart_callback_add(pWebNativeNode, "load,progress,finished", OnProgressCompleted, this);
3129 evas_object_smart_callback_add(pWebNativeNode, "load,stop", OnLoadingCanceled, this);
3130 evas_object_smart_callback_add(pWebNativeNode, "load,error", OnLoadingErrorOccurred, this);
3131 evas_object_smart_callback_add(pWebNativeNode, "title,changed", OnPageTitleReceived, this);
3132 evas_object_smart_callback_add(pWebNativeNode, "load,committed", OnLoadingCommitted, this);
3134 evas_object_smart_callback_add(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest, this);
3136 evas_object_smart_callback_add(pWinObject, "focus,in", OnWindowObjectFocusGained, this);
3138 evas_object_smart_callback_add(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged, this);
3139 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened, this);
3140 evas_object_smart_callback_add(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed, this);
3142 evas_object_smart_callback_add(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested, this);
3143 evas_object_smart_callback_add(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled, this);
3145 evas_object_smart_callback_add(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested, this);
3147 ewk_view_javascript_alert_callback_set(pWebNativeNode, OnScriptAlertRequested, const_cast< _WebImpl* >(this));
3148 ewk_view_javascript_prompt_callback_set(pWebNativeNode, OnScriptPromptRequested, const_cast< _WebImpl* >(this));
3149 ewk_view_javascript_confirm_callback_set(pWebNativeNode, OnScriptConfirmRequested, const_cast< _WebImpl* >(this));
3151 evas_object_smart_callback_add(pWebNativeNode, "policy,response,decide", OnWebDataReceived, this);
3153 evas_object_smart_callback_add(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested, this);
3154 evas_object_smart_callback_add(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested, this);
3155 evas_object_smart_callback_add(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted, this);
3157 evas_object_smart_callback_add(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested, this);
3158 evas_object_smart_callback_add(pWebNativeNode, "notification,show", OnNotificationShow, this);
3159 evas_object_smart_callback_add(pWebNativeNode, "notification,cancel", OnNotificationCancel, this);
3161 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested, this);
3162 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered, this);
3163 evas_object_smart_callback_add(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested, this);
3165 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested, this);
3166 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered, this);
3167 evas_object_smart_callback_add(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested, this);
3168 evas_object_smart_callback_add(pWebNativeNode, "text,found", OnTextFound, this);
3170 evas_object_smart_callback_add(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered, this);
3172 Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
3173 SysAssertf(pContext, "Failed to get webkit instance.");
3174 ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
3175 ewk_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(this));
3177 evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
3183 _WebImpl::RemoveEventListenerCallback(void) const
3185 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3188 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
3189 SysAssertf(pEcoreEvas, "Failed to get Ui ecore evas");
3191 Evas_Object* pWinObject = pEcoreEvas->GetWindowObject();
3192 SysAssertf(pWinObject, "Failed to get Ui window evas object");
3194 evas_object_smart_callback_del(pWebNativeNode, "create,window", OnWebWindowCreateRequested);
3195 evas_object_smart_callback_del(pWebNativeNode, "close,window", OnWebWindowClosedRequested);
3197 evas_object_smart_callback_del(pWebNativeNode, "policy,navigation,decide", OnLoadingRequested);
3198 evas_object_smart_callback_del(pWebNativeNode, "load,started", OnLoadingStarted);
3199 evas_object_smart_callback_del(pWebNativeNode, "load,finished", OnLoadingCompleted);
3200 evas_object_smart_callback_del(pWebNativeNode, "load,progress", OnEstimatedProgress);
3201 evas_object_smart_callback_del(pWebNativeNode, "load,progress,finished", OnProgressCompleted);
3202 evas_object_smart_callback_del(pWebNativeNode, "load,stop", OnLoadingCanceled);
3203 evas_object_smart_callback_del(pWebNativeNode, "load,error", OnLoadingErrorOccurred);
3204 evas_object_smart_callback_del(pWebNativeNode, "title,changed", OnPageTitleReceived);
3206 evas_object_smart_callback_del(pWebNativeNode, "requestToNative,json", OnHandleJavaScriptRequest);
3208 evas_object_smart_callback_del(pWinObject, "focus,in", OnWindowObjectFocusGained);
3210 evas_object_smart_callback_del(pWebNativeNode, "inputmethod,changed", OnWebKeypadStateChanged);
3211 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,opened", OnWebKeypadOpened);
3212 evas_object_smart_callback_del(pWebNativeNode, "editorclient,ime,closed", OnWebKeypadClosed);
3214 evas_object_smart_callback_del(pWebNativeNode, "authentication,challenge", OnHttpAuthenticationRequested);
3215 evas_object_smart_callback_del(pWebNativeNode, "authentication,canceled", OnHttpAuthenticationCanceled);
3217 evas_object_smart_callback_del(pWebNativeNode, "geolocation,permission,request", OnGeolocationPermissionRequested);
3219 ewk_view_javascript_alert_callback_set(null, null, null);
3220 ewk_view_javascript_prompt_callback_set(null, null, null);
3221 ewk_view_javascript_confirm_callback_set(null, null, null);
3223 evas_object_smart_callback_del(pWebNativeNode, "policy,response,decide", OnWebDataReceived);
3225 evas_object_smart_callback_del(pWebNativeNode, "load,nonemptylayout,finished", OnWebPageShowRequested);
3226 evas_object_smart_callback_del(pWebNativeNode, "request,certificate,confirm", OnCertificateRequested);
3227 evas_object_smart_callback_del(pWebNativeNode, "usermedia,permission,request", OnGetUserMediaPermissionRequsted);
3229 evas_object_smart_callback_del(pWebNativeNode, "notification,permission,request", OnNotificationPermissionRequested);
3230 evas_object_smart_callback_del(pWebNativeNode, "notification,show", OnNotificationShow);
3231 evas_object_smart_callback_del(pWebNativeNode, "notification,cancel", OnNotificationCancel);
3232 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,registration,requested", OnProtocolHandlerRegistrationRequested);
3233 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,isregistered", OnIsProtocolHandlerRegistered);
3234 evas_object_smart_callback_del(pWebNativeNode, "protocolhandler,unregistration,requested", OnProtocolHandlerUnregistrationRequested);
3236 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,registration,requested", OnContentHandlerRegistrationRequested);
3237 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,isregistered", OnIsContentHandlerRegistered);
3238 evas_object_smart_callback_del(pWebNativeNode, "contenthandler,unregistration,requested", OnContentHandlerUnregistrationRequested);
3240 evas_object_smart_callback_del(pWebNativeNode, "text,found", OnTextFound);
3242 evas_object_smart_callback_del(pWebNativeNode, "touchmove,handled", OnWebPreventDefaultTriggered);
3244 ewk_view_open_panel_callback_set(null, null, null);
3246 evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
3252 _WebImpl::SetBlockSelectionPosition(const Point& startPoint)
3254 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3256 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3257 SysAssertf(pSmartData, "Failed to request");
3259 Point absPoint(__pWebCore->GetAbsoluteCoordinate(startPoint));
3261 pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3262 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3264 ewk_view_command_execute(pWebNativeNode, "SelectWord", 0);
3266 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
3268 if (__pUserUiListener)
3270 FireWebPageBlockSelectedEvent();
3278 _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
3280 Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
3282 Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
3283 SysAssertf(pSmartData, "Failed to request");
3285 Point absPoint(__pWebCore->GetAbsoluteCoordinate(_CoordinateSystemUtils::ConvertToInteger(startPoint)));
3287 pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
3288 pSmartData->api->text_selection_up(pSmartData, absPoint.x, absPoint.y);
3290 ewk_view_command_execute(pWebNativeNode, "SelectWord", 0);
3292 SysTryReturnResult(NID_WEB_CTRL, GetTextFromBlock().GetLength() > 0, E_INVALID_ARG, "Failed to set text selection up.");
3294 if (__pUserUiListenerF)
3296 FireWebPageBlockSelectedEventF();
3304 _WebImpl::FireWebPageBlockSelectedEvent(void) const
3306 result r = E_SUCCESS;
3308 std::unique_ptr<Point> startPoint(new (std::nothrow) Point());
3309 std::unique_ptr<Point> endPoint(new (std::nothrow) Point());
3310 SysTryReturnVoidResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3312 GetBlockRange(*startPoint.get(), *endPoint.get());
3314 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED));
3315 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3317 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
3318 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3319 startPoint.release();
3321 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
3322 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3325 r = __pWebEvent->FireAsync(*pEventArg.get());
3326 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3327 pEventArg.release();
3332 _WebImpl::FireWebPageBlockSelectedEventF(void) const
3334 result r = E_SUCCESS;
3336 std::unique_ptr<FloatPoint> startPoint(new (std::nothrow) FloatPoint());
3337 std::unique_ptr<FloatPoint> endPoint(new (std::nothrow) FloatPoint());
3338 SysTryReturnVoidResult(NID_WEB_CTRL, startPoint.get() && endPoint.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3340 GetBlockRange(*startPoint.get(), *endPoint.get());
3342 std::unique_ptr<_WebUiEventArg> pEventArg(new (std::nothrow) _WebUiEventArg(WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT));
3343 SysTryReturnVoidResult(NID_WEB_CTRL, pEventArg.get(), E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3345 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_START, *startPoint.get());
3346 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3347 startPoint.release();
3349 r = pEventArg->SetEventInfo(_WebUiEventArg::BLOCK_END, *endPoint.get());
3350 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3353 r = __pWebEvent->FireAsync(*pEventArg.get());
3354 SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
3355 pEventArg.release();
3360 _WebImpl::ReleaseBlock(void)
3362 ewk_view_command_execute(__pWebCore->GetWebNativeNode(), "Unselect", 0);
3367 _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
3369 Eina_Rectangle leftHandle;
3370 Eina_Rectangle rightHandle;
3372 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
3374 startPoint.x = leftHandle.x;
3375 startPoint.y = leftHandle.y;
3376 endPoint.x = rightHandle.x + rightHandle.w;
3377 endPoint.y = rightHandle.y + rightHandle.h;
3379 if ((endPoint.x != 0) && (endPoint.y != 0))
3381 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
3382 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
3388 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
3390 Eina_Rectangle leftHandle;
3391 Eina_Rectangle rightHandle;
3393 ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle);
3395 startPoint.x = _CoordinateSystemUtils::ConvertToFloat(leftHandle.x);
3396 startPoint.y = _CoordinateSystemUtils::ConvertToFloat(leftHandle.y);
3397 endPoint.x = _CoordinateSystemUtils::ConvertToFloat(rightHandle.x + rightHandle.w);
3398 endPoint.y = _CoordinateSystemUtils::ConvertToFloat(rightHandle.y + rightHandle.h);
3400 if ((endPoint.x != 0) && (endPoint.y != 0))
3402 startPoint = __pWebCore->GetRelativeCoordinate(startPoint);
3403 endPoint = __pWebCore->GetRelativeCoordinate(endPoint);
3409 _WebImpl::GetFaviconN(void) const
3411 result r = E_SUCCESS;
3413 Evas_Object* pView = __pWebCore->GetWebNativeNode();
3415 Evas* pEvas = evas_object_evas_get(pView);
3416 Ewk_Context* pContext = ewk_view_context_get(pView);
3417 SysAssertf(pEvas && pContext, "Failed to request");
3419 const char* pUrl = ewk_view_url_get(pView);
3421 Tizen::Graphics::BufferInfo bufferInfo;
3422 Tizen::Base::ByteBuffer byteBuffer;
3424 std::unique_ptr<Bitmap> pBitmapImage(new (std::nothrow) Bitmap());
3425 SysTryReturn(NID_WEB_CTRL, pBitmapImage.get(), null, E_OUT_OF_MEMORY, "[%s] Memory Allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
3427 Evas_Object* pfavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
3428 SysTryReturn(NID_WEB_CTRL, pfavicon, null, E_OBJ_NOT_FOUND, "[%s] Propagating.", GetErrorMessage(E_OBJ_NOT_FOUND));
3430 r = _Utility::GetPixelBufferFromEvasObject(pfavicon, bufferInfo);
3431 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3433 const Dimension dimension(bufferInfo.width, bufferInfo.height);
3435 r = byteBuffer.Construct((byte*)bufferInfo.pPixels, 0, dimension.height * dimension.width * 32, dimension.height * dimension.width * 32 );
3436 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3438 r = pBitmapImage->Construct(byteBuffer, dimension, BITMAP_PIXEL_FORMAT_ARGB8888);
3439 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
3441 return pBitmapImage.release();
3447 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
3449 ewk_view_scroll_by(__pWebCore->GetWebNativeNode(), diff.x, diff.y);
3454 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
3456 ewk_view_scroll_set(__pWebCore->GetWebNativeNode(), dest.x, dest.y);
3461 _WebImpl::GetScrollPosition(void) const
3465 ewk_view_scroll_pos_get(__pWebCore->GetWebNativeNode(), &position.x, &position.y);
3472 _WebImpl::GetPageSize(void) const
3474 Evas_Coord width = 0;
3475 Evas_Coord height = 0;
3477 ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &width, &height);
3479 Dimension size(static_cast< int >(width), static_cast< int >(height));
3486 _WebImpl::SetLoadingErrorOccurred(bool arg)
3488 __isLoadingErrorOccurred = arg;
3493 _WebImpl::IsLoadingErrorOccurred(void) const
3495 return __isLoadingErrorOccurred;
3500 _WebImpl::SetRedirectRequested(bool arg)
3502 __isRedirectRequested = arg;
3507 _WebImpl::IsRedirectRequested(void) const
3509 return __isRedirectRequested;
3514 _WebImpl::SetPolicyDecision(DecisionPolicy policy)
3521 _WebImpl::GetPolicyDecision(void) const
3528 _WebImpl::LaunchAppControl(const IEventArg& arg)
3530 result r = E_SUCCESS;
3532 IEventArg* pArg = const_cast< IEventArg* >(&arg);
3533 _WebEventArg* pWebEventArg = dynamic_cast< _WebEventArg* >(pArg);
3534 SysTryReturnResult(NID_WEB_CTRL, pWebEventArg, E_INVALID_ARG, "Type casting failed. argument must be IEventArg type.");
3536 String operationId(L"");
3537 String uriPattern(pWebEventArg->GetEventMessage());
3538 SysLog(NID_WEB_CTRL, "The current value of web event type is %d", pWebEventArg->GetEventType());
3540 switch (pWebEventArg->GetEventType())
3542 case WEB_EVENT_REQUEST_RTSP:
3546 int uriLength = uriPattern.GetLength();
3549 operationId = L"http://tizen.org/appcontrol/operation/view";
3551 r = uriPattern.LastIndexOf(L".", uriLength - 1, index);
3552 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3554 r = uriPattern.SubString(index + 1, ext);
3555 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3557 r = _AppControlManager::GetMimeFromExt(ext, mimeType);
3558 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3560 r = _AppControlImpl::FindAndStart(operationId, &uriPattern, &mimeType, null, null, null);
3561 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3565 case WEB_EVENT_REQUEST_TEL:
3567 operationId = L"http://tizen.org/appcontrol/operation/dial";
3570 case WEB_EVENT_REQUEST_EMAIL:
3572 case WEB_EVENT_REQUEST_SMS:
3574 case WEB_EVENT_REQUEST_MMS:
3576 operationId = L"http://tizen.org/appcontrol/operation/compose";
3579 case WEB_EVENT_REQUEST_UNKNOWN:
3581 operationId = L"http://tizen.org/appcontrol/operation/view";
3589 r = _AppControlImpl::FindAndStart(operationId, &uriPattern, null, null, null, null);
3590 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3597 _WebImpl::SetFullScreenKeypad(void)
3599 result r = E_SUCCESS;
3601 std::unique_ptr<Keypad> pKeypad(new (std::nothrow) Keypad());
3602 SysTryReturnResult(NID_WEB_CTRL, pKeypad.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
3604 r = pKeypad->Construct(KEYPAD_STYLE_NORMAL, 100);
3605 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3607 String text(ewk_view_focused_input_element_value_get(__pWebCore->GetWebNativeNode()));
3608 pKeypad->SetText(text);
3610 r = pKeypad->SetShowState(true);
3611 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3613 r = pKeypad->Show();
3614 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
3616 pKeypad->AddTextEventListener(*this);
3618 __pKeypad = std::move(pKeypad);
3625 _WebImpl::RemoveFullScreenKeypad(void)
3627 __pKeypad->RemoveTextEventListener(*this);
3634 _WebImpl::IsFooterVisible(void) const
3636 return __isFooterVisible;
3641 _WebImpl::SetFooterVisibleState(bool isFooterVisible)
3643 __isFooterVisible = isFooterVisible;
3648 _WebImpl::IsKeypadVisible(void) const
3650 return __isKeypadVisible;
3655 _WebImpl::SetKeypadVisibleState(bool isKeypadVisible)
3657 __isKeypadVisible = isKeypadVisible;
3662 _WebImpl::IsKeypadOpened(void) const
3664 return __isKeypadOpened;
3668 _WebImpl::SetKeypadOpened(bool isKeypadOpened)
3670 __isKeypadOpened = isKeypadOpened;
3675 _WebImpl::GetPreviousKeypadBounds(void) const
3677 return __keypadBounds;
3682 _WebImpl::SetPreviousKeypadBounds(Rectangle& bounds)
3684 __keypadBounds = bounds;
3689 _WebImpl::OnTextValueChangeCanceled(const Control& source)
3691 RemoveFullScreenKeypad();
3696 _WebImpl::OnTextValueChanged(const Control& source)
3698 std::unique_ptr<char[]> pText(_StringConverter::CopyToCharArrayN(__pKeypad->GetText()));
3700 ewk_view_focused_input_element_value_set(__pWebCore->GetWebNativeNode(), pText.get());
3702 RemoveFullScreenKeypad();
3707 _WebImpl::OnHandleJavaScriptRequestByEventArg(const IEventArg& arg)
3709 const _JsBridgeArg* pEventArg = dynamic_cast< const _JsBridgeArg* >(&arg);
3710 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. arg is not _JsBridgeArg object.");
3712 std::unique_ptr<IJsonValue> pJsonValue(JsonParser::ParseN(*(pEventArg->GetJsonData())));
3713 SysTryReturn(NID_WEB_JSON, GetLastResult() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3715 IJavaScriptBridge* pJsInterface = FindJsInterface(pJsonValue.get());
3716 SysTryReturnResult(NID_WEB_CTRL, pJsInterface, E_OBJ_NOT_FOUND, "JsInterface instance is not available.");
3718 pJsInterface->HandleJavaScriptRequestN(pJsonValue.release());
3725 _WebImpl::OnHandleLoadingEvent(const IEventArg& arg)
3727 result r = E_SUCCESS;
3729 const _LoadingEventArg* pEventArg = dynamic_cast< const _LoadingEventArg* >(&arg);
3730 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
3732 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
3734 ILoadingListener* pLoadingListner = GetLoadingListener();
3735 SysTryReturnResult(NID_WEB_CTRL, pLoadingListner, E_SYSTEM, "A system error has been occurred. Loading listener was not set or null.");
3737 switch (pEventArg->GetEventType())
3739 case WEB_EVENT_LOADINGLISTENER_STARTED:
3741 pLoadingListner->OnLoadingStarted();
3745 case WEB_EVENT_LOADINGLISTENER_PROGRESS:
3747 const Integer* pProgressPercentage = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ESTIMATED_PROGRESS));
3748 SysTryReturn(NID_WEB_CTRL, pProgressPercentage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3750 pLoadingListner->OnEstimatedProgress(pProgressPercentage->ToInt());
3754 case WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED:
3756 const String* pPageTitle = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::PAGE_TITLE));
3757 SysTryReturn(NID_WEB_CTRL, pPageTitle, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3759 pLoadingListner->OnPageTitleReceived(*pPageTitle);
3763 case WEB_EVENT_LOADINGLISTENER_CANCELED:
3765 pLoadingListner->OnLoadingCanceled();
3769 case WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED:
3771 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_TYPE));
3772 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3774 const String* pErrorMessage = dynamic_cast< const String* >(pEventArg->GetEventInfo(_LoadingEventArg::ERROR_MESSAGE));
3775 SysTryReturn(NID_WEB_CTRL, pErrorMessage, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3777 LoadingErrorType errorType = ConvertErrorCode(pErrorType->ToInt());
3779 pLoadingListner->OnLoadingErrorOccurred(errorType, *pErrorMessage);
3783 case WEB_EVENT_LOADINGLISTENER_COMPLETED:
3785 pLoadingListner->OnLoadingCompleted();
3789 case WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED:
3791 pLoadingListner->OnHttpAuthenticationCanceled();
3806 _WebImpl::OnHandleWebDownloadEvent(const IEventArg& arg)
3808 result r = E_SUCCESS;
3810 const _WebDownloadEventArg* pEventArg = dynamic_cast< const _WebDownloadEventArg* >(&arg);
3811 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
3813 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
3815 IWebDownloadListener* pWebDownloadListener = __pWebDownloadHandler->GetDownloadListener();
3816 SysTryReturnResult(NID_WEB_CTRL, pWebDownloadListener, E_SYSTEM, "A system error has been occurred. Web Downloading listener was not set or null.");
3818 switch (pEventArg->GetEventType())
3820 case WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED:
3822 const ByteBuffer* pChunk = dynamic_cast< const ByteBuffer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::CHUNKED_DATA));
3823 SysTryReturn(NID_WEB_CTRL, pChunk, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3825 pWebDownloadListener->OnWebChunkedDataReceived(*pChunk);
3829 case WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED:
3831 pWebDownloadListener->OnWebDataDownloadCompleted();
3835 case WEB_EVENT_WEBDOWNLOADLISTENER_FAILED:
3837 const Integer* pErrorType = dynamic_cast< const Integer* >(pEventArg->GetEventInfo(_WebDownloadEventArg::ERROR_TYPE));
3838 SysTryReturn(NID_WEB_CTRL, pErrorType, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3840 LoadingErrorType errorType = static_cast < LoadingErrorType >(pErrorType->ToInt());
3842 pWebDownloadListener->OnWebDownloadFailed(errorType);
3857 _WebImpl::OnHandleWebUiEvent(const IEventArg& arg)
3859 result r = E_SUCCESS;
3861 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
3862 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
3864 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
3866 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListener, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
3868 switch (pEventArg->GetEventType())
3870 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED:
3872 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
3874 Point* pStartPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
3875 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3877 Point* pEndPoint = const_cast< Point* >(dynamic_cast< const Point* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
3878 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3880 __pUserUiListener->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
3884 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED:
3886 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
3888 __pUserUiListener->OnWebPageShowRequested(*pWeb);
3892 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED:
3894 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
3896 __pUserUiListener->OnWebWindowCloseRequested(*pWeb);
3900 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED:
3902 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
3904 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
3905 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3907 __pUserUiListener->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
3922 _WebImpl::OnHandleWebUiEventF(const IEventArg& arg)
3924 result r = E_SUCCESS;
3926 const _WebUiEventArg* pEventArg = dynamic_cast< const _WebUiEventArg* >(&arg);
3927 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
3929 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
3931 SysTryReturnResult(NID_WEB_CTRL, __pUserUiListenerF, E_SYSTEM, "A system error has been occurred. Web UI listener was not set or null.");
3933 switch (pEventArg->GetEventType())
3935 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT:
3937 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
3939 FloatPoint* pStartPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_START)));
3940 SysTryReturn(NID_WEB_CTRL, pStartPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3942 FloatPoint* pEndPoint = const_cast< FloatPoint* >(dynamic_cast< const FloatPoint* >(pEventArg->GetEventInfo(_WebUiEventArg::BLOCK_END)));
3943 SysTryReturn(NID_WEB_CTRL, pEndPoint, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3945 __pUserUiListenerF->OnWebPageBlockSelected(*pWeb, *pStartPoint, *pEndPoint);
3949 case WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT:
3951 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
3953 __pUserUiListenerF->OnWebPageShowRequested(*pWeb);
3957 case WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT:
3959 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
3961 __pUserUiListenerF->OnWebWindowCloseRequested(*pWeb);
3965 case WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT:
3967 Web* pWeb = dynamic_cast< Web* >(&(this->GetPublic()));
3969 Boolean* pTrigger = const_cast< Boolean* >(dynamic_cast< const Boolean* >(pEventArg->GetEventInfo(_WebUiEventArg::PREVENT_DEFAULT)));
3970 SysTryReturn(NID_WEB_CTRL, pTrigger, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
3972 __pUserUiListenerF->OnWebPreventDefaultTriggered(*pWeb, pTrigger->ToBool());
3987 _WebImpl::OnHandleTextSearchEvent(const IEventArg& arg)
3989 result r = E_SUCCESS;
3991 const _TextSearchEventArg* pEventArg = dynamic_cast< const _TextSearchEventArg* >(&arg);
3992 SysTryReturnResult(NID_WEB_CTRL, pEventArg, E_INVALID_ARG, "Invalid argument(s) is used. Type casting failed. argument must be IEventArg type.");
3994 SysLog(NID_WEB_CTRL, "The current value of event type is %d", pEventArg->GetEventType());
3996 ITextSearchListener* pTextSearchListner = GetTextSearchListener();
3997 SysTryReturnResult(NID_WEB_CTRL, pTextSearchListner, E_SYSTEM, "A system error has been occurred. Web text search listener was not set or null.");
3999 switch (pEventArg->GetEventType())
4001 case WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND:
4003 Integer* pTotalCount= dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::TOTAL_COUNT)));
4004 SysTryReturn(NID_WEB_CTRL, pTotalCount, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4006 Integer* pCurrentOrdinal = dynamic_cast< Integer* >(const_cast< Object* >(pEventArg->GetEventInfo(_TextSearchEventArg::CURRENT_ORDINAL)));
4007 SysTryReturn(NID_WEB_CTRL, pCurrentOrdinal, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4009 pTextSearchListner->OnTextFound(pTotalCount->ToInt(), pCurrentOrdinal->ToInt());
4024 _WebImpl::HttpAuthenticationRequested(Ewk_Auth_Challenge* pChallenge)
4026 result r = E_SUCCESS;
4028 String host(ewk_auth_challenge_url_get(pChallenge));
4029 String realm(ewk_auth_challenge_realm_get(pChallenge));
4031 __pAuthChallenge.reset();
4033 std::unique_ptr<AuthenticationChallenge> pAuthChallenge(new (std::nothrow) AuthenticationChallenge());
4034 SysTryReturnResult(NID_WEB_CTRL, pAuthChallenge, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4036 _AuthenticationChallengeImpl* pAuthImpl = _AuthenticationChallengeImpl::GetInstance(pAuthChallenge.get());
4037 SysTryReturn(NID_WEB_CTRL, pAuthImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4039 pAuthImpl->SetAuthenticationChallengeHandler(pChallenge);
4040 pAuthImpl->SetWebEvasObject(__pWebCore->GetWebNativeNode());
4042 __pAuthChallenge = std::move(pAuthChallenge);
4044 ewk_auth_challenge_suspend(pChallenge);
4045 if (__pUserLoadingListener && __pUserLoadingListener->OnHttpAuthenticationRequestedN(host, realm, *__pAuthChallenge.get()))
4047 __pAuthChallenge.release();
4051 r = ShowAuthenticationPopup(host, realm, __pAuthChallenge.get());
4052 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4060 _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, AuthenticationChallenge* pAuthChallenge)
4062 result r = E_SUCCESS;
4064 std::unique_ptr<_AuthConfirmPopup> pAuthPopup(new (std::nothrow) _AuthConfirmPopup());
4065 SysTryReturnResult(NID_WEB_CTRL, pAuthPopup, E_OUT_OF_MEMORY, "Memory Allocation failed.");
4067 r = pAuthPopup->Construct(host, realm, pAuthChallenge);
4068 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4070 __pAuthPopup = std::move(pAuthPopup);
4072 int modalResult = 0;
4073 r = __pAuthPopup->ShowAndWait(modalResult);
4074 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4077 __pAuthPopup.reset();
4084 _WebImpl::ShowGeolocationPopup(Ewk_Geolocation_Permission_Request* pPermissionRequest)
4086 result r = E_SUCCESS;
4088 std::unique_ptr<_GeolocationConfirmPopup> pGeolocationPopup(new (std::nothrow) _GeolocationConfirmPopup());
4089 SysTryReturnResult(NID_WEB_CTRL, pGeolocationPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4091 r = pGeolocationPopup->Construct(pPermissionRequest);
4092 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4094 __pGeolocationPopup = std::move(pGeolocationPopup);
4096 r = __pGeolocationPopup->ShowPopup();
4097 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4099 __pGeolocationPopup.release();
4104 __pGeolocationPopup.reset();
4111 _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy)
4113 result r = E_SUCCESS;
4115 std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
4116 SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
4118 r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy);
4119 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4121 __pUserConfirmPopup = std::move(pUserConfirmPopup);
4123 r = __pUserConfirmPopup->ShowPopup();
4124 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4126 __pUserConfirmPopup.release();
4131 __pUserConfirmPopup.reset();
4138 _WebImpl::GetParentFormCore(_Control* pControlCore)
4141 _Form* pFormCore = null;
4143 _Control* pParentControlCore = dynamic_cast< _Control* >(pControlCore->GetParent());
4145 if (pParentControlCore == null)
4147 _Window* pWindowCore = dynamic_cast< _Window* >(pControlCore);
4148 SysAssertf(pWindowCore, "Failed to get parent control and window core.");
4149 pFormCore = dynamic_cast< _Form* >(pWindowCore->GetOwner());
4150 if (pFormCore == null)
4152 pParentControlCore = dynamic_cast< _Control* >(pWindowCore->GetOwner());
4153 SysTryReturn(NID_WEB_CTRL, pParentControlCore, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
4158 pFormCore = dynamic_cast< _Form* >(pParentControlCore);
4161 if (pFormCore != null)
4166 return GetParentFormCore(pParentControlCore);
4171 _WebImpl::OnFocusGained(const _ControlImpl& source)
4178 _WebImpl::OnFocusLost(const _ControlImpl& source)
4180 if(IsKeypadVisible() == true)
4182 SetKeypadOpened(true);
4185 evas_object_focus_set(__pWebCore->GetWebNativeNode(), EINA_FALSE);
4192 _WebImpl::HasValidNativeNode(void) const
4194 if (__pWebCore && __pWebCore->GetWebNativeNode())
4204 _WebImpl::OnAttachedToMainTree(void)
4206 result r = E_SUCCESS;
4208 r = __pWebCore->InitializeWebNativeNode();
4209 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4211 r = InitializeSetting();
4212 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4214 r = _ContainerImpl::OnAttachedToMainTree();
4215 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4222 _WebImpl::OnChangeLayout(_ControlOrientation orientation)
4224 _ContainerImpl::OnChangeLayout(orientation);
4226 if (IsKeypadVisible() == true)
4232 ecore_imf_context_input_panel_geometry_get(ecore_imf_context_add(ecore_imf_context_default_id_get()), &x, &y, &w, &h);
4234 _Form* pFormCore = GetParentFormCore(dynamic_cast< _Control* >(&this->GetCore()));
4235 SysAssertf(pFormCore != null, "Failed to get FormCore");
4237 pFormCore->DeflateClientRectHeight(h);
4240 if (__pColorPicker.get())
4242 __pColorPicker->ChangeLayout(orientation);
4248 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
4250 if (IsVisible() == true)
4252 ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
4256 ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
4262 _WebImpl::GetDownloadHandler(void) const
4264 return __pWebDownloadHandler.get();
4269 _WebImpl::HideColorPicker(void)
4271 __pColorPicker.reset();
4278 _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color)
4280 result r = E_SUCCESS;
4282 std::unique_ptr<_InputPickerPopup> pColorHadler(new (std::nothrow) _InputPickerPopup());
4283 SysTryReturnResult(NID_WEB_CTRL, pColorHadler.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4285 Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha));
4287 r = pColorHadler->Construct(colorVal);
4288 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4290 __pColorPicker = std::move(pColorHadler);
4292 r = __pColorPicker->ShowPopup();
4293 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4295 color = __pColorPicker->GetColor();
4300 __pColorPicker.reset();
4307 _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, String& dateStr)
4309 result r = E_SUCCESS;
4311 std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup());
4312 SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
4314 r = pInputPicker->Construct(String(inputValue), inputType);
4315 SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
4317 __pDatePicker = std::move(pInputPicker);
4319 r = __pDatePicker->ShowPopup();
4320 SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
4322 dateStr = __pDatePicker->GetDate();
4325 __pDatePicker.reset();
4332 _WebImpl::GetInstance(Web* pWeb)
4334 return dynamic_cast< _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
4339 _WebImpl::GetInstance(const Web* pWeb)
4341 return dynamic_cast< const _WebImpl* >(_ControlImpl::GetInstance(*pWeb));
4345 }}} // Tizen::Web::Controls