2 Copyright (C) 2011 Samsung Electronics
3 Copyright (C) 2012 Intel Corporation. All rights reserved.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
24 #include "EwkViewImpl.h"
25 #include "FindClientEfl.h"
26 #include "FormClientEfl.h"
27 #include "LayerTreeCoordinatorProxy.h"
28 #include "InputMethodContextEfl.h"
29 #include "NativeWebKeyboardEvent.h"
30 #include "NativeWebMouseEvent.h"
31 #include "NativeWebWheelEvent.h"
32 #include "PageClientImpl.h"
33 #include "PageLoadClientEfl.h"
34 #include "PagePolicyClientEfl.h"
35 #include "PageUIClientEfl.h"
36 #include "ResourceLoadClientEfl.h"
37 #include "WKAPICast.h"
38 #include "WKEinaSharedString.h"
39 #include "WKFindOptions.h"
40 #include "WKRetainPtr.h"
42 #include "WebContext.h"
44 #include "WebPageGroup.h"
45 #include "WebPopupItem.h"
46 #include "WebPopupMenuProxyEfl.h"
47 #include "WebPreferences.h"
48 #include "ewk_back_forward_list_private.h"
49 #include "ewk_context.h"
50 #include "ewk_context_private.h"
51 #include "ewk_favicon_database_private.h"
52 #include "ewk_intent_private.h"
53 #include "ewk_popup_menu_item_private.h"
54 #include "ewk_private.h"
55 #include "ewk_settings_private.h"
56 #include "ewk_view_private.h"
57 #include <Ecore_Evas.h>
59 #include <WebKit2/WKPageGroup.h>
60 #include <wtf/text/CString.h>
62 #if ENABLE(FULLSCREEN_API)
63 #include "WebFullScreenManagerProxy.h"
66 #if ENABLE(TIZEN_WEBKIT2_DDK_CHECK)
73 #include "DrawingAreaProxyImpl.h"
76 #include "WKDownload.h"
78 #include "WKGeolocationPermissionRequest.h"
79 #include "WKImageCairo.h"
80 #include "WKOpenPanelParameters.h"
81 #include "WKOpenPanelResultListener.h"
83 #include "WKPageGroup.h"
85 #include "WKPageTizen.h"
86 #include "WKPreferences.h"
87 #include "WKSerializedScriptValue.h"
89 #include "WKURLRequest.h"
90 #include "ewk_context_menu_private.h"
91 #include "ewk_error.h"
92 #include "ewk_error_private.h"
93 #include "ewk_history_private.h"
94 #include "ewk_popup_menu_item.h"
95 #include "ewk_popup_menu_item_private.h"
96 #include "ewk_view_context_menu_client.h"
97 #include "ewk_view_icondatabase_client.h"
98 #include "ewk_view_tizen_client.h"
100 #include <Elementary.h>
101 #include <WebCore/EflScreenUtilities.h>
102 #include <WebCore/NotImplemented.h>
105 #if ENABLE(TIZEN_ICON_DATABASE)
106 #include "WKContextPrivate.h"
109 #if ENABLE(TIZEN_GEOLOCATION)
110 #include "ewk_geolocation_private.h"
111 #include "ewk_security_origin.h"
112 #include "ewk_view_geolocation_provider.h"
115 #if ENABLE(TOUCH_EVENTS)
116 #include "NativeWebTouchEvent.h"
117 #include "WebEvent.h"
120 #if ENABLE(TIZEN_ISF_PORT)
121 #include <Ecore_IMF.h>
124 #if ENABLE(TIZEN_NOTIFICATIONS)
126 #include "WKNotificationManager.h"
127 #include "WKNumber.h"
128 #include "ewk_notification_private.h"
129 #include "ewk_view_notification_provider.h"
132 #if ENABLE(TIZEN_MEDIA_STREAM)
133 #include "WKUserMediaPermissionRequest.h"
134 #include "ewk_user_media_private.h"
137 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
138 #include "WebPageGroup.h"
139 #include "WebPreferences.h"
142 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
143 #include "ewk_hit_test_private.h"
146 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
147 #include "ewk_text_style.h"
150 #if ENABLE(TIZEN_SCREEN_READER)
151 #include "ScreenReaderProxy.h"
154 #if ENABLE(TIZEN_CSP)
155 #include <WebCore/ContentSecurityPolicy.h>
158 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
159 #include "WKDictionary.h"
160 #include "ewk_web_application_icon_data_private.h"
162 #endif // #if OS(TIZEN)
164 using namespace WebKit;
165 using namespace WebCore;
167 static const char EWK_VIEW_TYPE_STR[] = "EWK2_View";
169 #define EWK_VIEW_TYPE_CHECK(ewkView, result) \
170 bool result = true; \
173 EINA_LOG_CRIT("null is not a ewk_view"); \
177 const char* _tmp_otype = evas_object_type_get(ewkView); \
178 const Evas_Smart* _tmp_s = evas_object_smart_smart_get(ewkView); \
179 if (EINA_UNLIKELY(!_tmp_s)) { \
181 ("%p (%s) is not a smart object!", \
182 ewkView, _tmp_otype ? _tmp_otype : "(null)"); \
186 const Evas_Smart_Class* _tmp_sc = evas_smart_class_get(_tmp_s); \
187 if (EINA_UNLIKELY(!_tmp_sc)) { \
189 ("%p (%s) is not a smart object!", \
190 ewkView, _tmp_otype ? _tmp_otype : "(null)"); \
194 else if (EINA_UNLIKELY(_tmp_sc->data != EWK_VIEW_TYPE_STR)) { \
196 ("%p (%s) is not of an ewk_view (need %p, got %p)!", \
197 ewkView, _tmp_otype ? _tmp_otype : "(null)", \
198 EWK_VIEW_TYPE_STR, _tmp_sc->data); \
203 #define EWK_VIEW_SD_GET(ewkView, smartData) \
204 EWK_VIEW_TYPE_CHECK(ewkView, _tmp_result); \
205 Ewk_View_Smart_Data* smartData = 0; \
207 smartData = (Ewk_View_Smart_Data*)evas_object_smart_data_get(ewkView)
209 #define EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, ...) \
210 EWK_VIEW_SD_GET(ewkView, smartData); \
213 EINA_LOG_CRIT("no smart data for object %p (%s)", \
214 ewkView, evas_object_type_get(ewkView)); \
215 return __VA_ARGS__; \
220 static Eina_Bool _ewk_view_default_javascript_alert(Evas_Object*, const char* alertText, void* userData);
221 static Eina_Bool _ewk_view_default_javascript_confirm(Evas_Object*, const char* message, void* userData);
222 static Eina_Bool _ewk_view_default_javascript_prompt(Evas_Object*, const char* message, const char* defaultValue, void* userData);
223 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
224 static Eina_Bool _ewk_view_default_before_unload_confirm_panel(Evas_Object*, const char* message, void* userData);
226 static Eina_Bool _ewk_view_default_open_panel(Evas_Object*, Eina_Bool allow_multiple_files, Eina_List *accepted_mime_types, const char* capture, void* userData);
228 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
229 Eina_Bool _ewk_view_popup_menu_show(Ewk_View_Smart_Data*, Eina_Rectangle, Ewk_Text_Direction, double page_scale_factor, Eina_List* items, int selectedIndex);
230 #if ENABLE(TIZEN_MULTIPLE_SELECT)
231 Eina_Bool _ewk_view_multiple_popup_menu_show(Ewk_View_Smart_Data*, Eina_Rectangle, Ewk_Text_Direction, double page_scale_factor, Eina_List* items);
233 Eina_Bool _ewk_view_popup_menu_hide(Ewk_View_Smart_Data*);
234 Eina_Bool _ewk_view_popup_menu_update(Ewk_View_Smart_Data*, Eina_Rectangle, Ewk_Text_Direction, Eina_List*, int);
236 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
237 Eina_Bool _ewk_orientation_lock(Ewk_View_Smart_Data *sd, int orientations);
238 void _ewk_orientation_unlock(Ewk_View_Smart_Data *sd);
241 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
242 static Eina_Bool _ewk_view_input_picker_show(Ewk_View_Smart_Data*, Ewk_Input_Type, const char* inputValue);
245 #if ENABLE(TIZEN_DATALIST_ELEMENT)
246 static Eina_Bool _ewk_view_data_list_show(Ewk_View_Smart_Data*, Ewk_Input_Type, Eina_List*);
247 static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data*, Ewk_Input_Type);
250 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
251 static Eina_Bool _ewk_input_picker_color_request(Ewk_View_Smart_Data*, int, int, int, int);
252 static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data*);
254 #endif // #if OS(TIZEN)
256 static void _ewk_view_smart_changed(Ewk_View_Smart_Data* smartData)
258 if (smartData->changed.any)
260 smartData->changed.any = true;
261 evas_object_smart_changed(smartData->self);
264 #if !ENABLE(TIZEN_ICON_DATABASE)
265 static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo)
267 Evas_Object* ewkView = static_cast<Evas_Object*>(eventInfo);
268 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
269 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
271 const char* viewURL = ewk_view_url_get(ewkView);
272 if (!viewURL || strcasecmp(viewURL, pageURL))
275 impl->informIconChange();
279 // Default Event Handling.
280 static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData)
282 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
286 impl->pageClient->setViewFocused(true);
287 #endif // #if OS(TIZEN)
288 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
289 #if ENABLE(TIZEN_ISF_PORT)
290 if (impl->inputMethodContext())
291 impl->inputMethodContext()->onFocusIn();
296 static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData)
298 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
302 #if ENABLE(TIZEN_ISF_PORT)
303 // Keypad should be hidden rapidly when moving focus on elementary
304 // because Ecore-ime doesn't support it.
305 if (impl->inputMethodContext())
306 impl->inputMethodContext()->onFocusOut();
309 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
310 if (impl->pageClient->isTextSelectionMode())
311 impl->pageClient->setIsTextSelectionMode(false);
314 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
315 if (impl->pageClient->isContextMenuVisible())
316 impl->pageProxy->hideContextMenu();
319 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
320 if (impl->pageClient->isClipboardWindowOpened())
321 impl->pageClient->closeClipboardWindow();
324 #if ENABLE(TIZEN_DRAG_SUPPORT)
325 if (impl->pageClient->isDragMode())
326 impl->pageClient->setDragMode(false);
329 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
330 if (smartData->api->formdata_candidate_is_showing(smartData))
331 smartData->api->formdata_candidate_hide(smartData);
334 impl->pageClient->setViewFocused(false);
335 #endif // #if OS(TIZEN)
336 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
340 static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent)
342 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
344 impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen()));
348 static Eina_Bool _ewk_view_smart_mouse_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Down* downEvent)
350 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
352 impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen()));
356 static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Up* upEvent)
358 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
360 impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen()));
362 InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
363 if (inputMethodContext)
364 inputMethodContext->handleMouseUpEvent(upEvent);
369 static Eina_Bool _ewk_view_smart_mouse_move(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Move* moveEvent)
371 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
373 // FIXME: impl->page() is used in the webkit opensource, but tizen webkit does not use it yet.
374 impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen()));
378 static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Down* downEvent)
380 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
382 bool isFiltered = false;
383 InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
384 if (inputMethodContext)
385 inputMethodContext->handleKeyDownEvent(downEvent, &isFiltered);
387 impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered));
391 static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Up* upEvent)
393 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
395 impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent));
400 static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
402 #if ENABLE(TIZEN_GESTURE)
403 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
405 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
406 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
410 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
411 if (impl->focusRing) {
412 if (event->type == EWK_GESTURE_TAP && event->count == 1) {
413 impl->focusRing->requestToShow(IntPoint(event->position.x, event->position.y));
414 } else if (event->type == EWK_GESTURE_PAN) {
415 if (impl->exceedTouchMoveThreshold)
416 impl->focusRing->hide();
418 if (event->type != EWK_GESTURE_LONG_PRESS) {
419 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
420 if (!impl->pageClient->isContextMenuVisible())
422 impl->focusRing->hide();
428 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
429 if (smartData->api->formdata_candidate_is_showing(smartData))
430 smartData->api->formdata_candidate_hide(smartData);
433 switch (event->type) {
434 case EWK_GESTURE_TAP:
435 impl->gestureClient->startTap(IntPoint(event->position.x, event->position.y));
437 case EWK_GESTURE_LONG_PRESS: {
438 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
439 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
440 if (ewk_settings_text_selection_enabled_get(impl->settings()))
441 impl->pageClient->setIsTextSelectionMode(false);
443 IntPoint scenePoint(event->position.x, event->position.y);
444 IntPoint contentsPoint = impl->transformFromScene().mapPoint(scenePoint);
445 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(contentsPoint);
446 #if ENABLE(TIZEN_DRAG_SUPPORT)
447 // 1. Check to start dragging.
448 if (hitTestResultData.isDragSupport) {
449 impl->pageClient->setDragPoint(scenePoint);
450 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
452 impl->focusRing->show(IntRect(), true);
454 impl->gestureClient->showContextMenu(scenePoint);
458 // 2. Check to show context menu.
459 if (!hitTestResultData.absoluteImageURL.isEmpty()
460 || !hitTestResultData.absoluteLinkURL.isEmpty()
461 || !hitTestResultData.absoluteMediaURL.isEmpty()) {
462 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
464 impl->focusRing->show(IntRect(), true);
466 impl->gestureClient->showContextMenu(scenePoint);
469 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
470 // 3. Check for text selection.
471 if (ewk_settings_text_selection_enabled_get(impl->settings())) {
472 // Process gesture_end(EWK_GESTURE_TAP) to activate the editing if node under point is editable.
473 if (hitTestResultData.context & WebHitTestResult::HitTestResultContextEditable) {
474 if (smartData->api && smartData->api->gesture_end) {
475 Ewk_Event_Gesture tapEvent = {EWK_GESTURE_TAP, event->position, {0, 0}, 0, 1, ecore_time_get() * 1000};
476 smartData->api->gesture_end(smartData, &tapEvent);
480 if (impl->pageClient->textSelectionDown(scenePoint)) {
481 impl->gestureClient->setGestureEnabled(false);
482 impl->feedTouchEventsByType(EWK_TOUCH_CANCEL);
487 #endif // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
489 case EWK_GESTURE_PAN:
490 impl->gestureClient->startPan(IntPoint(event->position.x, event->position.y));
492 case EWK_GESTURE_FLICK:
493 impl->gestureClient->startFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y));
495 case EWK_GESTURE_PINCH:
496 if (impl->pageClient->viewportConstraints().userScalable)
497 impl->gestureClient->startPinch(IntPoint(event->position.x, event->position.y), event->scale);
500 ASSERT_NOT_REACHED();
507 #endif // #if ENABLE(TIZEN_GESTURE)
510 static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
512 #if ENABLE(TIZEN_GESTURE)
513 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
515 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
516 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
520 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
521 if (impl->focusRing) {
522 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
523 if (!impl->pageClient->isContextMenuVisible())
525 impl->focusRing->hide();
529 switch (event->type) {
530 case EWK_GESTURE_TAP:
531 if (event->count == 1) {
532 #if ENABLE(TIZEN_DRAG_SUPPORT)
533 if (impl->pageClient->isDragMode())
534 impl->pageClient->setDragMode(false);
536 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
537 if (impl->pageClient->isTextSelectionMode())
538 impl->pageClient->setIsTextSelectionMode(false);
541 #if ENABLE(TIZEN_ISF_PORT)
542 if (impl->inputMethodContext()->isIMEPostion(event->position.x, event->position.y))
546 impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
547 #if ENABLE(TIZEN_ISF_PORT)
548 evas_object_focus_set(smartData->self, true);
550 } else if (event->count == 2)
551 impl->gestureClient->endDoubleTap(IntPoint(event->position.x, event->position.y));
553 case EWK_GESTURE_LONG_PRESS:
554 #if ENABLE(TIZEN_DRAG_SUPPORT)
555 if (impl->pageClient->isDragMode())
556 impl->pageClient->setDragMode(false);
558 // Prcess endTap for LONG_PRESS gesture if text-selection and context menu did not work
559 impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
561 case EWK_GESTURE_PAN:
562 impl->gestureClient->endPan(IntPoint(event->position.x, event->position.y));
564 case EWK_GESTURE_FLICK:
565 impl->gestureClient->endFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y));
567 case EWK_GESTURE_PINCH:
568 impl->gestureClient->endPinch(IntPoint(event->position.x, event->position.y), event->scale);
571 ASSERT_NOT_REACHED();
578 #endif // #if ENABLE(TIZEN_GESTURE)
581 static Eina_Bool _ewk_view_smart_gesture_move(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
583 #if ENABLE(TIZEN_GESTURE)
584 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
586 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
587 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
591 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
592 if (impl->focusRing && !(event->type == EWK_GESTURE_PAN && !impl->exceedTouchMoveThreshold))
593 impl->focusRing->hide();
596 switch (event->type) {
597 case EWK_GESTURE_PAN:
598 impl->gestureClient->movePan(IntPoint(event->position.x, event->position.y));
600 case EWK_GESTURE_TAP:
601 case EWK_GESTURE_LONG_PRESS:
602 case EWK_GESTURE_FLICK:
604 case EWK_GESTURE_PINCH:
605 if (impl->pageClient->viewportConstraints().userScalable)
606 impl->gestureClient->movePinch(IntPoint(event->position.x, event->position.y), event->scale);
609 ASSERT_NOT_REACHED();
616 #endif // #if ENABLE(TIZEN_GESTURE)
618 #endif //#if OS(TIZEN)
621 static void _ewk_view_on_focus_in(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
623 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
624 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
625 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_in);
626 smartData->api->focus_in(smartData);
629 static void _ewk_view_on_focus_out(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
631 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
632 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
633 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_out);
634 smartData->api->focus_out(smartData);
637 static void _ewk_view_on_mouse_wheel(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
639 Evas_Event_Mouse_Wheel* wheelEvent = static_cast<Evas_Event_Mouse_Wheel*>(eventInfo);
640 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
641 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
642 EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_wheel);
643 smartData->api->mouse_wheel(smartData, wheelEvent);
646 static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo)
648 Evas_Event_Key_Down* downEvent = static_cast<Evas_Event_Key_Down*>(eventInfo);
649 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
650 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
651 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_down);
652 smartData->api->key_down(smartData, downEvent);
655 static void _ewk_view_on_key_up(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
657 Evas_Event_Key_Up* upEvent = static_cast<Evas_Event_Key_Up*>(eventInfo);
658 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
659 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
660 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_up);
661 smartData->api->key_up(smartData, upEvent);
664 static void _ewk_view_on_show(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
666 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
667 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
668 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
671 static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
673 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
674 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
676 // This call may look wrong, but we really need to pass ViewIsVisible here.
677 // viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden
678 // depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process.
679 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
683 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
684 Eina_Bool _ewk_view_text_selection_down(Ewk_View_Smart_Data* smartData, int x, int y)
686 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
688 return impl->pageClient->textSelectionDown(IntPoint(x, y), true);
691 Eina_Bool _ewk_view_text_selection_move(Ewk_View_Smart_Data* smartData, int x, int y)
693 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
695 IntPoint point(x, y);
696 impl->pageClient->textSelectionMove(point, true);
701 Eina_Bool _ewk_view_text_selection_up(Ewk_View_Smart_Data* smartData, int x, int y)
703 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
705 IntPoint point(x, y);
706 impl->pageClient->textSelectionUp(point, true);
712 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
713 Eina_Bool _ewk_view_smart_formdata_candidate_show(Ewk_View_Smart_Data* smartData, int x, int y, int w, int h)
715 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
717 impl->pageClient->showFormDataCandidate(IntRect(x, y, w, h));
722 Eina_Bool _ewk_view_smart_formdata_candidate_hide(Ewk_View_Smart_Data* smartData)
724 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
726 impl->pageClient->hideFormDataCandidate();
731 Eina_Bool _ewk_view_smart_formdata_candidate_update_data(Ewk_View_Smart_Data* smartData, Eina_List* dataList)
733 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
735 Vector<String> formData;
738 EINA_LIST_FOREACH(dataList, list, data)
739 formData.append(String::fromUTF8(static_cast<char*>(data)));
741 impl->pageClient->updateFormDataCandidate(formData);
746 Eina_Bool _ewk_view_smart_formdata_candidate_is_showing(Ewk_View_Smart_Data* smartData)
748 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
750 return impl->pageClient->isShowingFormDataCandidate();
754 #if ENABLE(TIZEN_SCREEN_READER)
755 Eina_Bool _ewk_view_screen_reader_command_execute(Ewk_View_Smart_Data* smartData, unsigned int command, int data1, int data2)
757 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
759 return ScreenReaderProxy::screenReader().executeCommand(impl, command, data1, data2);
762 #endif // #if OS(TIZEN)
764 static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL;
766 static void _ewk_view_impl_del(EwkViewImpl* impl)
768 #if !ENABLE(TIZEN_ICON_DATABASE)
769 /* Unregister icon change callback */
770 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();
771 iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed);
777 static void _ewk_view_smart_add(Evas_Object* ewkView)
779 const Evas_Smart* smart = evas_object_smart_smart_get(ewkView);
780 const Evas_Smart_Class* smartClass = evas_smart_class_get(smart);
781 const Ewk_View_Smart_Class* api = reinterpret_cast<const Ewk_View_Smart_Class*>(smartClass);
782 EWK_VIEW_SD_GET(ewkView, smartData);
785 smartData = static_cast<Ewk_View_Smart_Data*>(calloc(1, sizeof(Ewk_View_Smart_Data)));
787 EINA_LOG_CRIT("could not allocate Ewk_View_Smart_Data");
790 evas_object_smart_data_set(ewkView, smartData);
793 smartData->self = ewkView;
794 smartData->api = api;
796 g_parentSmartClass.add(ewkView);
798 smartData->priv = new EwkViewImpl(ewkView);
799 if (!smartData->priv) {
800 EINA_LOG_CRIT("could not allocate EwkViewImpl");
801 evas_object_smart_data_set(ewkView, 0);
806 // Create evas_object_image to draw web contents.
807 smartData->image = evas_object_image_add(smartData->base.evas);
808 evas_object_image_alpha_set(smartData->image, false);
809 evas_object_image_filled_set(smartData->image, true);
810 evas_object_smart_member_add(smartData->image, ewkView);
813 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
814 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
815 const char *engine = ecore_evas_engine_name_get(ee);
816 if (engine && !strcmp(engine, "opengl_x11"))
817 evas_object_image_content_hint_set(smartData->image, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
819 ewk_view_mouse_events_enabled_set(ewkView, false);
820 ewk_view_touch_events_enabled_set(ewkView, true);
822 // FIXME: This code should be removed if side effect occur.
823 // WebView does not have focus after url loading.
824 // If focus is set as true to webview,
825 // elementary steal webview's focus during mouse up event
826 // So, added code that events are not propagated to smart parent according to guide from EFL
827 evas_object_propagate_events_set(ewkView, false);
829 #if ENABLE(TIZEN_SCREEN_READER)
830 ScreenReaderProxy::screenReader().addView(smartData->priv);
832 #endif // #if OS(TIZEN)
834 #define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData)
835 CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in);
836 CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out);
837 CONNECT(EVAS_CALLBACK_MOUSE_WHEEL, _ewk_view_on_mouse_wheel);
838 CONNECT(EVAS_CALLBACK_KEY_DOWN, _ewk_view_on_key_down);
839 CONNECT(EVAS_CALLBACK_KEY_UP, _ewk_view_on_key_up);
840 CONNECT(EVAS_CALLBACK_SHOW, _ewk_view_on_show);
841 CONNECT(EVAS_CALLBACK_HIDE, _ewk_view_on_hide);
845 static void _ewk_view_smart_del(Evas_Object* ewkView)
847 EwkViewImpl::removeFromPageViewMap(ewkView);
848 EWK_VIEW_SD_GET(ewkView, smartData);
849 #if ENABLE(TIZEN_SCREEN_READER)
850 ScreenReaderProxy::screenReader().removeView(smartData->priv);
852 if (smartData && smartData->priv)
853 _ewk_view_impl_del(smartData->priv);
855 g_parentSmartClass.del(ewkView);
858 static Eina_Bool _ewk_view_composite(void* data);
860 static void _ewk_view_smart_resize(Evas_Object* ewkView, Evas_Coord width, Evas_Coord height)
862 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
864 evas_object_resize(smartData->image, width, height);
865 evas_object_image_size_set(smartData->image, width, height);
866 evas_object_image_fill_set(smartData->image, 0, 0, width, height);
868 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
869 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
870 evas_object_image_native_surface_set(smartData->image, 0);
872 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
873 if (!ewk_view_is_opengl_backend(ewkView))
874 _ewk_view_composite(smartData);
875 else // OpenGL backend
877 impl->pageClient->displayViewport();
879 #endif // #if OS(TIZEN)
881 smartData->changed.size = true;
882 _ewk_view_smart_changed(smartData);
885 static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y)
887 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
889 smartData->changed.position = true;
890 _ewk_view_smart_changed(smartData);
893 static void _ewk_view_smart_calculate(Evas_Object* ewkView)
895 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
896 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
898 Evas_Coord x, y, width, height;
900 smartData->changed.any = false;
902 evas_object_geometry_get(ewkView, &x, &y, &width, &height);
904 if (smartData->changed.size) {
906 #if USE(COORDINATED_GRAPHICS)
907 impl->pageViewportControllerClient->updateViewportSize(IntSize(width, height));
909 #if USE(ACCELERATED_COMPOSITING)
910 needsNewSurface = impl->evasGlSurface;
913 if (impl->pageProxy->drawingArea())
914 impl->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize());
916 #if USE(ACCELERATED_COMPOSITING)
917 if (!impl->evasGlSurface)
919 evas_gl_surface_destroy(impl->evasGl, impl->evasGlSurface);
920 impl->evasGlSurface = 0;
921 ewk_view_create_gl_surface(ewkView, IntSize(width, height));
922 ewk_view_display(ewkView, IntRect(IntPoint(), IntSize(width, height)));
924 #endif // #if !OS(TIZEN)
926 smartData->view.w = width;
927 smartData->view.h = height;
928 smartData->changed.size = false;
931 if (impl->pageClient) {
932 if (DrawingAreaProxy* drawingArea = impl->pageProxy->drawingArea()) {
933 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
934 if (impl->pageProxy->isViewVisible())
935 drawingArea->setSize(IntSize(width, height), IntSize());
937 drawingArea->setSize(IntSize(width, height), IntSize());
939 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR)
940 impl->pageClient->updateViewportSize(IntSize(width, height));
941 if (ewk_view_is_opengl_backend(ewkView))
942 impl->pageClient->displayViewport();
945 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
946 impl->pageClient->frameRectChanged();
949 #endif // #if OS(TIZEN)
952 if (smartData->changed.position) {
953 evas_object_move(smartData->image, x, y);
954 smartData->view.x = x;
955 smartData->view.y = y;
956 smartData->changed.position = false;
958 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
959 impl->pageClient->frameRectChanged();
961 #if ENABLE(TIZEN_SCREEN_READER)
962 impl->pageProxy->recalcScreenReaderFocusRect();
964 #endif // #if OS(TIZEN)
967 if (impl->popupPicker)
968 ewk_popup_picker_resize(impl->popupPicker);
969 #endif // #if OS(TIZEN)
972 static void _ewk_view_smart_show(Evas_Object* ewkView)
974 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
975 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
977 if (evas_object_clipees_get(smartData->base.clipper))
978 evas_object_show(smartData->base.clipper);
979 evas_object_show(smartData->image);
982 static void _ewk_view_smart_hide(Evas_Object* ewkView)
984 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
986 evas_object_hide(smartData->base.clipper);
987 evas_object_hide(smartData->image);
988 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
989 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
990 if (impl->pageClient->isTextSelectionMode())
991 impl->pageClient->setIsTextSelectionMode(false);
995 static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha)
997 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
998 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1002 else if (alpha > 255)
1005 #define CHECK_COLOR(color, alpha) \
1008 else if (color > alpha) \
1010 CHECK_COLOR(red, alpha);
1011 CHECK_COLOR(green, alpha);
1012 CHECK_COLOR(blue, alpha);
1015 evas_object_image_alpha_set(smartData->image, alpha < 255);
1016 impl->pageProxy->setDrawsBackground(red || green || blue);
1017 impl->pageProxy->setDrawsTransparentBackground(alpha < 255);
1018 impl->pageClient->setBackgroundColor(red/255.0, green/255.0, blue/255.0, alpha/255.0);
1021 g_parentSmartClass.color_set(ewkView, red, green, blue, alpha);
1025 Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
1027 EINA_SAFETY_ON_NULL_RETURN_VAL(api, false);
1029 if (api->version != EWK_VIEW_SMART_CLASS_VERSION) {
1030 EINA_LOG_CRIT("Ewk_View_Smart_Class %p is version %lu while %lu was expected.",
1031 api, api->version, EWK_VIEW_SMART_CLASS_VERSION);
1035 if (EINA_UNLIKELY(!g_parentSmartClass.add))
1036 evas_object_smart_clipped_smart_set(&g_parentSmartClass);
1038 evas_object_smart_clipped_smart_set(&api->sc);
1040 // Set Evas_Smart_Class functions.
1041 api->sc.add = _ewk_view_smart_add;
1042 api->sc.del = _ewk_view_smart_del;
1043 api->sc.move = _ewk_view_smart_move;
1044 api->sc.resize = _ewk_view_smart_resize;
1045 api->sc.show = _ewk_view_smart_show;
1046 api->sc.hide = _ewk_view_smart_hide;
1047 api->sc.color_set = _ewk_view_smart_color_set;
1048 api->sc.calculate = _ewk_view_smart_calculate;
1049 api->sc.data = EWK_VIEW_TYPE_STR; // It is used by type checking.
1051 // Set Ewk_View_Smart_Class functions.
1052 api->focus_in = _ewk_view_smart_focus_in;
1053 api->focus_out = _ewk_view_smart_focus_out;
1054 api->mouse_wheel = _ewk_view_smart_mouse_wheel;
1055 api->mouse_down = _ewk_view_smart_mouse_down;
1056 api->mouse_up = _ewk_view_smart_mouse_up;
1057 api->mouse_move = _ewk_view_smart_mouse_move;
1058 api->key_down = _ewk_view_smart_key_down;
1059 api->key_up = _ewk_view_smart_key_up;
1061 api->gesture_start = _ewk_view_smart_gesture_start;
1062 api->gesture_end = _ewk_view_smart_gesture_end;
1063 api->gesture_move = _ewk_view_smart_gesture_move;
1065 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
1066 api->popup_menu_show = _ewk_view_popup_menu_show;
1067 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1068 api->multiple_popup_menu_show = _ewk_view_multiple_popup_menu_show;
1070 api->popup_menu_hide = _ewk_view_popup_menu_hide;
1071 api->popup_menu_update = _ewk_view_popup_menu_update;
1073 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1074 api->text_selection_down = _ewk_view_text_selection_down;
1075 api->text_selection_move = _ewk_view_text_selection_move;
1076 api->text_selection_up = _ewk_view_text_selection_up;
1078 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1079 api->input_picker_show = _ewk_view_input_picker_show;
1081 #if ENABLE(TIZEN_DATALIST_ELEMENT)
1082 api->data_list_show = _ewk_view_data_list_show;
1083 api->data_list_hide = _ewk_view_data_list_hide;
1085 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
1086 api->orientation_lock = _ewk_orientation_lock;
1087 api->orientation_unlock = _ewk_orientation_unlock;
1089 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1090 api->input_picker_color_request = _ewk_input_picker_color_request;
1091 api->input_picker_color_dismiss = _ewk_input_picker_color_dismiss;
1093 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1094 api->formdata_candidate_show = _ewk_view_smart_formdata_candidate_show;
1095 api->formdata_candidate_hide = _ewk_view_smart_formdata_candidate_hide;
1096 api->formdata_candidate_update_data = _ewk_view_smart_formdata_candidate_update_data;
1097 api->formdata_candidate_is_showing = _ewk_view_smart_formdata_candidate_is_showing;
1099 #if ENABLE(TIZEN_SCREEN_READER)
1100 api->screen_reader_command_execute = _ewk_view_screen_reader_command_execute;
1102 #endif //#if OS(TIZEN)
1107 static inline Evas_Smart* _ewk_view_smart_class_new(void)
1109 static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View");
1110 static Evas_Smart* smart = 0;
1112 if (EINA_UNLIKELY(!smart)) {
1113 ewk_view_smart_class_set(&api);
1114 smart = evas_smart_class_new(&api.sc);
1120 static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef)
1122 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1123 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1124 EINA_SAFETY_ON_NULL_RETURN(context);
1126 if (impl->pageClient)
1129 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
1130 bool isOpenGL = ewk_view_is_opengl_backend(ewkView);
1132 impl->pageClient = PageClientEvasGL::create(impl);
1134 impl->pageClient = PageClientImpl::create(impl);
1136 impl->pageClient = PageClientImpl::create(impl);
1140 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), toImpl(pageGroupRef));
1142 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), WebPageGroup::create().get());
1144 EwkViewImpl::addToPageViewMap(ewkView);
1147 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
1148 impl->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
1149 impl->pageProxy->pageGroup()->preferences()->setFrameFlatteningEnabled(true);
1150 impl->pageProxy->pageGroup()->preferences()->setAllowUniversalAccessFromFileURLs(true);
1152 int deviceWidth, deviceHeight;
1153 ecore_evas_screen_geometry_get(ecore_evas_ecore_evas_get(evas_object_evas_get(ewkView)), 0, 0, &deviceWidth, &deviceHeight);
1154 impl->pageProxy->pageGroup()->preferences()->setDeviceWidth(deviceWidth);
1155 impl->pageProxy->pageGroup()->preferences()->setDeviceHeight(deviceHeight);
1158 impl->pageProxy->initializeWebPage();
1160 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
1161 impl->pageProxy->setCustomDeviceScaleFactor((float)getMobileDPI() / 160);
1163 impl->pageProxy->setCustomDeviceScaleFactor((float)getDPI() / 160);
1166 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR)
1167 impl->pageProxy->setUseFixedLayout(true);
1169 #if ENABLE(FULLSCREEN_API)
1170 impl->pageProxy->fullScreenManager()->setWebView(ewkView);
1173 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
1175 impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(true);
1177 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(false);
1178 impl->pageProxy->pageGroup()->preferences()->setWebGLEnabled(false);
1179 impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(false);
1183 impl->backForwardList = Ewk_Back_Forward_List::create(toAPI(impl->pageProxy->backForwardList()));
1185 impl->context = context;
1188 ewkViewContextMenuClientAttachClient(ewkView);
1189 ewkViewTizenClientAttachClient(ewkView);
1191 #if ENABLE(TIZEN_GEOLOCATION)
1192 ewkViewGeolocationProviderAttachProvider(ewkView, impl->context->wkContext());
1195 #if ENABLE(TIZEN_NOTIFICATIONS)
1196 ewkViewNotificationProviderAttachProvider(ewkView, impl->context->wkContext());
1199 #if ENABLE(TIZEN_ICON_DATABASE)
1200 ewk_view_icondatabase_client_attach(ewkView, impl->context->wkContext());
1203 ewk_view_javascript_alert_callback_set(ewkView, _ewk_view_default_javascript_alert, 0);
1204 ewk_view_javascript_confirm_callback_set(ewkView, _ewk_view_default_javascript_confirm, 0);
1205 ewk_view_javascript_prompt_callback_set(ewkView, _ewk_view_default_javascript_prompt, 0);
1206 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
1207 ewk_view_before_unload_confirm_panel_callback_set(ewkView, _ewk_view_default_before_unload_confirm_panel, 0);
1209 ewk_view_open_panel_callback_set(ewkView, _ewk_view_default_open_panel, 0);
1210 #else // #if OS(TIZEN)
1211 #if USE(COORDINATED_GRAPHICS)
1212 impl->viewportHandler = EflViewportHandler::create(impl->pageClient.get());
1214 #endif // #if OS(TIZEN)
1216 #if ENABLE(FULLSCREEN_API)
1217 impl->pageProxy->fullScreenManager()->setWebView(ewkView);
1218 impl->pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true);
1221 // Initialize page clients.
1222 impl->pageLoadClient = PageLoadClientEfl::create(impl);
1223 impl->pagePolicyClient = PagePolicyClientEfl::create(impl);
1224 impl->pageUIClient = PageUIClientEfl::create(impl);
1225 impl->resourceLoadClient = ResourceLoadClientEfl::create(impl);
1226 impl->findClient = FindClientEfl::create(impl);
1227 impl->formClient = FormClientEfl::create(impl);
1228 #if !ENABLE(TIZEN_ICON_DATABASE)
1229 /* Listen for favicon changes */
1230 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();
1231 iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView));
1233 #if ENABLE(TIZEN_WEBKIT2_THEME_SET_INTERNAL)
1234 ewk_view_theme_set(ewkView, "/usr/share/edje/webkit.edj");
1237 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
1238 if (!impl->context->xWindow())
1239 impl->context->setXWindow(elm_win_xwindow_get(ewkView));
1242 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1243 impl->focusRing = FocusRing::create(impl);
1247 static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart)
1249 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1250 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
1252 #if ENABLE(TIZEN_WEBKIT2_DDK_CHECK)
1254 using namespace EGL;
1255 if(!eglGetDisplay(EGL_DEFAULT_DISPLAY)) {
1256 EINA_LOG_CRIT("Fail in initiziling view because No DDK is installed.");
1262 Evas_Object* ewkView = evas_object_smart_add(canvas, smart);
1266 EWK_VIEW_SD_GET(ewkView, smartData);
1268 evas_object_del(ewkView);
1272 EWK_VIEW_IMPL_GET(smartData, impl);
1274 evas_object_del(ewkView);
1283 * Constructs a ewk_view Evas_Object with WKType parameters.
1285 Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
1287 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1288 EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0);
1290 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, _ewk_view_smart_class_new());
1294 _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef);
1299 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context)
1301 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1302 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
1303 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1305 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, smart);
1309 #if ENABLE(TIZEN_ICON_DATABASE)
1310 //set default iconDatabasePath
1311 WKContextRef contextRef = context->wkContext();
1312 toImpl(contextRef)->setIconDatabasePath(toImpl(contextRef)->iconDatabasePath());
1315 #if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER)
1316 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1317 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1318 _ewk_view_initialize(ewkView, context, toAPI(impl->pageGroup.get()));
1320 _ewk_view_initialize(ewkView, context, 0);
1326 Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context)
1328 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1329 return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context);
1332 Evas_Object* ewk_view_add(Evas* canvas)
1334 return ewk_view_add_with_context(canvas, ewk_context_default_get());
1337 Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView)
1339 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1340 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1342 return impl->ewkContext();
1345 Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url)
1347 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1348 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1349 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
1351 impl->pageProxy->loadURL(String::fromUTF8(url));
1352 impl->informURLChange();
1357 const char* ewk_view_url_get(const Evas_Object* ewkView)
1359 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1360 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1365 const char *ewk_view_icon_url_get(const Evas_Object *ewkView)
1367 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1368 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1370 return impl->faviconURL();
1373 Eina_Bool ewk_view_reload(Evas_Object* ewkView)
1375 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1376 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1378 impl->pageProxy->reload(/*reloadFromOrigin*/ false);
1379 impl->informURLChange();
1384 Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView)
1386 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1387 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1389 impl->pageProxy->reload(/*reloadFromOrigin*/ true);
1390 impl->informURLChange();
1395 Eina_Bool ewk_view_stop(Evas_Object* ewkView)
1397 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1398 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1400 impl->pageProxy->stopLoading();
1405 Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView)
1407 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1408 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1410 return impl->settings();
1413 const char* ewk_view_title_get(const Evas_Object* ewkView)
1415 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1416 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1418 return impl->title();
1423 * Reports that the requested text was found.
1425 * Emits signal: "text,found" with the number of matches.
1427 void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount)
1429 evas_object_smart_callback_call(ewkView, "text,found", &matchCount);
1432 double ewk_view_load_progress_get(const Evas_Object* ewkView)
1434 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
1435 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0);
1437 return impl->pageProxy->estimatedProgress();
1440 Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y)
1442 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1443 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1449 scaleFactor = impl->pageClient->adjustScaleWithViewport(scaleFactor);
1451 IntPoint scrollPosition = impl->pageClient->scrollPosition();
1452 double scaleDifference = scaleFactor / impl->pageClient->scaleFactor();
1453 int newScrollX = (scrollPosition.x() + centerX - smartData->view.x) * scaleDifference - (centerX - smartData->view.x);
1454 int newScrollY = (scrollPosition.y() + centerY - smartData->view.y) * scaleDifference - (centerY - smartData->view.y);
1456 impl->pageProxy->scale(scaleFactor, IntPoint(newScrollX, newScrollY));
1458 impl->pageProxy->scalePage(scaleFactor, IntPoint(x, y));
1463 double ewk_view_scale_get(const Evas_Object* ewkView)
1465 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1);
1466 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1);
1469 return impl->pageProxy->scaleFactor();
1471 return impl->pageProxy->pageScaleFactor();
1475 Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio)
1477 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1478 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1480 impl->pageProxy->setCustomDeviceScaleFactor(ratio);
1485 float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView)
1487 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
1488 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0);
1490 return impl->pageProxy->deviceScaleFactor();
1493 void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
1495 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1496 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1498 impl->setThemePath(path);
1501 const char* ewk_view_theme_get(const Evas_Object* ewkView)
1503 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1504 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1506 return impl->themePath();
1509 Eina_Bool ewk_view_back(Evas_Object* ewkView)
1511 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1512 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1514 WebPageProxy* page = impl->pageProxy.get();
1515 if (page->canGoBack()) {
1523 Eina_Bool ewk_view_forward(Evas_Object* ewkView)
1525 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1526 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1528 WebPageProxy* page = impl->pageProxy.get();
1529 if (page->canGoForward()) {
1537 Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent)
1539 #if ENABLE(WEB_INTENTS)
1540 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1541 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1542 EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false);
1544 WebPageProxy* page = impl->pageProxy.get();
1545 page->deliverIntentToFrame(page->mainFrame(), intent->webIntentData());
1553 Eina_Bool ewk_view_back_possible(Evas_Object* ewkView)
1555 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1556 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1558 return impl->pageProxy->canGoBack();
1561 Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView)
1563 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1564 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1566 return impl->pageProxy->canGoForward();
1569 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
1571 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1572 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1574 return impl->backForwardList.get();
1577 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1578 void ewk_view_text_change_in_textfield(Evas_Object* ewkView, const String& name, const String& value)
1580 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1581 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1583 if (!ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
1586 InputMethodContextEfl* imfContext = impl->inputMethodContext();
1587 if (!imfContext || !imfContext->isShow())
1590 if (value.isEmpty()) {
1591 if(smartData->api->formdata_candidate_is_showing(smartData))
1592 smartData->api->formdata_candidate_hide(smartData);
1596 Vector<String> popupCandidates;
1597 ewk_view_form_candidate_data_get(ewkView, name, popupCandidates);
1598 std::sort(popupCandidates.begin(), popupCandidates.end(), WTF::codePointCompareLessThan);
1600 Eina_List* candidateList = 0;
1601 for (size_t i = 0; i < popupCandidates.size(); ++i) {
1602 if (popupCandidates[i].startsWith(value, false))
1603 candidateList = eina_list_append(candidateList, eina_stringshare_add(popupCandidates[i].utf8().data()));
1606 if (!eina_list_count(candidateList)) {
1607 if(smartData->api->formdata_candidate_is_showing(smartData))
1608 smartData->api->formdata_candidate_hide(smartData);
1612 smartData->api->formdata_candidate_update_data(smartData, candidateList);
1614 IntRect inputFieldRect = impl->pageClient->focusedNodeRect();
1615 smartData->api->formdata_candidate_show(smartData, inputFieldRect.x(), inputFieldRect.y(), inputFieldRect.width(), inputFieldRect.height());
1618 void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm)
1620 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1621 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1622 if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView))
1623 && !ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
1625 ewk_view_context_get(ewkView)->addFormData(impl->url(), formData, isPasswordForm);
1628 void ewk_view_form_password_data_fill(Evas_Object* ewkView)
1630 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1631 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1633 if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView)))
1636 Vector<std::pair<String, String> > passwordFormData;
1637 ewk_view_context_get(ewkView)->passwordFormData(impl->url(), passwordFormData);
1639 if (!passwordFormData.size())
1642 String passwordFormAutofill = "try { function passwordFormAutofill() { var inputFields;";
1643 for (size_t i = 0; i < passwordFormData.size(); i++) {
1644 passwordFormAutofill += String::format(" inputFields = document.getElementsByName(\"%s\");"
1645 " for (var i = 0; i < inputFields.length; i++)"
1646 " if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\" || inputFields[i].type.toLowerCase() == \"email\"))"
1647 " inputFields[i].value = \"%s\";",
1648 passwordFormData[i].first.utf8().data(), passwordFormData[i].second.utf8().data());
1650 passwordFormAutofill += "} passwordFormAutofill(); } catch(e) { }";
1651 ewk_view_script_execute(ewkView, passwordFormAutofill.utf8().data(), 0, 0);
1654 void ewk_view_form_candidate_data_get(Evas_Object* ewkView, const String& name, Vector<String>& candidates)
1656 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1657 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1658 ewk_view_context_get(ewkView)->candidateFormData(name, candidates);
1662 Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl)
1664 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1665 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1666 EINA_SAFETY_ON_NULL_RETURN_VAL(html, false);
1668 if (unreachableUrl && *unreachableUrl)
1669 impl->pageProxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));
1671 impl->pageProxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");
1673 impl->informURLChange();
1678 const char* ewk_view_custom_encoding_get(const Evas_Object* ewkView)
1680 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1681 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1683 return impl->customTextEncodingName();
1686 Eina_Bool ewk_view_custom_encoding_set(Evas_Object* ewkView, const char* encoding)
1688 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1689 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1691 impl->setCustomTextEncodingName(encoding);
1697 // FIXME: It should be removed.
1698 WKPageRef ewk_view_WKPage_get(Evas_Object* ewkView)
1700 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1701 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1703 return toAPI(impl->pageProxy.get());
1706 Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
1708 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1709 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1711 impl->setMouseEventsEnabled(!!enabled);
1716 Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView)
1718 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1719 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1721 return impl->mouseEventsEnabled();
1724 Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
1726 #if ENABLE(INPUT_TYPE_COLOR)
1727 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1728 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1730 return impl->setColorPickerColor(WebCore::Color(r, g, b, a));
1736 static Eina_Bool _ewk_view_default_javascript_alert(Evas_Object* ewkView, const char* alertText, void* userData)
1738 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1739 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1741 return impl->javascriptPopup->alert(alertText);
1744 static Eina_Bool _ewk_view_default_javascript_confirm(Evas_Object* ewkView, const char* message, void* userData)
1746 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1747 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1749 return impl->javascriptPopup->confirm(message);
1752 static Eina_Bool _ewk_view_default_javascript_prompt(Evas_Object* ewkView, const char* message, const char* defaultValue, void* userData)
1754 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1755 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1757 return impl->javascriptPopup->prompt(message, defaultValue);
1760 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
1761 static Eina_Bool _ewk_view_default_before_unload_confirm_panel(Evas_Object* ewkView, const char* message, void* userData)
1763 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1764 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1766 return impl->javascriptPopup->beforeUnloadConfirmPanel(message);
1770 static Eina_Bool _ewk_view_default_open_panel(Evas_Object* ewkView, Eina_Bool allow_multiple_files, Eina_List *accepted_mime_types, const char* capture, void* userData)
1772 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1773 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1775 return impl->openPanel->openPanel(ewkView, allow_multiple_files, accepted_mime_types, capture, impl);
1778 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
1779 Eina_Bool _ewk_view_popup_menu_show(Ewk_View_Smart_Data* smartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items, int selectedIndex)
1781 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1783 if (impl->popupPicker)
1784 ewk_popup_picker_del(impl->popupPicker);
1786 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1787 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex, false);
1789 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex);
1795 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1796 Eina_Bool _ewk_view_multiple_popup_menu_show(Ewk_View_Smart_Data* smartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Eina_List* items)
1798 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1800 if (impl->popupPicker)
1801 ewk_popup_picker_del(impl->popupPicker);
1803 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, 0, true);
1809 Eina_Bool _ewk_view_popup_menu_hide(Ewk_View_Smart_Data* smartData)
1811 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1813 if (!impl->popupPicker)
1816 ewk_popup_picker_del(impl->popupPicker);
1817 impl->popupPicker = 0;
1822 Eina_Bool _ewk_view_popup_menu_update(Ewk_View_Smart_Data* smartData, Eina_Rectangle rect, Ewk_Text_Direction text_direction, Eina_List* items, int selectedIndex)
1824 // FIXME: The rect should be updated if it was changed
1826 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1828 if (!impl->popupPicker)
1831 ewk_popup_picker_update(smartData->self, impl->popupPicker, items, selectedIndex);
1837 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1838 static Eina_Bool _ewk_view_input_picker_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, const char* inputValue)
1840 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1842 impl->inputPicker->show(inputType, inputValue);
1847 #if ENABLE(TIZEN_DATALIST_ELEMENT)
1848 static Eina_Bool _ewk_view_data_list_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, Eina_List* optionList)
1850 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1852 impl->inputPicker->showDataList(inputType, optionList);
1856 static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType)
1858 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1860 impl->inputPicker->hideDataList(inputType);
1865 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1866 static Eina_Bool _ewk_input_picker_color_request(Ewk_View_Smart_Data* smartData, int r, int g, int b, int a)
1868 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1870 impl->inputPicker->showColorPicker(r, g, b, a);
1874 static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data* smartData)
1876 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1878 impl->inputPicker->hideColorPicker();
1883 PageClientImpl* ewkViewGetPageClient(const Evas_Object* ewkView)
1885 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1886 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1888 return impl->pageClient.get();
1891 double ewk_view_text_zoom_get(const Evas_Object* ewkView)
1893 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 1);
1894 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 1);
1896 return WKPageGetTextZoomFactor(toAPI(impl->pageProxy.get()));
1899 Eina_Bool ewk_view_text_zoom_set(Evas_Object* ewkView, double textZoomFactor)
1901 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1902 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1904 WKPageSetTextZoomFactor(toAPI(impl->pageProxy.get()), textZoomFactor);
1908 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1909 FocusRing* ewkViewGetFocusRing(Evas_Object* ewkView)
1911 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1912 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1914 return impl->focusRing.get();
1918 Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* ewkView)
1920 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1921 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1923 return static_cast<Ewk_Frame_Ref>(WKPageGetMainFrame(toAPI(impl->pageProxy.get())));
1926 Ewk_Frame_Ref ewk_view_focused_frame_get(Evas_Object* ewkView)
1928 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1929 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1931 return static_cast<Ewk_Frame_Ref>(WKPageGetFocusedFrame(toAPI(impl->pageProxy.get())));
1934 JSGlobalContextRef ewkViewGetJavascriptGlobalContext(Evas_Object* ewkView)
1936 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1937 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1939 if (!impl->javascriptGlobalContext)
1940 impl->javascriptGlobalContext = JSGlobalContextCreate(0);
1941 return impl->javascriptGlobalContext;
1944 void ewkViewLoadCommitted(Evas_Object* ewkView)
1946 #if ENABLE(TIZEN_GESTURE)
1947 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1948 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1949 impl->gestureClient->reset();
1951 #if ENABLE(TIZEN_ISF_PORT)
1952 impl->inputMethodContext()->hideIMFContext();
1954 impl->informURLChange();
1955 evas_object_smart_callback_call(ewkView, "load,committed", 0);
1958 void ewkViewLoadError(Evas_Object* ewkView, WKErrorRef error)
1960 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1961 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1963 OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error);
1964 ewk_error_load_error_page(ewkError.get(), toAPI(impl->pageProxy.get()));
1965 evas_object_smart_callback_call(ewkView, "load,error", ewkError.get());
1968 void ewkViewDidFirstVisuallyNonEmptyLayout(Evas_Object* ewkView)
1970 #if ENABLE(TIZEN_GESTURE)
1971 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1972 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1973 impl->gestureClient->reset();
1975 evas_object_smart_callback_call(ewkView, "load,nonemptylayout,finished", 0);
1978 void ewkViewDidReceiveAuthenticationChallenge(Evas_Object* ewkView, Ewk_Auth_Challenge* authChallenge)
1980 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1981 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1983 if (impl->authChallenge)
1984 ewkAuthChallengeDelete(impl->authChallenge);
1985 impl->authChallenge = authChallenge;
1987 evas_object_smart_callback_call(ewkView, "authentication,challenge", impl->authChallenge);
1990 void ewk_view_process_crashed(Evas_Object* ewkView)
1992 bool handled = false;
1993 evas_object_smart_callback_call(ewkView, "process,crashed", &handled);
1999 #if ENABLE(TIZEN_SQL_DATABASE)
2000 bool ewkViewExceededDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, WKStringRef databaseName, unsigned long long expectedUsage)
2002 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2003 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2005 if (!impl->exceededDatabaseQuotaContext || !impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback)
2008 TIZEN_LOGI("No error in prameter. Request to display user confirm popup. expectedUsage(%llu)", expectedUsage);
2009 impl->isWaitingForExceededQuotaPopupReply = true;
2010 if (impl->exceededQuotaOrigin)
2011 deleteSecurityOrigin(impl->exceededQuotaOrigin);
2012 impl->exceededQuotaOrigin = createSecurityOrigin(origin);
2014 int length = WKStringGetMaximumUTF8CStringSize(databaseName);
2015 OwnArrayPtr<char> databaseNameBuffer = adoptArrayPtr(new char[length]);
2016 WKStringGetUTF8CString(databaseName, databaseNameBuffer.get(), length);
2018 return impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback(ewkView, impl->exceededQuotaOrigin, databaseNameBuffer.get(), expectedUsage, impl->exceededDatabaseQuotaContext->userData) == EINA_TRUE;
2022 #if ENABLE(TIZEN_NOTIFICATIONS)
2023 void ewkViewCancelNotification(Evas_Object* ewkView, uint64_t notificationID)
2025 TIZEN_LOGI("notification,cancel");
2026 evas_object_smart_callback_call(ewkView, "notification,cancel", ¬ificationID);
2029 void ewkViewRequestNotificationPermission(Evas_Object* ewkView, Ewk_Notification_Permission_Request* notificationPermissionRequest)
2031 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2032 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2034 TIZEN_LOGI("notification,permission,request");
2035 impl->notificationPermissionRequests = eina_list_append(impl->notificationPermissionRequests, notificationPermissionRequest);
2036 evas_object_smart_callback_call(ewkView, "notification,permission,request", notificationPermissionRequest);
2039 void ewkViewShowNotification(Evas_Object* ewkView, Ewk_Notification* notification)
2041 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2042 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2044 TIZEN_LOGI("notification,show");
2045 Eina_List* listIterator=0;
2047 const char* replaceID = ewkNotificationGetReplaceID(notification);
2048 if(strlen(replaceID)) {
2049 EINA_LIST_FOREACH(impl->notifications, listIterator, data) {
2050 Ewk_Notification* notificationForReplace = static_cast<Ewk_Notification*>(data);
2051 if(!strcmp(ewkNotificationGetReplaceID(notificationForReplace), replaceID))
2052 ewkViewCancelNotification(ewkView, ewk_notification_id_get(notificationForReplace));
2056 impl->notifications = eina_list_append(impl->notifications, notification);
2057 evas_object_smart_callback_call(ewkView, "notification,show", notification);
2060 void ewkViewDeleteNotificationPermissionRequest(Evas_Object* ewkView, Ewk_Notification_Permission_Request* ewkNotificationPermissionRequest)
2062 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2063 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2065 impl->notificationPermissionRequests = eina_list_remove(impl->notificationPermissionRequests, ewkNotificationPermissionRequest);
2069 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2070 void ewkViewRegisterProtocolHandlers(Evas_Object* ewkView, const char* scheme, const char* baseUrl, const char* url, const char* title)
2072 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2074 TIZEN_LOGI("protocolhandler,registration,requested");
2075 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseUrl, url, title);
2076 evas_object_smart_callback_call(ewkView, "protocolhandler,registration,requested", static_cast<void*>(customHandlersData));
2077 ewkCustomHandlersDeleteData(customHandlersData);
2081 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
2082 Ewk_Custom_Handlers_State ewkViewIsProtocolHandlerRegistered(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url)
2084 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
2086 TIZEN_LOGI("protocolhandler,isregistered");
2087 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseURL, url);
2088 evas_object_smart_callback_call(ewkView, "protocolhandler,isregistered", static_cast<void*>(customHandlersData));
2090 Ewk_Custom_Handlers_State result;
2091 result = ewkGetCustomHandlersDataResult(customHandlersData);
2092 ewkCustomHandlersDeleteData(customHandlersData);
2097 void ewkViewUnregisterProtocolHandlers(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url)
2099 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2101 TIZEN_LOGI("protocolhandler,unregistration,requested");
2102 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseURL, url);
2103 evas_object_smart_callback_call(ewkView, "protocolhandler,unregistration,requested", static_cast<void*>(customHandlersData));
2104 ewkCustomHandlersDeleteData(customHandlersData);
2108 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2109 void ewkViewRegisterContentHandlers(Evas_Object* ewkView, const char* mimeType, const char* baseUrl, const char* url, const char* title)
2111 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2113 TIZEN_LOGI("contenthandler,registration,requested");
2114 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseUrl, url, title);
2115 evas_object_smart_callback_call(ewkView, "contenthandler,registration,requested", static_cast<void*>(customHandlersData));
2116 ewkCustomHandlersDeleteData(customHandlersData);
2119 Ewk_Custom_Handlers_State ewkViewIsContentHandlerRegistered(Evas_Object* ewkView, const char* mimeType, const char* baseURL, const char* url)
2121 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
2123 TIZEN_LOGI("contenthandler,isregistered");
2124 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseURL, url);
2125 evas_object_smart_callback_call(ewkView, "contenthandler,isregistered", static_cast<void*>(customHandlersData));
2127 Ewk_Custom_Handlers_State result;
2128 result = ewkGetCustomHandlersDataResult(customHandlersData);
2129 ewkCustomHandlersDeleteData(customHandlersData);
2134 void ewkViewUnregisterContentHandlers(Evas_Object* ewkView, const char* mimeType, const char* baseURL, const char* url)
2136 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2138 TIZEN_LOGI("contenthandler,unregistration,requested");
2139 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseURL, url);
2140 evas_object_smart_callback_call(ewkView, "contenthandler,unregistration,requested", static_cast<void*>(customHandlersData));
2141 ewkCustomHandlersDeleteData(customHandlersData);
2145 #if ENABLE(TIZEN_SEARCH_PROVIDER)
2146 void ewkViewAddSearchProvider(Evas_Object* ewkView, const char* baseURL, const char* engineURL)
2148 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2150 TIZEN_LOGI("searchProvider,add");
2151 Ewk_Search_Provider_Data* searchProviderData = ewkSearchProviderCreateData(baseURL, engineURL);
2152 evas_object_smart_callback_call(ewkView, "searchProvider,add", static_cast<void*>(searchProviderData));
2153 ewkSearchProviderDeleteData(searchProviderData);
2156 unsigned long ewkViewIsSearchProviderInstalled(Evas_Object* ewkView, const char* baseURL, const char* engineURL)
2158 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
2160 TIZEN_LOGI("searchProvider,installed");
2161 Ewk_Search_Provider_Data* searchProviderData = ewkSearchProviderCreateData(baseURL, engineURL);
2162 evas_object_smart_callback_call(ewkView, "searchProvider,installed", static_cast<void*>(searchProviderData));
2163 unsigned long result;
2164 result = ewkGetSearchProviderResult(searchProviderData);
2165 ewkSearchProviderDeleteData(searchProviderData);
2170 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2171 bool ewkViewGetStandaloneStatus(Evas_Object* ewkView)
2173 TIZEN_LOGI("webapp,metatag,standalone");
2174 bool standalone = true;
2175 evas_object_smart_callback_call(ewkView, "webapp,metatag,standalone", (void*)&standalone);
2180 #if ENABLE(TIZEN_MEDIA_STREAM)
2181 void ewkViewRequestUserMediaPermission(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* userMediaPermission)
2183 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2184 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2186 impl->userMediaPermissionRequests = eina_list_append(impl->userMediaPermissionRequests, userMediaPermission);
2187 evas_object_smart_callback_call(ewkView, "usermedia,permission,request", userMediaPermission);
2190 void ewkViewDeleteUserMediaPermissionRequest(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* permission)
2192 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2193 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2195 impl->userMediaPermissionRequests = eina_list_remove(impl->userMediaPermissionRequests, permission);
2200 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
2201 void ewkViewProcessJSBridgePlugin(Evas_Object* ewkView, WKStringRef request, WKStringRef message)
2203 int requestLength = WKStringGetMaximumUTF8CStringSize(request);
2204 OwnArrayPtr<char> requestBuffer = adoptArrayPtr(new char[requestLength]);
2205 int messageLength = WKStringGetMaximumUTF8CStringSize(message);
2206 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[messageLength]);
2207 WKStringGetUTF8CString(request, requestBuffer.get(), requestLength);
2208 WKStringGetUTF8CString(message, messageBuffer.get(), messageLength);
2210 evas_object_smart_callback_call(ewkView, requestBuffer.get(), static_cast<void*>(messageBuffer.get()));
2214 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
2215 void ewkViewRequestCertificateConfirm(Evas_Object* ewkView, Ewk_Certificate_Policy_Decision* certificatePolicyDecision)
2217 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2218 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2219 if (impl->certificatePolicyDecision)
2220 ewkCertificatePolicyDecisionDelete(impl->certificatePolicyDecision);
2221 impl->certificatePolicyDecision = certificatePolicyDecision;
2223 evas_object_smart_callback_call(ewkView, "request,certificate,confirm", certificatePolicyDecision);
2227 void ewkViewCustomizeContextMenu(Evas_Object* ewkView, Ewk_Context_Menu* menu)
2229 evas_object_smart_callback_call(ewkView, "contextmenu,customize", static_cast<void*>(menu));
2232 void ewkViewCustomContextMenuItemSelected(Evas_Object* ewkView, Ewk_Context_Menu_Item* item)
2234 evas_object_smart_callback_call(ewkView, "contextmenu,selected", static_cast<void*>(item));
2237 #if ENABLE(TIZEN_GEOLOCATION)
2238 void ewkViewRequestGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest)
2240 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2241 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2243 TIZEN_LOGI("geolocation,permission,request");
2244 impl->geolocationPermissionRequests = eina_list_append(impl->geolocationPermissionRequests, geolocationPermissionRequest);
2245 evas_object_smart_callback_call(ewkView, "geolocation,permission,request", geolocationPermissionRequest);
2248 void ewkViewDeleteGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest)
2250 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2251 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2253 impl->geolocationPermissionRequests = eina_list_remove(impl->geolocationPermissionRequests, geolocationPermissionRequest);
2256 void ewkViewSetGeolocation(Evas_Object* ewkView, Ewk_Geolocation* geolocation)
2258 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2259 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2261 impl->geolocation = geolocation;
2264 Ewk_Geolocation* ewkViewGetGeolocation(Evas_Object* ewkView)
2266 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2267 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2269 return impl->geolocation;
2272 bool ewkViewIsValidLocationService(Evas_Object* ewkView)
2274 TIZEN_LOGI("geolocation,valid");
2277 evas_object_smart_callback_call(ewkView, "geolocation,valid", &valid);
2282 void ewkViewFormSubmit(Evas_Object* ewkView, Ewk_Form_Data* formData)
2284 evas_object_smart_callback_call(ewkView, "form,submit", formData);
2287 void ewkViewPolicyNavigationDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2289 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2290 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2291 if (impl->policyDecision)
2292 ewkPolicyDecisionDelete(impl->policyDecision);
2293 impl->policyDecision = policyDecision;
2295 evas_object_smart_callback_call(ewkView, "policy,navigation,decide", impl->policyDecision);
2298 void ewkViewPolicyNewWindowDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2300 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2301 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2302 if (impl->policyDecision)
2303 ewkPolicyDecisionDelete(impl->policyDecision);
2304 impl->policyDecision = policyDecision;
2306 evas_object_smart_callback_call(ewkView, "policy,newwindow,decide", impl->policyDecision);
2309 void ewkViewPolicyResponseDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2311 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2312 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2313 if (impl->policyDecision)
2314 ewkPolicyDecisionDelete(impl->policyDecision);
2315 impl->policyDecision = policyDecision;
2317 evas_object_smart_callback_call(ewkView, "policy,response,decide", impl->policyDecision);
2320 void ewkViewSendScrollEvent(Evas_Object* ewkView, int deltaX, int deltaY)
2322 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2323 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2325 IntPoint scrollPosition = impl->pageClient->scrollPosition();
2326 IntSize contentsSize = impl->pageProxy->contentsSize();
2327 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2328 contentsSize.scale(impl->pageClient->scaleFactor());
2331 // some website's contents size is smaller than view size,
2332 // so we have to adjust contents size to view size for that case.
2333 if (contentsSize.width() < smartData->view.w)
2334 contentsSize.setWidth(smartData->view.w);
2335 if (contentsSize.height() < smartData->view.h)
2336 contentsSize.setHeight(smartData->view.h);
2338 // Call "scroll,down" if webview can be scrolled down.
2339 if (deltaY > 0 && (scrollPosition.y() + smartData->view.h) < contentsSize.height())
2340 evas_object_smart_callback_call(ewkView, "scroll,down", 0);
2341 // Call "scroll,up" if webview can be scrolled up.
2342 else if (deltaY < 0 && scrollPosition.y() > 0)
2343 evas_object_smart_callback_call(ewkView, "scroll,up", 0);
2345 // Call "scroll,right" if webview can be scrolled down.
2346 if (deltaX > 0 && (scrollPosition.x() + smartData->view.w) < contentsSize.width())
2347 evas_object_smart_callback_call(ewkView, "scroll,right", 0);
2348 // Call "scroll,left" if webview can be scrolled up.
2349 else if (deltaX < 0 && scrollPosition.x() > 0)
2350 evas_object_smart_callback_call(ewkView, "scroll,left", 0);
2353 void ewkViewSendEdgeEvent(Evas_Object* ewkView, const IntPoint& scrollPosition, int deltaX, int deltaY)
2355 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2356 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2358 IntSize contentsSize = impl->pageProxy->contentsSize();
2359 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2360 contentsSize.scale(impl->pageClient->scaleFactor());
2363 int maxScrollY = contentsSize.height() - smartData->view.h;
2364 if (!impl->isVerticalEdge) {
2365 if (deltaY < 0 && (scrollPosition.y() + deltaY) <= 0) {
2366 evas_object_smart_callback_call(ewkView, "edge,top", NULL);
2367 impl->isVerticalEdge = true;
2368 } else if (deltaY > 0 && (scrollPosition.y() + deltaY) >= maxScrollY) {
2369 evas_object_smart_callback_call(ewkView, "edge,bottom", NULL);
2370 impl->isVerticalEdge = true;
2373 if (maxScrollY && ((scrollPosition.y() == 0 && deltaY > 0)
2374 || (scrollPosition.y() == maxScrollY && deltaY < 0)))
2375 impl->isVerticalEdge = false;
2378 int maxScrollX = contentsSize.width() - smartData->view.w;
2379 if (!impl->isHorizontalEdge) {
2380 if (deltaX < 0 && (scrollPosition.x() + deltaX) <= 0) {
2381 evas_object_smart_callback_call(ewkView, "edge,left", NULL);
2382 impl->isHorizontalEdge = true;
2383 } else if (deltaX > 0 && (scrollPosition.x() + deltaX) >= maxScrollX) {
2384 evas_object_smart_callback_call(ewkView, "edge,right", NULL);
2385 impl->isHorizontalEdge = true;
2388 if (maxScrollX && ((scrollPosition.x() == 0 && deltaX > 0)
2389 || (scrollPosition.x() == maxScrollX && deltaX < 0)))
2390 impl->isHorizontalEdge = false;
2394 void ewkViewClearEdges(Evas_Object* ewkView)
2396 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2397 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2399 impl->isVerticalEdge = false;
2400 impl->isHorizontalEdge = false;
2403 void ewk_view_scale_range_get(Evas_Object* ewkView, double* minimumScale, double* maximumScale)
2405 EWK_VIEW_SD_GET(ewkView, smartData);
2406 if (!smartData || !smartData->priv) {
2414 PageClientImpl::ViewportConstraints constraints = smartData->priv->pageClient->viewportConstraints();
2416 *minimumScale = constraints.minimumScale;
2418 *maximumScale = constraints.maximumScale;
2421 bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExternalKeyboard)
2423 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2424 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2426 double scaleFactor = impl->pageClient->scaleFactor();
2427 IntSize contentsSize = impl->pageProxy->contentsSize();
2429 double newScaleFactor = scaleFactor;
2430 // Readable zoom value is dependent on device DPI
2431 if (scaleFactor < impl->pageProxy->deviceScaleFactor()
2432 && impl->pageClient->viewportConstraints().userScalable)
2433 newScaleFactor = impl->pageProxy->deviceScaleFactor();
2435 // Readable zoom value should be inside of viewport scale range
2436 newScaleFactor = impl->pageClient->adjustScaleWithViewport(newScaleFactor);
2438 // scale contents' size with new scale factor
2439 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2440 contentsSize.scale(newScaleFactor);
2442 contentsSize.scale(newScaleFactor / scaleFactor);
2445 #if ENABLE(TIZEN_ISF_PORT)
2446 Ecore_X_Window rootWin = ecore_x_window_root_first_get();
2447 ecore_x_event_mask_set(rootWin, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
2448 Ecore_X_Atom xAtom = ecore_x_atom_get("X External Keyboard Exist");
2449 unsigned int connectedKeyboardNum = 0;
2450 bool isExternalKeyboardConnected = false;
2452 // get connected keyboard number
2453 if (ecore_x_window_prop_card32_get(rootWin, xAtom, &connectedKeyboardNum, 1)
2454 && connectedKeyboardNum)
2455 isExternalKeyboardConnected = true;
2457 // We should treat both of ECORE_IMF_INPUT_PANEL_STATE_SHOW and ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW
2458 // as IME is shown. ECORE_IMF_INPUT_PANEL_STATE_HIDE is ignored at here.
2459 // input field zoom should not work with below conditions
2460 // 1. view is not focused
2461 // 2. external keyboard is not connected(if adjustForExternalKeyboard is true)
2462 // 3. imfContext is null(if adjustForExternalKeyboard is false)
2463 // 4. input panel state is hidden(if adjustForExternalKeyboard is false)
2464 if ((!(static_cast<PageClient*>(impl->pageClient.get()))->isViewFocused()
2465 || (adjustForExternalKeyboard && !isExternalKeyboardConnected)
2466 || (!adjustForExternalKeyboard && !impl->inputMethodContext())
2467 || (!adjustForExternalKeyboard && !impl->inputMethodContext()->isShow()))
2468 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
2469 && !(impl->pageClient->isClipboardWindowOpened())
2475 // caret position can be outside of visible rect.
2476 // we need to consider it.
2477 IntRect selectionRect = impl->pageProxy->getSelectionRect(true);
2478 IntRect focusedNodeRect = impl->pageClient->focusedNodeRect();
2479 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2480 selectionRect.scale(newScaleFactor);
2481 focusedNodeRect.scale(newScaleFactor);
2483 selectionRect.scale(newScaleFactor / scaleFactor);
2484 focusedNodeRect.scale(newScaleFactor / scaleFactor);
2486 if (selectionRect.isEmpty())
2489 IntRect visibleRect = impl->pageClient->visibleContentRect();
2490 IntPoint scrollPosition = visibleRect.location();
2491 // Do not adjust scroll position if selection rect (caret) is visible after scaling.
2492 if (!visibleRect.contains(selectionRect)) {
2494 scrollPosition = IntPoint(selectionRect.x() - visibleRect.width() / 3, selectionRect.y() - visibleRect.height() / 3);
2495 // If both input field's position x and selection rect can be displayed together,
2496 // adjust scroll position to input field's position x.
2497 if (!focusedNodeRect.isEmpty() && selectionRect.x() - focusedNodeRect.x() < visibleRect.width() * 4 / 5)
2498 scrollPosition.setX(focusedNodeRect.x());
2501 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2502 impl->pageClient->setVisibleContentRect(IntRect(scrollPosition, impl->size()), newScaleFactor);
2504 if (newScaleFactor != scaleFactor)
2505 impl->pageProxy->scalePage(newScaleFactor, scrollPosition);
2507 impl->pageProxy->scrollMainFrameTo(scrollPosition);
2509 evas_object_move(smartData->image, smartData->view.x, smartData->view.y);
2513 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
2514 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
2515 static Eina_Bool _ewk_view_composite(void* data)
2517 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
2518 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2520 if (!evas_object_visible_get(smartData->image))
2521 return ECORE_CALLBACK_CANCEL;
2524 evas_object_image_size_get(smartData->image, &ow, &oh);
2525 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(smartData->image, true));
2527 RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32, ow, oh, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, ow)));
2528 RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get()));
2530 cairo_save(context.get());
2531 cairo_set_operator(context.get(), CAIRO_OPERATOR_CLEAR);
2532 cairo_rectangle(context.get(), 0, 0, ow, oh);
2533 cairo_fill(context.get());
2534 cairo_restore(context.get());
2536 impl->pageClient->drawContents(context.get());
2538 evas_object_image_data_set(smartData->image, pixels);
2539 evas_object_image_data_update_add(smartData->image, 0, 0, ow, oh);
2541 ewkViewFrameRendered(smartData->self);
2543 impl->compositionAnimator = 0;
2545 return ECORE_CALLBACK_CANCEL;
2549 void ewk_view_mark_for_sync(Evas_Object* ewkView)
2551 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2552 EINA_SAFETY_ON_NULL_RETURN(smartData->image);
2554 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
2555 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2557 if (!ewk_view_is_opengl_backend(ewkView)) {
2558 if (!impl->compositionAnimator)
2559 impl->compositionAnimator = ecore_animator_add(_ewk_view_composite, smartData);
2564 evas_object_image_pixels_dirty_set(smartData->image, true);
2567 static void on_pixels_for_accelerated_compositing(void* data, Evas_Object* obj)
2569 Evas_Object* ewkView = static_cast<Evas_Object*>(data);
2570 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2571 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2572 impl->pageClient->drawContents();
2575 bool ewk_view_image_native_surface_set(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface)
2577 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2578 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2580 if (!smartData->image)
2583 evas_object_image_native_surface_set(smartData->image, nativeSurface);
2584 evas_object_image_pixels_get_callback_set(smartData->image, on_pixels_for_accelerated_compositing, ewkView);
2590 void _ewk_view_suspend_painting(Evas_Object* ewkView)
2592 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2593 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2595 if (!impl->suspendedPainting) {
2596 impl->pageProxy->suspendPainting();
2597 impl->suspendedPainting = true;
2601 void _ewk_view_resume_painting(Evas_Object* ewkView)
2603 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2604 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2606 if (impl->suspendedPainting) {
2607 impl->pageProxy->resumePainting();
2608 impl->suspendedPainting = false;
2612 void ewk_view_suspend(Evas_Object* ewkView)
2614 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2615 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2617 if (impl->pageProxy->estimatedProgress() < 1.0) {
2618 impl->suspendRequested = true;
2621 impl->suspendRequested = false;
2623 _ewk_view_suspend_painting(ewkView);
2625 // FIXME Workaround for suspend/resume while javascript popup is displayed.
2626 // condition ' && !private->isWaitingForJavaScriptPopupReply' is added to
2627 // skip suspendJavaScriptAndResource to prevent multiple ActiveDOMObject
2629 // During the javascript popup is displayed, PageGroupLoadDeferrer is activated,
2630 // which suspends resource loading and scheduled tasks, including ActiveDOMObject.
2631 // When ewk_view_suspend() is called during the javascript popup, scheduled tasks
2632 // will be suspended again.
2633 // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of
2634 // the ActiveDOMObject.
2635 if (!impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) {
2636 impl->pageProxy->suspendJavaScriptAndResource();
2637 impl->suspendedResources = true;
2640 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
2641 impl->pageProxy->suspendPlugin();
2645 void ewk_view_resume(Evas_Object* ewkView)
2647 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2648 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2650 if (impl->suspendRequested) {
2651 impl->suspendRequested = false;
2655 _ewk_view_resume_painting(ewkView);
2657 // FIXME Workaround for suspend/resume while javascript popup is displayed.
2658 // condition ' && !private->isWaitingForJavaScriptPopupReply' is added to
2659 // skip suspendJavaScriptAndResource to prevent multiple ActiveDOMObject
2661 // During the javascript popup is displayed, PageGroupLoadDeferrer is activated,
2662 // which suspends resource loading and scheduled tasks, including ActiveDOMObject.
2663 // When ewk_view_suspend() is called during the javascript popup, scheduled tasks
2664 // will be suspended again.
2665 // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of
2666 // the ActiveDOMObject.
2667 if (impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) {
2668 impl->pageProxy->resumeJavaScriptAndResource();
2669 impl->suspendedResources = false;
2672 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
2673 impl->pageProxy->resumePlugin();
2677 Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body)
2679 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2680 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2681 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
2683 ResourceRequest request(String::fromUTF8(url));
2686 case EWK_HTTP_METHOD_GET:
2687 request.setHTTPMethod("GET");
2689 case EWK_HTTP_METHOD_HEAD:
2690 request.setHTTPMethod("HEAD");
2692 case EWK_HTTP_METHOD_POST:
2693 request.setHTTPMethod("POST");
2695 case EWK_HTTP_METHOD_PUT:
2696 request.setHTTPMethod("PUT");
2698 case EWK_HTTP_METHOD_DELETE:
2699 request.setHTTPMethod("DELETE");
2706 Eina_Iterator* it = eina_hash_iterator_tuple_new(headers);
2708 while (eina_iterator_next(it, &data)) {
2709 Eina_Hash_Tuple* t = static_cast<Eina_Hash_Tuple*>(data);
2710 const char* name = static_cast<const char*>(t->key);
2711 const char* value = static_cast<const char*>(t->data);
2712 request.addHTTPHeaderField(name, value);
2714 eina_iterator_free(it);
2718 request.setHTTPBody(FormData::create(body));
2720 WKRetainPtr<WKURLRequestRef> urlRequest(AdoptWK,toAPI(WebURLRequest::create(request).leakRef()));
2721 WKPageLoadURLRequest(toAPI(impl->pageProxy.get()), urlRequest.get());
2726 Eina_Bool ewk_view_plain_text_set(Evas_Object* ewkView, const char* plainText)
2728 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2729 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2731 WKRetainPtr<WKStringRef> plainTextRef(AdoptWK, WKStringCreateWithUTF8CString(plainText));
2732 WKPageLoadPlainTextString(toAPI(impl->pageProxy.get()), plainTextRef.get());
2737 Eina_Bool ewk_view_contents_set(Evas_Object* ewkView, const char* contents, size_t contentsSize, char* mimeType, char* encoding, char* baseUri)
2739 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2740 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2741 EINA_SAFETY_ON_NULL_RETURN_VAL(contents, false);
2743 if (contentsSize == 0)
2746 String mimeTypeString;
2748 mimeTypeString = String::fromUTF8(mimeType);
2750 mimeTypeString = String::fromUTF8("text/html");
2752 String encodingString;
2754 encodingString = String::fromUTF8(encoding);
2756 encodingString = String::fromUTF8("UTF-8");
2758 String baseUriString;
2760 baseUriString = String::fromUTF8(baseUri);
2762 baseUriString = String::fromUTF8("about:blank");
2764 WKRetainPtr<WKDataRef> contentsRef(AdoptWK, WKDataCreate(reinterpret_cast<const unsigned char*>(contents), contentsSize));
2765 impl->pageProxy->loadContentsbyMimeType(toImpl(contentsRef.get()), mimeTypeString, encodingString, baseUriString);
2770 Eina_Bool ewk_view_html_contents_set(Evas_Object* ewkView, const char* html, const char* baseUri)
2772 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2773 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2775 WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(html));
2776 WKRetainPtr<WKURLRef> baseURL(AdoptWK, WKURLCreateWithUTF8CString(baseUri));
2778 WKPageLoadHTMLString(toAPI(impl->pageProxy.get()), htmlString.get(), baseURL.get());
2783 Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State pageVisibilityState, Eina_Bool initialState)
2785 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2786 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2788 TIZEN_LOGI("initialState (%d)", initialState);
2789 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
2790 WKPageSetPageVisibility(toAPI(impl->pageProxy.get()), static_cast<WKPageVisibilityState>(pageVisibilityState), initialState);
2797 Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* userAgent)
2799 EINA_SAFETY_ON_NULL_RETURN_VAL(userAgent, false);
2801 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2802 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2804 impl->userAgent = userAgent;
2806 WKRetainPtr<WKStringRef> userAgentString(AdoptWK, WKStringCreateWithUTF8CString(userAgent));
2807 WKPageSetCustomUserAgent(toAPI(impl->pageProxy.get()), userAgentString.get());
2812 const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
2814 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2815 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2817 if (!impl->userAgent) {
2818 WKRetainPtr<WKStringRef> userAgentString(AdoptWK, WKPageCopyUserAgent(toAPI(impl->pageProxy.get())));
2820 int length = WKStringGetMaximumUTF8CStringSize(userAgentString.get());
2821 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
2822 WKStringGetUTF8CString(userAgentString.get(), buffer.get(), length);
2823 impl->userAgent = buffer.get();
2826 return impl->userAgent;
2828 Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value)
2830 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2831 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2832 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2834 WKRetainPtr<WKStringRef> customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name));
2835 WKRetainPtr<WKStringRef> customHeaderValue(AdoptWK, WKStringCreateWithUTF8CString(value));
2837 WKPageAddCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get(), customHeaderValue.get());
2840 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2845 Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* name)
2847 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2848 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2849 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2851 WKRetainPtr<WKStringRef> customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name));
2853 WKPageRemoveCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get());
2856 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2861 Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView)
2863 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2864 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2865 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2867 WKPageClearCustomHeaders(toAPI(impl->pageProxy.get()));
2870 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2875 #if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY)
2876 Eina_Bool ewk_view_visibility_set(Evas_Object* ewkView, Eina_Bool enable)
2878 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2879 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2881 #if ENABLE(TIZEN_DRAG_SUPPORT)
2882 if (impl->pageClient->isDragMode())
2883 impl->pageClient->setDragMode(false);
2886 impl->pageClient->setIsVisible(enable);
2891 Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, Eina_Rectangle viewArea, float scaleFactor, Evas* canvas)
2893 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
2895 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2896 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2899 rect.origin.x = viewArea.x;
2900 rect.origin.y = viewArea.y;
2901 rect.size.width = viewArea.w;
2902 rect.size.height = viewArea.h;
2904 WKRetainPtr<WKImageRef> snapshot(AdoptWK, WKPageCreateSnapshot(toAPI(impl->pageProxy.get()), rect, scaleFactor));
2905 if (!snapshot.get())
2908 RefPtr<cairo_surface_t> screenshotSurface = adoptRef(WKImageCreateCairoSurface(snapshot.get()));
2910 Evas_Object* screenshotImage = evas_object_image_add(canvas);
2911 int surfaceWidth = cairo_image_surface_get_width(screenshotSurface.get());
2912 int surfaceHeight = cairo_image_surface_get_height(screenshotSurface.get());
2913 evas_object_image_size_set(screenshotImage, surfaceWidth, surfaceHeight);
2914 evas_object_image_colorspace_set(screenshotImage, EVAS_COLORSPACE_ARGB8888);
2916 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(screenshotImage, true));
2918 RefPtr<cairo_surface_t> imageSurface = adoptRef(cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_RGB24, surfaceWidth, surfaceHeight, cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, surfaceWidth)));
2919 RefPtr<cairo_t> cairo = adoptRef(cairo_create(imageSurface.get()));
2921 cairo_set_source_surface(cairo.get(), screenshotSurface.get(), 0, 0);
2922 cairo_rectangle(cairo.get(), 0, 0, surfaceWidth, surfaceHeight);
2923 cairo_fill(cairo.get());
2925 evas_object_image_smooth_scale_set(screenshotImage, true);
2926 evas_object_size_hint_min_set(screenshotImage, surfaceWidth, surfaceHeight);
2927 evas_object_resize(screenshotImage, surfaceWidth, surfaceHeight);
2928 evas_object_image_fill_set(screenshotImage, 0, 0, surfaceWidth, surfaceHeight);
2929 evas_object_image_data_set(screenshotImage, pixels);
2931 return screenshotImage;
2934 unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port)
2936 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
2937 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, 0);
2938 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, 0);
2940 return impl->pageProxy->startInspectorServer(port);
2942 LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n");
2947 Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView)
2949 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
2950 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, false);
2951 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false);
2953 return impl->pageProxy->stopInspectorServer();
2955 LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n");
2960 void ewk_view_scroll_by(Evas_Object* ewkView, int deltaX, int deltaY)
2962 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2963 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2965 WKPageScrollBy(toAPI(impl->pageProxy.get()), toAPI(IntSize(deltaX, deltaY)));
2968 Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y)
2974 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2975 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2977 IntPoint scrollPosition = impl->pageClient->scrollPosition();
2979 *x = scrollPosition.x();
2981 *y = scrollPosition.y();
2986 Eina_Bool ewk_view_scroll_set(Evas_Object* ewkView, int x, int y)
2988 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2989 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2991 impl->pageProxy->scrollMainFrameTo(IntPoint(x, y));
2995 Eina_Bool ewk_view_scroll_size_get(const Evas_Object* ewkView, int* width, int* height)
3001 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3002 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3004 IntSize contentsSize = impl->pageProxy->contentsSize();
3005 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
3006 contentsSize.scale(impl->pageClient->scaleFactor());
3009 if (width && contentsSize.width() > smartData->view.w)
3010 *width = contentsSize.width() - smartData->view.w;
3011 if (height && contentsSize.height() > smartData->view.h)
3012 *height = contentsSize.height() - smartData->view.h;
3016 bool ewkViewRunJavaScriptAlert(Evas_Object* ewkView, WKStringRef alertText)
3018 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3019 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3020 if (!impl->alertContext || !impl->alertContext->javascriptAlertCallback)
3022 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->alertContext->ewkView == ewkView, false);
3024 impl->isWaitingForJavaScriptPopupReply = true;
3025 int length = WKStringGetMaximumUTF8CStringSize(alertText);
3026 OwnArrayPtr<char> alertTextBuffer = adoptArrayPtr(new char[length]);
3027 WKStringGetUTF8CString(alertText, alertTextBuffer.get(), length);
3028 return impl->alertContext->javascriptAlertCallback(impl->alertContext->ewkView, alertTextBuffer.get(), impl->alertContext->userData) == EINA_TRUE;
3031 bool ewkViewRunJavaScriptConfirm(Evas_Object* ewkView, WKStringRef message)
3033 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3034 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3035 if (!impl->confirmContext || !impl->confirmContext->javascriptConfirmCallback)
3037 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->confirmContext->ewkView == ewkView, false);
3039 impl->isWaitingForJavaScriptPopupReply = true;
3040 int length = WKStringGetMaximumUTF8CStringSize(message);
3041 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3042 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3043 return impl->confirmContext->javascriptConfirmCallback(impl->confirmContext->ewkView, messageBuffer.get(), impl->confirmContext->userData) == EINA_TRUE;
3046 bool ewkViewRunJavaScriptPrompt(Evas_Object* ewkView, WKStringRef message, WKStringRef defaultValue)
3048 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3049 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3050 if (!impl->promptContext || !impl->promptContext->javascriptPromptCallback)
3052 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->promptContext->ewkView == ewkView, false);
3054 impl->isWaitingForJavaScriptPopupReply = true;
3055 int length = WKStringGetMaximumUTF8CStringSize(message);
3056 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3057 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3058 length = WKStringGetMaximumUTF8CStringSize(defaultValue);
3059 OwnArrayPtr<char> defaultValueBuffer = adoptArrayPtr(new char[length]);
3060 WKStringGetUTF8CString(defaultValue, defaultValueBuffer.get(), length);
3061 return impl->promptContext->javascriptPromptCallback(impl->promptContext->ewkView, messageBuffer.get(), defaultValueBuffer.get(), impl->promptContext->userData) == EINA_TRUE;
3064 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
3065 bool ewk_view_run_before_unload_confirm_panel(Evas_Object* ewkView, WKStringRef message)
3067 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3068 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3069 if (!impl->beforeUnloadConfirmPanelContext || !impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback)
3071 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->beforeUnloadConfirmPanelContext->ewkView == ewkView, false);
3073 impl->isWaitingForJavaScriptPopupReply = true;
3074 int length = WKStringGetMaximumUTF8CStringSize(message);
3075 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3076 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3077 bool result = impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback(impl->beforeUnloadConfirmPanelContext->ewkView, messageBuffer.get(), impl->beforeUnloadConfirmPanelContext->userData) == EINA_TRUE;
3082 bool ewkViewRunOpenPanel(Evas_Object* ewkView, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener)
3084 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3085 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3086 if (!impl->openpanelContext || !impl->openpanelContext->openPanelCallback)
3089 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->openpanelContext->ewkView == ewkView, false);
3091 impl->openPanelListener = listener;
3093 Eina_Bool allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? EINA_TRUE : EINA_FALSE;
3094 Eina_List* acceptedMimeTypes = 0;
3095 WKRetainPtr<WKArrayRef> array(AdoptWK, WKOpenPanelParametersCopyAcceptedMIMETypes(parameters));
3096 size_t len = WKArrayGetSize(array.get());
3097 for (size_t i = 0; i < len; i++) {
3098 WKTypeRef item = WKArrayGetItemAtIndex(array.get(), i);
3099 if (WKGetTypeID(item) != WKStringGetTypeID())
3101 WKStringRef mime = static_cast<WKStringRef>(item);
3102 int length = WKStringGetMaximumUTF8CStringSize(mime);
3103 char* buffer = new char[length];
3104 WKStringGetUTF8CString(mime, buffer, length);
3105 acceptedMimeTypes = eina_list_append(acceptedMimeTypes, static_cast<const void*>(const_cast<const char*>(buffer)));
3107 const char* capture = 0;
3108 #if ENABLE(MEDIA_CAPTURE)
3109 WKRetainPtr<WKStringRef> captureRef(AdoptWK, WKOpenPanelParametersCopyCapture(parameters));
3110 capture = eina_stringshare_add(toImpl(captureRef.get())->string().utf8().data());
3112 bool result = impl->openpanelContext->openPanelCallback(impl->openpanelContext->ewkView, allowMultipleFiles, acceptedMimeTypes, capture, 0);
3113 if (!acceptedMimeTypes)
3118 EINA_LIST_FOREACH(acceptedMimeTypes, list, data)
3119 delete[] (char*)data;
3120 eina_list_free(acceptedMimeTypes);
3124 void ewk_view_javascript_alert_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Alert_Callback callback, void* userData)
3126 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3127 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3129 if (!impl->alertContext)
3130 impl->alertContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3131 impl->alertContext->javascriptAlertCallback = callback;
3132 impl->alertContext->ewkView = ewkView;
3133 impl->alertContext->userData = userData;
3136 void ewk_view_javascript_alert_reply(Evas_Object* ewkView)
3138 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3139 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3141 WKPageReplyJavaScriptAlert(toAPI(impl->page()));
3142 impl->isWaitingForJavaScriptPopupReply = false;
3145 void ewk_view_javascript_confirm_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Confirm_Callback callback, void* userData)
3147 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3148 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3150 if (!impl->confirmContext)
3151 impl->confirmContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3152 impl->confirmContext->javascriptConfirmCallback = callback;
3153 impl->confirmContext->ewkView = ewkView;
3154 impl->confirmContext->userData = userData;
3157 void ewk_view_javascript_confirm_reply(Evas_Object* ewkView, Eina_Bool result)
3159 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3160 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3162 WKPageReplyJavaScriptConfirm(toAPI(impl->page()), result == EINA_TRUE);
3163 impl->isWaitingForJavaScriptPopupReply = false;
3166 void ewk_view_javascript_prompt_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Prompt_Callback callback, void* userData)
3168 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3169 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3171 if (!impl->promptContext)
3172 impl->promptContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3173 impl->promptContext->javascriptPromptCallback = callback;
3174 impl->promptContext->ewkView = ewkView;
3175 impl->promptContext->userData = userData;
3178 void ewk_view_javascript_prompt_reply(Evas_Object* ewkView, const char* result)
3180 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3181 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3183 WKRetainPtr<WKStringRef> resultString(AdoptWK, WKStringCreateWithUTF8CString(result));
3184 WKPageReplyJavaScriptPrompt(toAPI(impl->page()), result ? resultString.get() : 0);
3185 impl->isWaitingForJavaScriptPopupReply = false;
3188 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
3189 void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* ewkView, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* userData)
3191 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3192 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3194 if (!impl->beforeUnloadConfirmPanelContext)
3195 impl->beforeUnloadConfirmPanelContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3196 impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback = callback;
3197 impl->beforeUnloadConfirmPanelContext->ewkView = ewkView;
3198 impl->beforeUnloadConfirmPanelContext->userData = userData;
3201 void ewk_view_before_unload_confirm_panel_reply(Evas_Object* ewkView, Eina_Bool result)
3203 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3204 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3206 WKPageReplyBeforeUnloadConfirmPanel(toAPI(impl->page()), result == EINA_TRUE);
3207 impl->isWaitingForJavaScriptPopupReply = false;
3211 void ewk_view_open_panel_callback_set(Evas_Object* ewkView, Ewk_View_Open_Panel_Callback callback, void* userData)
3213 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3214 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3216 if (!impl->openpanelContext)
3217 impl->openpanelContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3219 impl->openpanelContext->openPanelCallback = callback;
3220 impl->openpanelContext->ewkView = ewkView;
3221 impl->openpanelContext->userData = userData;
3224 void ewk_view_open_panel_reply(Evas_Object* ewkView, Eina_List* fileUrls, Eina_Bool result)
3226 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3227 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3229 if (!impl->openPanelListener)
3232 unsigned int size = eina_list_count(fileUrls);
3233 if ((result == EINA_FALSE) || (size == 0)) {
3234 WKOpenPanelResultListenerCancel(impl->openPanelListener);
3235 impl->openPanelListener = 0;
3239 WKTypeRef* items = new WKTypeRef[size];
3243 KURL base(KURL(), "file://");
3244 EINA_LIST_FOREACH(fileUrls, list, data) {
3245 KURL url(base, static_cast<char*>(data));
3246 items[i++] = WKURLCreateWithUTF8CString(url.string().utf8().data());
3248 WKRetainPtr<WKArrayRef> filesArray(AdoptWK, WKArrayCreate(items, size));
3249 WKOpenPanelResultListenerChooseFiles(impl->openPanelListener, filesArray.get());
3250 impl->openPanelListener = 0;
3252 eina_list_free(fileUrls);
3255 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3256 static void didGetWebAppCapable(WKBooleanRef capable, WKErrorRef, void* context)
3258 EINA_SAFETY_ON_NULL_RETURN(capable);
3259 EINA_SAFETY_ON_NULL_RETURN(context);
3261 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3263 ASSERT(webAppContext->webAppCapableCallback);
3265 TIZEN_LOGI("webAppCapableCallback exist. capable(%b)", capable);
3267 webAppContext->webAppCapableCallback(toImpl(capable)->value(), webAppContext->userData);
3269 webAppContext->webAppCapableCallback(0, webAppContext->userData);
3271 delete webAppContext;
3274 static void didGetWebAppIconURL(WKStringRef iconURL, WKErrorRef, void* context)
3276 EINA_SAFETY_ON_NULL_RETURN(iconURL);
3277 EINA_SAFETY_ON_NULL_RETURN(context);
3279 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3281 EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
3282 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3284 ASSERT(webAppContext->webAppIconURLCallback);
3287 impl->webAppIconURL = toImpl(iconURL)->string().utf8().data();
3288 webAppContext->webAppIconURLCallback(impl->webAppIconURL, webAppContext->userData);
3290 webAppContext->webAppIconURLCallback(0, webAppContext->userData);
3292 delete webAppContext;
3295 static void didGetWebAppIconURLs(WKDictionaryRef iconURLs, WKErrorRef, void* context)
3297 EINA_SAFETY_ON_NULL_RETURN(iconURLs);
3298 EINA_SAFETY_ON_NULL_RETURN(context);
3300 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3302 EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
3303 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3305 ASSERT(webAppContext->webAppIconURLsCallback);
3307 if (impl->webAppIconURLs) {
3309 EINA_LIST_FREE(impl->webAppIconURLs, data)
3310 ewkWebAppIconDataDelete(static_cast<Ewk_Web_App_Icon_Data*>(data));
3313 WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(iconURLs));
3314 size_t iconURLCount = WKArrayGetSize(wkKeys.get());
3315 for (size_t i = 0; i < iconURLCount; i++) {
3316 WKStringRef urlRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));
3317 WKStringRef sizeRef = static_cast<WKStringRef>(WKDictionaryGetItemForKey(iconURLs, urlRef));
3318 impl->webAppIconURLs = eina_list_append(impl->webAppIconURLs, ewkWebAppIconDataCreate(sizeRef, urlRef));
3320 TIZEN_LOGI("webAppIconURLsCallback exist. found %d icon urls", iconURLCount);
3322 webAppContext->webAppIconURLsCallback(impl->webAppIconURLs, webAppContext->userData);
3323 delete webAppContext;
3327 Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App_Capable_Get_Callback callback, void* userData)
3329 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3330 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3331 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3332 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3334 TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
3335 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3336 context->webAppCapableCallback = callback;
3337 context->ewkView = ewkView;
3338 context->userData = userData;
3340 WKPageGetWebAppCapable(toAPI(impl->pageProxy.get()), context, didGetWebAppCapable);
3348 Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URL_Get_Callback callback, void* userData)
3350 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3351 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3352 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3353 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3355 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3356 context->webAppIconURLCallback = callback;
3357 context->ewkView = ewkView;
3358 context->userData = userData;
3360 WKPageGetWebAppIconURL(toAPI(impl->page()), context, didGetWebAppIconURL);
3368 Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* userData)
3370 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3371 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3372 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3373 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3375 TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
3376 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3377 context->webAppIconURLsCallback = callback;
3378 context->ewkView = ewkView;
3379 context->userData = userData;
3381 WKPageGetWebAppIconURLs(toAPI(impl->page()), context, didGetWebAppIconURLs);
3385 UNUSED_PARAM(ewkView);
3386 UNUSED_PARAM(callback);
3387 UNUSED_PARAM(userData);
3392 Eina_Bool ewk_view_command_execute(Evas_Object* ewkView, const char* command, const char* value)
3394 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3395 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3396 EINA_SAFETY_ON_NULL_RETURN_VAL(command, false);
3398 WKRetainPtr<WKStringRef> commandString(AdoptWK, WKStringCreateWithUTF8CString(command));
3399 WKRetainPtr<WKStringRef> valueString(AdoptWK, WKStringCreateWithUTF8CString(value));
3400 WKPageExecuteCommandWithArgument(toAPI(impl->pageProxy.get()), commandString.get(), valueString.get());
3405 Eina_Bool ewk_view_contents_size_get(Evas_Object* ewkView, Evas_Coord* width, Evas_Coord* height)
3412 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3413 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3415 IntSize contentsSize = impl->pageProxy->contentsSize();
3418 *width = contentsSize.width();
3420 *height = contentsSize.height();
3425 Eina_Bool ewk_view_contents_pdf_get_temp(Evas_Object* ewkView, int width, int height, const char* fileName)
3427 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
3428 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3429 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3430 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false);
3432 IntSize contentsSize = impl->pageProxy->contentsSize();
3433 WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName));
3441 Eina_Bool ewk_view_contents_pdf_get(Evas_Object* ewkView, int width, int height, const char* fileName)
3443 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
3444 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3445 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3446 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false);
3448 IntSize contentsSize = impl->pageProxy->contentsSize();
3449 WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName));
3457 static void runJavaScriptCallback(WKSerializedScriptValueRef scriptValue, WKErrorRef error, void* context)
3459 EINA_SAFETY_ON_NULL_RETURN(context);
3460 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3462 if (!callbackContext->scriptExecuteCallback) {
3463 delete callbackContext;
3467 JSGlobalContextRef jsGlobalContext = ewkViewGetJavascriptGlobalContext(callbackContext->ewkView);
3470 JSValueRef value = WKSerializedScriptValueDeserialize(scriptValue, jsGlobalContext, 0);
3471 JSRetainPtr<JSStringRef> jsStringValue(JSValueToStringCopy(jsGlobalContext, value, 0));
3472 size_t length = JSStringGetMaximumUTF8CStringSize(jsStringValue.get());
3473 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
3474 JSStringGetUTF8CString(jsStringValue.get(), buffer.get(), length);
3475 callbackContext->scriptExecuteCallback(callbackContext->ewkView, buffer.get(), callbackContext->userData);
3477 callbackContext->scriptExecuteCallback(callbackContext->ewkView, 0, callbackContext->userData);
3479 delete callbackContext;
3482 Eina_Bool ewk_view_script_execute(Evas_Object* ewkView, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data)
3484 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3485 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3486 EINA_SAFETY_ON_NULL_RETURN_VAL(script, false);
3487 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false);
3489 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3490 context->scriptExecuteCallback = callback;
3491 context->ewkView = ewkView;
3492 context->userData = user_data;
3493 WKRetainPtr<WKStringRef> scriptString(AdoptWK, WKStringCreateWithUTF8CString(script));
3494 WKPageRunJavaScriptInMainFrame(toAPI(impl->pageProxy.get()), scriptString.get(), context, runJavaScriptCallback);
3499 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
3500 static void didGetWebStorageQuota(WKUInt32Ref quota, WKErrorRef error, void* context)
3502 Ewk_View_Callback_Context* storageContext = static_cast<Ewk_View_Callback_Context*>(context);
3505 storageContext->webStorageQuotaCallback(toImpl(quota)->value(), storageContext->userData);
3507 storageContext->webStorageQuotaCallback(0, storageContext->userData);
3509 delete storageContext;
3513 Eina_Bool ewk_view_web_storage_quota_get(const Evas_Object* ewkView, Ewk_Web_Storage_Quota_Get_Callback resultCallback, void* userData)
3515 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
3516 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false);
3517 EINA_SAFETY_ON_NULL_RETURN_VAL(resultCallback, false);
3518 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3519 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3520 TIZEN_LOGI("resultCallback (%p)", resultCallback);
3522 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3523 context->webStorageQuotaCallback = resultCallback;
3524 context->userData = userData;
3526 WKPageRef pageRef = toAPI(impl->page());
3527 WKPageGetWebStorageQuota(pageRef, context, didGetWebStorageQuota);
3535 Eina_Bool ewk_view_web_storage_quota_set(Evas_Object* ewkView, uint32_t quota)
3537 #if ENABLE(TIZEN_WEB_STORAGE)
3538 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false);
3539 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3540 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3542 TIZEN_LOGI("quota (%d)", quota);
3543 WKPageRef pageRef = toAPI(impl->page());
3544 WKPageSetWebStorageQuota(pageRef, quota);
3552 static void getContentsAsStringCallback(WKStringRef plain_text, WKErrorRef error, void* context)
3554 EINA_SAFETY_ON_NULL_RETURN(context);
3555 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3557 ASSERT(callbackContext->plainTextGetCallback);
3560 size_t length = WKStringGetMaximumUTF8CStringSize(plain_text);
3561 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
3562 WKStringGetUTF8CString(plain_text, buffer.get(), length);
3564 callbackContext->plainTextGetCallback(callbackContext->ewkView, buffer.get(), callbackContext->userData);
3566 callbackContext->plainTextGetCallback(callbackContext->ewkView, 0, callbackContext->userData);
3568 delete callbackContext;
3571 Eina_Bool ewk_view_plain_text_get(Evas_Object* ewkView, Ewk_View_Plain_Text_Get_Callback callback, void* user_data)
3573 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3574 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3575 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3576 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false);
3578 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3579 context->plainTextGetCallback = callback;
3580 context->ewkView = ewkView;
3581 context->userData = user_data;
3582 WKPageGetContentsAsString(toAPI(impl->pageProxy.get()), context, getContentsAsStringCallback);
3587 #if ENABLE(TIZEN_SUPPORT_MHTML)
3590 * Callback function used for ewk_view_mhtml_data_get().
3592 static void getContentsAsMHTMLCallback(WKDataRef wkData, WKErrorRef, void* context)
3594 EINA_SAFETY_ON_NULL_RETURN(context);
3595 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3597 ASSERT(callbackContext->mhtmlDataGetCallback);
3599 callbackContext->mhtmlDataGetCallback(callbackContext->ewkView, reinterpret_cast<const char*>(WKDataGetBytes(wkData)), callbackContext->userData);
3601 delete callbackContext;
3604 Eina_Bool ewk_view_mhtml_data_get(Evas_Object* ewkView, Ewk_View_MHTML_Data_Get_Callback callback, void* user_data)
3606 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3607 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3608 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3610 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3611 context->mhtmlDataGetCallback = callback;
3612 context->ewkView = ewkView;
3613 context->userData = user_data;
3615 WKPageGetContentsAsMHTMLData(toAPI(impl->page()), false, context, getContentsAsMHTMLCallback);
3619 #endif // ENABLE(TIZEN_SUPPORT_MHTML)
3621 Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hitTestMode)
3623 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
3624 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3625 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3627 IntPoint pointForHitTest = impl->transformFromScene().mapPoint(IntPoint(x, y));
3628 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(pointForHitTest, hitTestMode);
3629 Ewk_Hit_Test* hitTest = ewkHitTestCreate(hitTestResultData);
3637 Ewk_History* ewk_view_history_get(Evas_Object* ewkView)
3639 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
3640 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3641 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3642 WebPageProxy* page = impl->page();
3643 EINA_SAFETY_ON_NULL_RETURN_VAL(page, 0);
3645 return ewkHistoryCreate(WKPageGetBackForwardList(toAPI(page)));
3648 Eina_Bool ewk_view_recording_surface_enable_set(Evas_Object* ewkView, Eina_Bool enable)
3650 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3651 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3653 WKPageRecordingSurfaceSetEnable(toAPI(impl->pageProxy.get()), enable);
3658 Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* ewkNotifications)
3660 #if ENABLE(TIZEN_NOTIFICATIONS)
3661 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3662 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3663 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context, false);
3665 TIZEN_LOGI("ewkNotifications (%p)", ewkNotifications);
3666 if (!eina_list_count(ewkNotifications))
3669 Eina_List* listIterator = 0;
3671 Vector<WKTypeRef> ids;
3672 EINA_LIST_FOREACH(ewkNotifications, listIterator, data) {
3673 Ewk_Notification* notification = static_cast<Ewk_Notification*>(data);
3674 WKUInt64Ref idRef = WKUInt64Create(ewk_notification_id_get(notification));
3676 impl->notifications = eina_list_remove(impl->notifications, notification);
3679 WKRetainPtr<WKArrayRef> notificationIDsArray(AdoptWK, WKArrayCreate(ids.data(), ids.size()));
3680 WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(impl->context->wkContext());
3681 WKNotificationManagerProviderDidCloseNotifications(notificationManager, notificationIDsArray.get());
3682 ewkNotificationDeleteNotificationList(ewkNotifications);
3690 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3691 static Eina_List* createPopupMenuList(const Vector<WebPopupItem>& items)
3693 Eina_List* popupItems = 0;
3694 size_t size = items.size();
3695 for (size_t i = 0; i < size; ++i)
3696 popupItems = eina_list_append(popupItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr());
3697 TIZEN_LOGI("size : %d", size);
3701 static void releasePopupMenuList(Eina_List* popupMenuItems)
3703 if (!popupMenuItems)
3707 EINA_LIST_FREE(popupMenuItems, item)
3708 delete static_cast<Ewk_Popup_Menu_Item*>(item);
3712 Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView)
3714 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3715 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3716 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
3718 TIZEN_LOGI("proxy : %p", impl->popupMenuProxy);
3721 if (!impl->popupMenuProxy)
3724 impl->popupMenuProxy = 0;
3726 if (smartData->api->popup_menu_hide)
3727 smartData->api->popup_menu_hide(smartData);
3728 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3729 ewk_view_touch_events_enabled_set(ewkView, true);
3731 releasePopupMenuList(impl->popupMenuItems);
3732 impl->popupMenuItems = 0;
3735 EINA_LIST_FREE(impl->popupMenuItems, item)
3736 delete static_cast<Ewk_Popup_Menu_Item*>(item);
3742 Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
3744 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3745 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3746 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
3748 TIZEN_LOGI("proxy : %p / index : %d", impl->popupMenuProxy, selectedIndex);
3750 if (!impl->popupMenuItems)
3754 if (selectedIndex >= eina_list_count(impl->popupMenuItems))
3757 impl->popupMenuProxy->valueChanged(selectedIndex);
3762 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3763 void ewk_view_popup_menu_update(Evas_Object* ewkView, TextDirection textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex)
3765 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3766 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3767 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3768 TIZEN_LOGI("proxy : %p", impl->popupMenuProxy);
3770 if (!impl->popupMenuProxy)
3773 if (!smartData->api->popup_menu_update)
3776 releasePopupMenuList(impl->popupMenuItems);
3777 impl->popupMenuItems = createPopupMenuList(items);
3779 // TODO: Instead of passing a dummy rect, updated rect should be coming from WebProcess
3780 smartData->api->popup_menu_update(smartData, IntRect(), static_cast<Ewk_Text_Direction>(textDirection), impl->popupMenuItems, selectedIndex);
3784 #if ENABLE(TIZEN_MULTIPLE_SELECT)
3785 Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray* changeList)
3787 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3788 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3789 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
3791 Vector<int> selectedIndex;
3793 if (!impl->popupMenuItems)
3798 itr = eina_inarray_iterator_new(changeList);
3799 EINA_ITERATOR_FOREACH(itr, data)
3801 int* pData = static_cast<int*>(data);
3802 selectedIndex.append(*pData);
3804 eina_iterator_free(itr);
3806 impl->popupMenuProxy->multipleValueChanged(selectedIndex);
3811 void ewk_view_orientation_send(Evas_Object* ewkView, int orientation)
3813 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
3814 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3815 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3816 TIZEN_LOGI("orientation : %d", orientation);
3818 if (orientation != 0 && orientation != 90 && orientation != -90 && orientation != 180)
3821 if (impl->orientation == orientation)
3824 impl->orientation = orientation;
3826 impl->pageProxy->sendOrientationChangeEvent(orientation);
3830 void ewkViewFrameRendered(Evas_Object* ewkView)
3832 evas_object_smart_callback_call(ewkView, "frame,rendered", 0);
3835 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3836 Eina_Bool ewk_view_text_selection_enable_set(Evas_Object* ewkView, Eina_Bool enable)
3838 return ewk_settings_text_selection_enabled_set(ewk_view_settings_get(ewkView), enable);
3841 Eina_Bool ewk_view_text_selection_range_get(Evas_Object* ewkView, Eina_Rectangle* leftRect, Eina_Rectangle* rightRect)
3843 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3844 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3846 IntRect leftSelectionRect;
3847 IntRect rightSelectionRect;
3848 if (!impl->pageProxy->getSelectionHandlers(leftSelectionRect, rightSelectionRect)) {
3861 AffineTransform contentToScreen = impl->transformToScene();
3862 leftSelectionRect = contentToScreen.mapRect(leftSelectionRect);
3863 rightSelectionRect = contentToScreen.mapRect(rightSelectionRect);
3865 leftRect->x = leftSelectionRect.x();
3866 leftRect->y = leftSelectionRect.y();
3867 leftRect->w = leftSelectionRect.width();
3868 leftRect->h = leftSelectionRect.height();
3870 rightRect->x = rightSelectionRect.x();
3871 rightRect->y = rightSelectionRect.y();
3872 rightRect->w = rightSelectionRect.width();
3873 rightRect->h = rightSelectionRect.height();
3878 const char* ewk_view_text_selection_text_get(Evas_Object* ewkView)
3880 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3881 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3883 const CString selectedString = impl->pageProxy->getSelectionText().utf8();
3884 impl->selectedText = selectedString.data();
3886 return impl->selectedText;
3889 Eina_Bool ewk_view_auto_clear_text_selection_mode_set(Evas_Object* ewkView, Eina_Bool enable)
3891 return ewk_settings_clear_text_selection_automatically_set(ewk_view_settings_get(ewkView), enable);
3894 Eina_Bool ewk_view_auto_clear_text_selection_mode_get(Evas_Object* ewkView)
3896 return ewk_settings_clear_text_selection_automatically_get(ewk_view_settings_get(ewkView));
3898 #endif // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3900 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3901 void ewkViewInputPickerRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, const String& inputValue)
3903 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3904 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3905 EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_show);
3907 smartData->api->input_picker_show(smartData, inputType, inputValue.utf8().data());
3911 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
3912 void ewkViewGetWindowFrame(Evas_Object* ewkView, int *x, int *y, int *w, int *h)
3914 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3915 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3916 IntPoint drawingPosition = (IntPoint)(impl->pageClient->visibleContentRect().location() - impl->pageClient->scrollPosition());
3918 *x = drawingPosition.x();
3920 *y = drawingPosition.y();
3922 *w = impl->pageClient->visibleContentRect().width();
3924 *h = impl->pageClient->visibleContentRect().height();
3928 void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)
3930 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3931 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3932 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3934 impl->pageProxy->setFocusedInputElementValue(String::fromUTF8(value));
3935 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3938 const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView)
3940 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3941 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3942 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3944 impl->inputValue = impl->pageProxy->getFocusedInputElementValue().utf8().data();
3945 return impl->inputValue;
3948 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3951 #if ENABLE(TIZEN_DATALIST_ELEMENT)
3952 void ewkViewDataListShowRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, Vector<String> optionList)
3954 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3955 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3956 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3957 EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_show);
3960 ewkViewDataListHideRequest(ewkView, inputType);
3962 for (Vector<String>::const_iterator it = optionList.begin(); it != optionList.end(); ++it) {
3964 impl->dataList = eina_list_append(impl->dataList, eina_stringshare_add(value.utf8().data()));
3967 smartData->api->data_list_show(smartData, inputType, impl->dataList);
3970 void ewkViewDataListHideRequest(Evas_Object* ewkView, Ewk_Input_Type inputType)
3972 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3973 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3974 EINA_SAFETY_ON_NULL_RETURN(impl->dataList);
3975 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3976 EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_hide);
3978 impl->deleteDataList();
3980 smartData->api->data_list_hide(smartData, inputType);
3984 void ewk_view_data_list_close(Evas_Object* ewkView, const char* value)
3986 #if ENABLE(TIZEN_DATALIST_ELEMENT)
3987 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3988 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3990 impl->deleteDataList();
3992 ewk_view_focused_input_element_value_set(ewkView, value);
3996 Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* ewkView)
3998 #if ENABLE(TIZEN_GESTURE)
3999 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4000 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4001 return impl->holdHorizontalPanning;
4007 void ewk_view_horizontal_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold)
4009 #if ENABLE(TIZEN_GESTURE)
4010 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4011 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4012 impl->holdHorizontalPanning = hold;
4016 Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView)
4018 #if ENABLE(TIZEN_GESTURE)
4019 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4020 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4021 return impl->holdVerticalPanning;
4027 void ewk_view_vertical_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold)
4029 #if ENABLE(TIZEN_GESTURE)
4030 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4031 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4032 impl->holdVerticalPanning = hold;
4036 void ewk_view_touch_event_handler_result_set(Evas_Object* ewkView, WebKit::WebEvent::Type type, bool wasHandled)
4038 #if ENABLE(TIZEN_GESTURE)
4039 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4040 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4042 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4043 if (impl->focusRing && wasHandled)
4044 impl->focusRing->hide();
4045 #endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4047 if (impl->mouseEventsEnabled())
4050 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
4051 if (wasHandled && impl->pageClient->isTextSelectionMode()) {
4052 if (type == WebEvent::TouchStart)
4053 impl->pageClient->updateTextSelectionHandlesAndContextMenu(false);
4054 else if (type == WebEvent::TouchMove)
4055 impl->pageClient->updateTextSelectionHandlesAndContextMenu(false);
4056 else if (type == WebEvent::TouchEnd)
4057 impl->pageClient->requestToShowTextSelectionHandlesAndContextMenu();
4061 // We have to check TouchStart, TouchMove and TouchEnd with handled.
4062 // The Pan and Flick will be enabled if Touch Start was not handled,
4063 // and Touch Move was not handled or did not occur.
4064 // Tap will be enabled if Touch Start and End was not handled
4065 // and Touch Move did not occur.
4066 // The gestures are disabled as a default.
4067 // o: handled, x: not handled
4068 // ------------------------------------------------------------
4069 // Touch Start | Touch Move | Touch End || Tap | Pan, Flick
4070 // ------------------------------------------------------------
4071 // o | o or x | o or x || disable | disable
4072 // x | o | o or x || disable | disable
4073 // x | x | o or x || disable | enable
4074 // x |not occured | x || enable | enable
4075 // ------------------------------------------------------------
4076 if (type == WebEvent::TouchStart) {
4077 impl->gestureClient->setGestureEnabled(!wasHandled);
4078 impl->wasHandledTouchStart = wasHandled;
4080 // Initialize wasHandledTouchMove to true and notify that to the application
4081 // to prevent applications scrolling at the beginning of touch.
4082 impl->wasHandledTouchMove = true;
4083 evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast<void*>(&impl->wasHandledTouchMove));
4084 } else if (type == WebEvent::TouchMove) {
4085 impl->gestureClient->setMovingEnabled(!wasHandled);
4087 // We have to set wasHandled to true if touchstart was handled even though current touchmove was not handled.
4088 if (impl->wasHandledTouchStart)
4091 // Notify the result of touchmove to applications when handled value is changed
4092 // in order to make applications to choose whether scrolling its scrollable objects or not.
4093 if (impl->wasHandledTouchMove != wasHandled)
4094 evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast<void*>(&wasHandled));
4095 impl->wasHandledTouchMove = wasHandled;
4096 } else if (type == WebEvent::TouchEnd && !impl->exceedTouchMoveThreshold && !wasHandled) {
4097 impl->gestureClient->setMovingEnabled(!wasHandled);
4098 impl->gestureClient->setTapEnabled(!wasHandled);
4103 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
4104 void ewkViewDidGetTextStyleStateForSelection(Evas_Object* ewkView, int underlineState, int italicState, int boldState, const IntPoint& startPoint, const IntPoint& endPoint)
4106 Ewk_Text_Style* textStyle = ewkTextStyleCreate(underlineState, italicState, boldState, startPoint, endPoint);
4107 evas_object_smart_callback_call(ewkView, "text,style,state", static_cast<void*>(textStyle));
4108 ewkTextStyleDelete(textStyle);
4112 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
4113 bool ewk_view_orientation_lock(Evas_Object* ewkView, int willLockOrientation)
4115 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4116 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
4118 TIZEN_LOGI("willLockOrientation (%d)", willLockOrientation);
4119 if (!smartData->api->orientation_lock) {
4124 return smartData->api->orientation_lock(smartData, willLockOrientation);
4127 void ewk_view_orientation_unlock(Evas_Object* ewkView)
4129 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4130 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
4132 TIZEN_LOGI("ewkView (%p)", ewkView);
4133 if (!smartData->api->orientation_unlock) {
4138 smartData->api->orientation_unlock(smartData);
4142 void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data)
4144 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
4145 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4146 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4147 TIZEN_LOGI("callbacks: %p / data: %p", func, data);
4149 impl->orientationLock.callback = func;
4150 impl->orientationLock.data = data;
4154 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
4155 Eina_Bool _ewk_orientation_lock(Ewk_View_Smart_Data *sd, int orientations)
4157 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false);
4158 TIZEN_LOGI("locked orientations : %d", orientations);
4160 if (impl->orientationLock.callback)
4161 return impl->orientationLock.callback(sd->self, true, orientations, impl->orientationLock.data);
4166 void _ewk_orientation_unlock(Ewk_View_Smart_Data *sd)
4168 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
4169 TIZEN_LOGI("unlock is requested");
4171 if (impl->orientationLock.callback)
4172 impl->orientationLock.callback(sd->self, false, 0, impl->orientationLock.data);
4176 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
4177 bool ewk_view_is_opengl_backend(Evas_Object* ewkView)
4179 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4181 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
4182 const char *engine = ecore_evas_engine_name_get(ee);
4183 if (engine && !strcmp(engine, "opengl_x11"))
4189 void ewk_view_zoomable_area_set(Evas_Object* ewkView, const IntPoint& target, const IntRect& area)
4191 #if ENABLE(TIZEN_GESTURE)
4192 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4193 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4195 impl->gestureClient->setZoomableArea(target, area);
4199 #if ENABLE(TIZEN_BACKFORWARD_LIST_CLEAR)
4200 void ewk_view_back_forward_list_clear(const Evas_Object* ewkView)
4202 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4203 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4205 WKBackForwardListClearBackForwardList(WKPageGetBackForwardList(toAPI(impl->pageProxy.get())));
4209 #if ENABLE(TIZEN_SIGNAL_APP_BACK_FORWARD_LIST_CHANGED)
4210 void ewkViewBackForwardListChanged(Evas_Object* ewkView)
4212 evas_object_smart_callback_call(ewkView, "back,forward,list,changed", 0);
4216 #if ENABLE(TIZEN_ICON_DATABASE)
4217 void ewkViewIconReceived(Evas_Object* ewkView)
4221 evas_object_smart_callback_call(ewkView, "icon,received", 0);
4225 #endif // #if OS(TIZEN)
4227 Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers)
4229 #if ENABLE(TOUCH_EVENTS)
4230 EINA_SAFETY_ON_NULL_RETURN_VAL(points, false);
4231 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4232 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4234 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
4235 if (impl->pageClient->isTextSelectionMode() && eina_list_count(points) == 1) {
4236 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4237 IntPoint handlePoint(point->x, point->y);
4239 if (type == EWK_TOUCH_START)
4240 impl->pageClient->textSelectonHandleDown(handlePoint);
4241 else if (type == EWK_TOUCH_MOVE)
4242 impl->pageClient->textSelectonHandleMove(handlePoint);
4244 impl->pageClient->textSelectonHandleUp();
4248 #if ENABLE(TIZEN_GESTURE)
4249 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
4250 // We don't want to process touch event when context menu is shown.
4251 if (impl->pageClient->isContextMenuVisible() && type != EWK_TOUCH_CANCEL)
4254 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
4255 if (impl->pageClient->isTextSelectionDowned() && type != EWK_TOUCH_CANCEL)
4259 if (type == EWK_TOUCH_START) {
4260 if (eina_list_count(points) == 1) {
4261 impl->gestureClient->reset();
4262 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4263 impl->touchDownPoint.x = point->x;
4264 impl->touchDownPoint.y = point->y;
4265 impl->exceedTouchMoveThreshold = false;
4267 } else if (type == EWK_TOUCH_MOVE && !impl->exceedTouchMoveThreshold) {
4268 if (eina_list_count(points) == 1) {
4269 unsigned int threshold = elm_config_scroll_thumbscroll_threshold_get();
4270 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4271 int diffX = impl->touchDownPoint.x - point->x;
4272 int diffY = impl->touchDownPoint.y - point->y;
4273 if (static_cast<unsigned int>(diffX * diffX + diffY * diffY) > threshold * threshold)
4274 impl->exceedTouchMoveThreshold = true;
4278 impl->exceedTouchMoveThreshold = true;
4281 #endif // #if ENABLE(TIZEN_GESTURE)
4283 // FIXME: impl is used in the webkit opensource, but tizen webkit does not use it yet.
4284 //impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
4285 impl->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
4293 Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
4295 #if ENABLE(TOUCH_EVENTS)
4296 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4297 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4299 impl->setTouchEventsEnabled(!!enabled);
4307 Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView)
4309 #if ENABLE(TOUCH_EVENTS)
4310 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4311 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4313 return impl->touchEventsEnabled();
4319 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewkView, Eina_Bool visible)
4321 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
4322 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4323 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4325 impl->mainFrameScrollbarVisibility = visible;
4326 impl->pageClient->updateVisibility();
4334 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(const Evas_Object* ewkView)
4336 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
4337 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4338 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4340 return impl->mainFrameScrollbarVisibility;
4346 Eina_Bool ewk_view_page_save(Evas_Object* ewkView, const char* path)
4348 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
4349 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4350 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4351 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
4353 String title = ewk_view_title_get(ewkView);
4354 String url = ewk_view_url_get(ewkView);
4355 String directoryPath(path);
4356 impl->pageClient->startOfflinePageSave(directoryPath, url, title);
4360 UNUSED_PARAM(ewkView);
4368 * Callback function used for ewk_view_page_contents_get().
4370 static void ewkViewPageContentsAsMHTMLCallback(WKDataRef wkData, WKErrorRef, void* context)
4372 EINA_SAFETY_ON_NULL_RETURN(context);
4374 RefPtr<WebData> webData = toImpl(wkData);
4375 Ewk_Page_Contents_Context* contentsContext= static_cast<Ewk_Page_Contents_Context*>(context);
4376 contentsContext->callback(contentsContext->type, reinterpret_cast<const char*>(webData->bytes()));
4381 * Callback function used for ewk_view_page_contents_get().
4383 static void ewkViewPageContentsAsStringCallback(WKStringRef wkString, WKErrorRef, void* context)
4385 EINA_SAFETY_ON_NULL_RETURN(context);
4387 RefPtr<WebString> webString = toImpl(wkString);
4388 Ewk_Page_Contents_Context* contentsContext= static_cast<Ewk_Page_Contents_Context*>(context);
4389 contentsContext->callback(contentsContext->type, webString->string().utf8().data());
4392 Eina_Bool ewk_view_page_contents_get(const Evas_Object* ewkView, Ewk_Page_Contents_Context* context)
4394 EINA_SAFETY_ON_NULL_RETURN_VAL(context, false);
4395 EINA_SAFETY_ON_NULL_RETURN_VAL(context->callback, false);
4396 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4397 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4399 switch (context->type) {
4400 case EWK_PAGE_CONTENTS_TYPE_MHTML:
4401 impl->pageProxy->getContentsAsMHTMLData(DataCallback::create(context, ewkViewPageContentsAsMHTMLCallback), false);
4404 case EWK_PAGE_CONTENTS_TYPE_STRING:
4405 impl->pageProxy->getContentsAsString(StringCallback::create(context, ewkViewPageContentsAsStringCallback));
4409 ASSERT_NOT_REACHED();
4416 Eina_Bool ewk_view_animated_scroll_set(Evas_Object* ewkView, int x, int y)
4418 #if ENABLE(TIZEN_GESTURE)
4419 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4420 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4422 return impl->gestureClient->scrollToWithAnimation(x, y);
4424 UNUSED_PARAM(ewkView);
4431 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4432 void ewkViewFocusRingHide(Evas_Object* ewkView)
4434 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4435 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4437 if (impl->focusRing)
4438 impl->focusRing->hide();
4442 void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* policy, Ewk_CSP_Header_Type type)
4444 #if ENABLE(TIZEN_CSP)
4445 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
4446 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
4448 TIZEN_LOGI("policy(%s), type(%d)\n", policy, type);
4449 impl->pageProxy->setContentSecurityPolicy(String::fromUTF8(policy), static_cast<WebCore::ContentSecurityPolicy::HeaderType>(type));
4453 #if ENABLE(TIZEN_APPLICATION_CACHE)
4454 Eina_Bool ewkViewRequestApplicationCachePermission(Evas_Object* ewkView, WKSecurityOriginRef origin)
4456 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4457 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4459 if (!impl->applicationCachePermissionContext || !impl->applicationCachePermissionContext->applicationCachePermissionCallback)
4462 impl->isWaitingForApplicationCachePermission = true;
4463 if (impl->applicationCachePermissionOrigin)
4464 deleteSecurityOrigin(impl->applicationCachePermissionOrigin);
4465 impl->applicationCachePermissionOrigin = createSecurityOrigin(origin);
4467 return impl->applicationCachePermissionContext->applicationCachePermissionCallback(ewkView, impl->applicationCachePermissionOrigin, impl->applicationCachePermissionContext->userData) == EINA_TRUE;
4471 void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData)
4473 #if ENABLE(TIZEN_APPLICATION_CACHE)
4474 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4475 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4477 if (!impl->applicationCachePermissionContext)
4478 impl->applicationCachePermissionContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4479 impl->applicationCachePermissionContext->applicationCachePermissionCallback = callback;
4480 impl->applicationCachePermissionContext->userData = userData;
4482 UNUSED_PARAM(ewkView);
4483 UNUSED_PARAM(callback);
4484 UNUSED_PARAM(userData);
4488 void ewk_view_application_cache_permission_reply(Evas_Object* ewkView, Eina_Bool allow)
4490 #if ENABLE(TIZEN_APPLICATION_CACHE)
4491 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4492 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4494 TIZEN_LOGI("allow %d", allow);
4495 WKPageReplyApplicationCachePermission(toAPI(impl->page()), allow);
4496 if (impl->applicationCachePermissionOrigin)
4497 deleteSecurityOrigin(impl->applicationCachePermissionOrigin);
4498 impl->applicationCachePermissionOrigin = 0;
4499 impl->isWaitingForApplicationCachePermission = false;
4501 UNUSED_PARAM(ewkView);
4502 UNUSED_PARAM(allow);
4506 #if ENABLE(TIZEN_INDEXED_DATABASE)
4507 bool ewkViewExceededIndexedDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage)
4509 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4510 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4512 if (!impl->exceededIndexedDatabaseQuotaContext || !impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback)
4515 impl->isWaitingForExceededQuotaPopupReply = true;
4516 if (impl->exceededQuotaOrigin)
4517 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4518 impl->exceededQuotaOrigin = createSecurityOrigin(origin);
4520 TIZEN_LOGI("currentUsage(%lld)", currentUsage);
4522 return impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback(ewkView, impl->exceededQuotaOrigin, currentUsage, impl->exceededIndexedDatabaseQuotaContext->userData) == EINA_TRUE;
4526 void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
4528 #if ENABLE(TIZEN_INDEXED_DATABASE)
4529 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4530 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4532 if (!impl->exceededIndexedDatabaseQuotaContext)
4533 impl->exceededIndexedDatabaseQuotaContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4534 impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback = callback;
4535 impl->exceededIndexedDatabaseQuotaContext->userData = userData;
4537 UNUSED_PARAM(ewkView);
4538 UNUSED_PARAM(callback);
4539 UNUSED_PARAM(userData);
4543 void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
4545 #if ENABLE(TIZEN_INDEXED_DATABASE)
4546 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4547 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4549 TIZEN_LOGI("allow %d", allow);
4550 WKPageReplyExceededIndexedDatabaseQuota(toAPI(impl->page()), allow == EINA_TRUE);
4551 if (impl->exceededQuotaOrigin)
4552 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4553 impl->exceededQuotaOrigin = 0;
4554 impl->isWaitingForExceededQuotaPopupReply = false;
4556 UNUSED_PARAM(ewkView);
4557 UNUSED_PARAM(allow);
4561 // EwkFindOptions should be matched up orders with WkFindOptions.
4562 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_CASE_INSENSITIVE, kWKFindOptionsCaseInsensitive);
4563 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_AT_WORD_STARTS, kWKFindOptionsAtWordStarts);
4564 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, kWKFindOptionsTreatMedialCapitalAsWordStart);
4565 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_BACKWARDS, kWKFindOptionsBackwards);
4566 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_WRAP_AROUND, kWKFindOptionsWrapAround);
4567 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_OVERLAY, kWKFindOptionsShowOverlay);
4568 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR, kWKFindOptionsShowFindIndicator);
4569 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShowHighlight);
4571 Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
4573 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4574 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4575 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
4577 impl->pageProxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
4582 Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView)
4584 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4585 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4587 impl->pageProxy->hideFindUI();
4592 Eina_Bool ewk_view_text_matches_count(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
4594 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4595 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4596 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
4598 impl->pageProxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
4603 void ewk_view_exceeded_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Database_Quota_Callback callback, void* userData)
4605 #if ENABLE(TIZEN_SQL_DATABASE)
4606 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4607 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4609 if (!impl->exceededDatabaseQuotaContext)
4610 impl->exceededDatabaseQuotaContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4611 impl->exceededDatabaseQuotaContext->exceededDatabaseQuotaCallback = callback;
4612 impl->exceededDatabaseQuotaContext->userData = userData;
4614 UNUSED_PARAM(ewkView);
4615 UNUSED_PARAM(callback);
4616 UNUSED_PARAM(userData);
4620 void ewk_view_exceeded_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
4622 #if ENABLE(TIZEN_SQL_DATABASE)
4623 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4624 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4626 TIZEN_LOGI("allow %d", allow);
4627 WKPageReplyExceededDatabaseQuota(toAPI(impl->page()), allow == EINA_TRUE);
4628 if (impl->exceededQuotaOrigin)
4629 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4630 impl->exceededQuotaOrigin = 0;
4631 impl->isWaitingForExceededQuotaPopupReply = false;
4633 UNUSED_PARAM(ewkView);
4634 UNUSED_PARAM(allow);
4638 #if ENABLE(TIZEN_FILE_SYSTEM)
4639 bool ewkViewExceededLocalFileSystemQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage)
4641 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4642 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4644 if (!impl->exceededLocalFileSystemQuotaContext || !impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback)
4647 impl->isWaitingForExceededQuotaPopupReply = true;
4648 if (impl->exceededQuotaOrigin)
4649 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4650 impl->exceededQuotaOrigin = createSecurityOrigin(origin);
4652 TIZEN_LOGI("currentUsage(%lld)", currentUsage);
4654 return impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback(ewkView, impl->exceededQuotaOrigin , currentUsage, impl->exceededLocalFileSystemQuotaContext->userData) == EINA_TRUE;
4658 void ewk_view_exceeded_local_file_system_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
4660 #if ENABLE(TIZEN_FILE_SYSTEM)
4661 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4662 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4664 if (!impl->exceededLocalFileSystemQuotaContext)
4665 impl->exceededLocalFileSystemQuotaContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4666 impl->exceededLocalFileSystemQuotaContext->exceededLocalFileSystemQuotaCallback = callback;
4667 impl->exceededLocalFileSystemQuotaContext->userData = userData;
4669 UNUSED_PARAM(ewkView);
4670 UNUSED_PARAM(callback);
4671 UNUSED_PARAM(userData);
4675 void ewk_view_exceeded_local_file_system_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
4677 #if ENABLE(TIZEN_FILE_SYSTEM)
4678 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4679 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4681 TIZEN_LOGI("allow %d", allow);
4682 WKPageReplyExceededLocalFileSystemQuota(toAPI(impl->page()), allow == EINA_TRUE);
4683 if (impl->exceededQuotaOrigin)
4684 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4685 impl->exceededQuotaOrigin = 0;
4686 impl->isWaitingForExceededQuotaPopupReply = false;
4688 UNUSED_PARAM(ewkView);
4689 UNUSED_PARAM(result);