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 static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo)
266 Evas_Object* ewkView = static_cast<Evas_Object*>(eventInfo);
267 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
268 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
270 const char* viewURL = ewk_view_url_get(ewkView);
271 if (!viewURL || strcasecmp(viewURL, pageURL))
274 impl->informIconChange();
277 // Default Event Handling.
278 static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData)
280 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
284 impl->pageClient->setViewFocused(true);
285 #endif // #if OS(TIZEN)
286 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
287 #if ENABLE(TIZEN_ISF_PORT)
288 if (impl->inputMethodContext())
289 impl->inputMethodContext()->onFocusIn();
294 static Eina_Bool _ewk_view_smart_focus_out(Ewk_View_Smart_Data* smartData)
296 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
300 #if ENABLE(TIZEN_ISF_PORT)
301 // Keypad should be hidden rapidly when moving focus on elementary
302 // because Ecore-ime doesn't support it.
303 if (impl->inputMethodContext())
304 impl->inputMethodContext()->onFocusOut();
307 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
308 if (impl->pageClient->isTextSelectionMode())
309 impl->pageClient->setIsTextSelectionMode(false);
312 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
313 if (impl->pageClient->isContextMenuVisible())
314 impl->pageProxy->hideContextMenu();
317 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
318 if (impl->pageClient->isClipboardWindowOpened())
319 impl->pageClient->closeClipboardWindow();
322 #if ENABLE(TIZEN_DRAG_SUPPORT)
323 if (impl->pageClient->isDragMode())
324 impl->pageClient->setDragMode(false);
327 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
328 if (smartData->api->formdata_candidate_is_showing(smartData))
329 smartData->api->formdata_candidate_hide(smartData);
332 impl->pageClient->setViewFocused(false);
333 #endif // #if OS(TIZEN)
334 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);
338 static Eina_Bool _ewk_view_smart_mouse_wheel(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Wheel* wheelEvent)
340 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
342 impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, impl->transformFromScene(), impl->transformToScreen()));
346 static Eina_Bool _ewk_view_smart_mouse_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Down* downEvent)
348 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
350 impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, impl->transformFromScene(), impl->transformToScreen()));
354 static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Up* upEvent)
356 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
358 impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, impl->transformFromScene(), impl->transformToScreen()));
360 InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
361 if (inputMethodContext)
362 inputMethodContext->handleMouseUpEvent(upEvent);
367 static Eina_Bool _ewk_view_smart_mouse_move(Ewk_View_Smart_Data* smartData, const Evas_Event_Mouse_Move* moveEvent)
369 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
371 // FIXME: impl->page() is used in the webkit opensource, but tizen webkit does not use it yet.
372 impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, impl->transformFromScene(), impl->transformToScreen()));
376 static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Down* downEvent)
378 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
380 bool isFiltered = false;
381 InputMethodContextEfl* inputMethodContext = impl->inputMethodContext();
382 if (inputMethodContext)
383 inputMethodContext->handleKeyDownEvent(downEvent, &isFiltered);
385 impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered));
389 static Eina_Bool _ewk_view_smart_key_up(Ewk_View_Smart_Data* smartData, const Evas_Event_Key_Up* upEvent)
391 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
393 impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent));
398 static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
400 #if ENABLE(TIZEN_GESTURE)
401 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
403 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
404 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
408 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
409 if (impl->focusRing) {
410 if (event->type == EWK_GESTURE_TAP && event->count == 1) {
411 impl->focusRing->requestToShow(IntPoint(event->position.x, event->position.y));
412 } else if (event->type == EWK_GESTURE_PAN) {
413 if (impl->exceedTouchMoveThreshold)
414 impl->focusRing->hide();
416 if (event->type != EWK_GESTURE_LONG_PRESS) {
417 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
418 if (!impl->pageClient->isContextMenuVisible())
420 impl->focusRing->hide();
426 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
427 if (smartData->api->formdata_candidate_is_showing(smartData))
428 smartData->api->formdata_candidate_hide(smartData);
431 switch (event->type) {
432 case EWK_GESTURE_TAP:
433 impl->gestureClient->startTap(IntPoint(event->position.x, event->position.y));
435 case EWK_GESTURE_LONG_PRESS: {
436 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
437 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
438 if (ewk_settings_text_selection_enabled_get(impl->settings()))
439 impl->pageClient->setIsTextSelectionMode(false);
441 IntPoint scenePoint(event->position.x, event->position.y);
442 IntPoint contentsPoint = impl->transformFromScene().mapPoint(scenePoint);
443 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(contentsPoint);
444 #if ENABLE(TIZEN_DRAG_SUPPORT)
445 // 1. Check to start dragging.
446 if (hitTestResultData.isDragSupport) {
447 impl->pageClient->setDragPoint(scenePoint);
448 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
450 impl->focusRing->show(IntRect(), true);
452 impl->gestureClient->showContextMenu(scenePoint);
456 // 2. Check to show context menu.
457 if (!hitTestResultData.absoluteImageURL.isEmpty()
458 || !hitTestResultData.absoluteLinkURL.isEmpty()
459 || !hitTestResultData.absoluteMediaURL.isEmpty()) {
460 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
462 impl->focusRing->show(IntRect(), true);
464 impl->gestureClient->showContextMenu(scenePoint);
467 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
468 // 3. Check for text selection.
469 if (ewk_settings_text_selection_enabled_get(impl->settings())) {
470 // Process gesture_end(EWK_GESTURE_TAP) to activate the editing if node under point is editable.
471 if (hitTestResultData.context & WebHitTestResult::HitTestResultContextEditable) {
472 if (smartData->api && smartData->api->gesture_end) {
473 Ewk_Event_Gesture tapEvent = {EWK_GESTURE_TAP, event->position, {0, 0}, 0, 1, ecore_time_get() * 1000};
474 smartData->api->gesture_end(smartData, &tapEvent);
478 if (impl->pageClient->textSelectionDown(scenePoint)) {
479 impl->gestureClient->setGestureEnabled(false);
480 impl->feedTouchEventsByType(EWK_TOUCH_CANCEL);
485 #endif // #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
487 case EWK_GESTURE_PAN:
488 impl->gestureClient->startPan(IntPoint(event->position.x, event->position.y));
490 case EWK_GESTURE_FLICK:
491 impl->gestureClient->startFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y));
493 case EWK_GESTURE_PINCH:
494 if (impl->pageClient->viewportConstraints().userScalable)
495 impl->gestureClient->startPinch(IntPoint(event->position.x, event->position.y), event->scale);
498 ASSERT_NOT_REACHED();
505 #endif // #if ENABLE(TIZEN_GESTURE)
508 static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
510 #if ENABLE(TIZEN_GESTURE)
511 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
513 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
514 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
518 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
519 if (impl->focusRing) {
520 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
521 if (!impl->pageClient->isContextMenuVisible())
523 impl->focusRing->hide();
527 switch (event->type) {
528 case EWK_GESTURE_TAP:
529 if (event->count == 1) {
530 #if ENABLE(TIZEN_DRAG_SUPPORT)
531 if (impl->pageClient->isDragMode())
532 impl->pageClient->setDragMode(false);
534 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
535 if (impl->pageClient->isTextSelectionMode())
536 impl->pageClient->setIsTextSelectionMode(false);
538 impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
539 #if ENABLE(TIZEN_ISF_PORT)
540 evas_object_focus_set(smartData->self, true);
542 } else if (event->count == 2)
543 impl->gestureClient->endDoubleTap(IntPoint(event->position.x, event->position.y));
545 case EWK_GESTURE_LONG_PRESS:
546 #if ENABLE(TIZEN_DRAG_SUPPORT)
547 if (impl->pageClient->isDragMode())
548 impl->pageClient->setDragMode(false);
550 // Prcess endTap for LONG_PRESS gesture if text-selection and context menu did not work
551 impl->gestureClient->endTap(IntPoint(event->position.x, event->position.y));
553 case EWK_GESTURE_PAN:
554 impl->gestureClient->endPan(IntPoint(event->position.x, event->position.y));
556 case EWK_GESTURE_FLICK:
557 impl->gestureClient->endFlick(IntPoint(event->position.x, event->position.y), IntPoint(event->velocity.x, event->velocity.y));
559 case EWK_GESTURE_PINCH:
560 impl->gestureClient->endPinch(IntPoint(event->position.x, event->position.y), event->scale);
563 ASSERT_NOT_REACHED();
570 #endif // #if ENABLE(TIZEN_GESTURE)
573 static Eina_Bool _ewk_view_smart_gesture_move(Ewk_View_Smart_Data* smartData, const Ewk_Event_Gesture* event)
575 #if ENABLE(TIZEN_GESTURE)
576 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
578 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
579 if (impl->pageClient->isTextSelectionMode() && impl->pageClient->isTextSelectionHandleDowned())
583 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
584 if (impl->focusRing && !(event->type == EWK_GESTURE_PAN && !impl->exceedTouchMoveThreshold))
585 impl->focusRing->hide();
588 switch (event->type) {
589 case EWK_GESTURE_PAN:
590 impl->gestureClient->movePan(IntPoint(event->position.x, event->position.y));
592 case EWK_GESTURE_TAP:
593 case EWK_GESTURE_LONG_PRESS:
594 case EWK_GESTURE_FLICK:
596 case EWK_GESTURE_PINCH:
597 if (impl->pageClient->viewportConstraints().userScalable)
598 impl->gestureClient->movePinch(IntPoint(event->position.x, event->position.y), event->scale);
601 ASSERT_NOT_REACHED();
608 #endif // #if ENABLE(TIZEN_GESTURE)
610 #endif //#if OS(TIZEN)
613 static void _ewk_view_on_focus_in(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
615 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
616 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
617 EINA_SAFETY_ON_NULL_RETURN(smartData->api->focus_in);
618 smartData->api->focus_in(smartData);
621 static void _ewk_view_on_focus_out(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_out);
626 smartData->api->focus_out(smartData);
629 static void _ewk_view_on_mouse_wheel(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
631 Evas_Event_Mouse_Wheel* wheelEvent = static_cast<Evas_Event_Mouse_Wheel*>(eventInfo);
632 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
633 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
634 EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_wheel);
635 smartData->api->mouse_wheel(smartData, wheelEvent);
638 static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo)
640 Evas_Event_Key_Down* downEvent = static_cast<Evas_Event_Key_Down*>(eventInfo);
641 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
642 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
643 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_down);
644 smartData->api->key_down(smartData, downEvent);
647 static void _ewk_view_on_key_up(void* data, Evas* canvas, Evas_Object* ewkView, void* eventInfo)
649 Evas_Event_Key_Up* upEvent = static_cast<Evas_Event_Key_Up*>(eventInfo);
650 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
651 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
652 EINA_SAFETY_ON_NULL_RETURN(smartData->api->key_up);
653 smartData->api->key_up(smartData, upEvent);
656 static void _ewk_view_on_show(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
658 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
659 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
660 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
663 static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo*/)
665 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
666 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
668 // This call may look wrong, but we really need to pass ViewIsVisible here.
669 // viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden
670 // depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process.
671 impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
675 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
676 Eina_Bool _ewk_view_text_selection_down(Ewk_View_Smart_Data* smartData, int x, int y)
678 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
680 return impl->pageClient->textSelectionDown(IntPoint(x, y), true);
683 Eina_Bool _ewk_view_text_selection_move(Ewk_View_Smart_Data* smartData, int x, int y)
685 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
687 IntPoint point(x, y);
688 impl->pageClient->textSelectionMove(point, true);
693 Eina_Bool _ewk_view_text_selection_up(Ewk_View_Smart_Data* smartData, int x, int y)
695 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
697 IntPoint point(x, y);
698 impl->pageClient->textSelectionUp(point, true);
704 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
705 Eina_Bool _ewk_view_smart_formdata_candidate_show(Ewk_View_Smart_Data* smartData, int x, int y, int w, int h)
707 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
709 impl->pageClient->showFormDataCandidate(IntRect(x, y, w, h));
714 Eina_Bool _ewk_view_smart_formdata_candidate_hide(Ewk_View_Smart_Data* smartData)
716 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
718 impl->pageClient->hideFormDataCandidate();
723 Eina_Bool _ewk_view_smart_formdata_candidate_update_data(Ewk_View_Smart_Data* smartData, Eina_List* dataList)
725 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
727 Vector<String> formData;
730 EINA_LIST_FOREACH(dataList, list, data)
731 formData.append(String::fromUTF8(static_cast<char*>(data)));
733 impl->pageClient->updateFormDataCandidate(formData);
738 Eina_Bool _ewk_view_smart_formdata_candidate_is_showing(Ewk_View_Smart_Data* smartData)
740 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
742 return impl->pageClient->isShowingFormDataCandidate();
746 #if ENABLE(TIZEN_SCREEN_READER)
747 Eina_Bool _ewk_view_screen_reader_command_execute(Ewk_View_Smart_Data* smartData, unsigned int command, int data1, int data2)
749 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
751 return ScreenReaderProxy::screenReader().executeCommand(impl, command, data1, data2);
754 #endif // #if OS(TIZEN)
756 static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL;
758 static void _ewk_view_impl_del(EwkViewImpl* impl)
760 /* Unregister icon change callback */
761 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();
762 iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed);
767 static void _ewk_view_smart_add(Evas_Object* ewkView)
769 const Evas_Smart* smart = evas_object_smart_smart_get(ewkView);
770 const Evas_Smart_Class* smartClass = evas_smart_class_get(smart);
771 const Ewk_View_Smart_Class* api = reinterpret_cast<const Ewk_View_Smart_Class*>(smartClass);
772 EWK_VIEW_SD_GET(ewkView, smartData);
775 smartData = static_cast<Ewk_View_Smart_Data*>(calloc(1, sizeof(Ewk_View_Smart_Data)));
777 EINA_LOG_CRIT("could not allocate Ewk_View_Smart_Data");
780 evas_object_smart_data_set(ewkView, smartData);
783 smartData->self = ewkView;
784 smartData->api = api;
786 g_parentSmartClass.add(ewkView);
788 smartData->priv = new EwkViewImpl(ewkView);
789 if (!smartData->priv) {
790 EINA_LOG_CRIT("could not allocate EwkViewImpl");
791 evas_object_smart_data_set(ewkView, 0);
796 // Create evas_object_image to draw web contents.
797 smartData->image = evas_object_image_add(smartData->base.evas);
798 evas_object_image_alpha_set(smartData->image, false);
799 evas_object_image_filled_set(smartData->image, true);
800 evas_object_smart_member_add(smartData->image, ewkView);
803 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
804 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
805 const char *engine = ecore_evas_engine_name_get(ee);
806 if (engine && !strcmp(engine, "opengl_x11"))
807 evas_object_image_content_hint_set(smartData->image, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
809 ewk_view_mouse_events_enabled_set(ewkView, false);
810 ewk_view_touch_events_enabled_set(ewkView, true);
812 // FIXME: This code should be removed if side effect occur.
813 // WebView does not have focus after url loading.
814 // If focus is set as true to webview,
815 // elementary steal webview's focus during mouse up event
816 // So, added code that events are not propagated to smart parent according to guide from EFL
817 evas_object_propagate_events_set(ewkView, false);
819 #if ENABLE(TIZEN_SCREEN_READER)
820 ScreenReaderProxy::screenReader().addView(smartData->priv);
822 #endif // #if OS(TIZEN)
824 #define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData)
825 CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in);
826 CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out);
827 CONNECT(EVAS_CALLBACK_MOUSE_WHEEL, _ewk_view_on_mouse_wheel);
828 CONNECT(EVAS_CALLBACK_KEY_DOWN, _ewk_view_on_key_down);
829 CONNECT(EVAS_CALLBACK_KEY_UP, _ewk_view_on_key_up);
830 CONNECT(EVAS_CALLBACK_SHOW, _ewk_view_on_show);
831 CONNECT(EVAS_CALLBACK_HIDE, _ewk_view_on_hide);
835 static void _ewk_view_smart_del(Evas_Object* ewkView)
837 EwkViewImpl::removeFromPageViewMap(ewkView);
838 EWK_VIEW_SD_GET(ewkView, smartData);
839 #if ENABLE(TIZEN_SCREEN_READER)
840 ScreenReaderProxy::screenReader().removeView(smartData->priv);
842 if (smartData && smartData->priv)
843 _ewk_view_impl_del(smartData->priv);
845 g_parentSmartClass.del(ewkView);
848 static Eina_Bool _ewk_view_composite(void* data);
850 static void _ewk_view_smart_resize(Evas_Object* ewkView, Evas_Coord width, Evas_Coord height)
852 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
854 evas_object_resize(smartData->image, width, height);
855 evas_object_image_size_set(smartData->image, width, height);
856 evas_object_image_fill_set(smartData->image, 0, 0, width, height);
858 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
859 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
860 evas_object_image_native_surface_set(smartData->image, 0);
862 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
863 if (!ewk_view_is_opengl_backend(ewkView))
864 _ewk_view_composite(smartData);
865 else // OpenGL backend
867 impl->pageClient->displayViewport();
869 #endif // #if OS(TIZEN)
871 smartData->changed.size = true;
872 _ewk_view_smart_changed(smartData);
875 static void _ewk_view_smart_move(Evas_Object* ewkView, Evas_Coord x, Evas_Coord y)
877 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
879 smartData->changed.position = true;
880 _ewk_view_smart_changed(smartData);
883 static void _ewk_view_smart_calculate(Evas_Object* ewkView)
885 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
886 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
888 Evas_Coord x, y, width, height;
890 smartData->changed.any = false;
892 evas_object_geometry_get(ewkView, &x, &y, &width, &height);
894 if (smartData->changed.size) {
896 #if USE(COORDINATED_GRAPHICS)
897 impl->pageViewportControllerClient->updateViewportSize(IntSize(width, height));
899 #if USE(ACCELERATED_COMPOSITING)
900 needsNewSurface = impl->evasGlSurface;
903 if (impl->pageProxy->drawingArea())
904 impl->pageProxy->drawingArea()->setSize(IntSize(width, height), IntSize());
906 #if USE(ACCELERATED_COMPOSITING)
907 if (!impl->evasGlSurface)
909 evas_gl_surface_destroy(impl->evasGl, impl->evasGlSurface);
910 impl->evasGlSurface = 0;
911 ewk_view_create_gl_surface(ewkView, IntSize(width, height));
912 ewk_view_display(ewkView, IntRect(IntPoint(), IntSize(width, height)));
914 #endif // #if !OS(TIZEN)
916 smartData->view.w = width;
917 smartData->view.h = height;
918 smartData->changed.size = false;
921 if (impl->pageClient) {
922 if (DrawingAreaProxy* drawingArea = impl->pageProxy->drawingArea()) {
923 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
924 if (impl->pageProxy->isViewVisible())
925 drawingArea->setSize(IntSize(width, height), IntSize());
927 drawingArea->setSize(IntSize(width, height), IntSize());
929 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR)
930 impl->pageClient->updateViewportSize(IntSize(width, height));
931 if (ewk_view_is_opengl_backend(ewkView))
932 impl->pageClient->displayViewport();
935 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
936 impl->pageClient->frameRectChanged();
939 #endif // #if OS(TIZEN)
942 if (smartData->changed.position) {
943 evas_object_move(smartData->image, x, y);
944 smartData->view.x = x;
945 smartData->view.y = y;
946 smartData->changed.position = false;
948 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
949 impl->pageClient->frameRectChanged();
951 #if ENABLE(TIZEN_SCREEN_READER)
952 impl->pageProxy->recalcScreenReaderFocusRect();
954 #endif // #if OS(TIZEN)
957 if (impl->popupPicker)
958 ewk_popup_picker_resize(impl->popupPicker);
959 #endif // #if OS(TIZEN)
962 static void _ewk_view_smart_show(Evas_Object* ewkView)
964 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
965 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
967 if (evas_object_clipees_get(smartData->base.clipper))
968 evas_object_show(smartData->base.clipper);
969 evas_object_show(smartData->image);
972 static void _ewk_view_smart_hide(Evas_Object* ewkView)
974 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
976 evas_object_hide(smartData->base.clipper);
977 evas_object_hide(smartData->image);
978 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
979 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
980 if (impl->pageClient->isTextSelectionMode())
981 impl->pageClient->setIsTextSelectionMode(false);
985 static void _ewk_view_smart_color_set(Evas_Object* ewkView, int red, int green, int blue, int alpha)
987 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
988 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
992 else if (alpha > 255)
995 #define CHECK_COLOR(color, alpha) \
998 else if (color > alpha) \
1000 CHECK_COLOR(red, alpha);
1001 CHECK_COLOR(green, alpha);
1002 CHECK_COLOR(blue, alpha);
1005 evas_object_image_alpha_set(smartData->image, alpha < 255);
1006 impl->pageProxy->setDrawsBackground(red || green || blue);
1007 impl->pageProxy->setDrawsTransparentBackground(alpha < 255);
1008 impl->pageClient->setBackgroundColor(red/255.0, green/255.0, blue/255.0, alpha/255.0);
1011 g_parentSmartClass.color_set(ewkView, red, green, blue, alpha);
1015 Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
1017 EINA_SAFETY_ON_NULL_RETURN_VAL(api, false);
1019 if (api->version != EWK_VIEW_SMART_CLASS_VERSION) {
1020 EINA_LOG_CRIT("Ewk_View_Smart_Class %p is version %lu while %lu was expected.",
1021 api, api->version, EWK_VIEW_SMART_CLASS_VERSION);
1025 if (EINA_UNLIKELY(!g_parentSmartClass.add))
1026 evas_object_smart_clipped_smart_set(&g_parentSmartClass);
1028 evas_object_smart_clipped_smart_set(&api->sc);
1030 // Set Evas_Smart_Class functions.
1031 api->sc.add = _ewk_view_smart_add;
1032 api->sc.del = _ewk_view_smart_del;
1033 api->sc.move = _ewk_view_smart_move;
1034 api->sc.resize = _ewk_view_smart_resize;
1035 api->sc.show = _ewk_view_smart_show;
1036 api->sc.hide = _ewk_view_smart_hide;
1037 api->sc.color_set = _ewk_view_smart_color_set;
1038 api->sc.calculate = _ewk_view_smart_calculate;
1039 api->sc.data = EWK_VIEW_TYPE_STR; // It is used by type checking.
1041 // Set Ewk_View_Smart_Class functions.
1042 api->focus_in = _ewk_view_smart_focus_in;
1043 api->focus_out = _ewk_view_smart_focus_out;
1044 api->mouse_wheel = _ewk_view_smart_mouse_wheel;
1045 api->mouse_down = _ewk_view_smart_mouse_down;
1046 api->mouse_up = _ewk_view_smart_mouse_up;
1047 api->mouse_move = _ewk_view_smart_mouse_move;
1048 api->key_down = _ewk_view_smart_key_down;
1049 api->key_up = _ewk_view_smart_key_up;
1051 api->gesture_start = _ewk_view_smart_gesture_start;
1052 api->gesture_end = _ewk_view_smart_gesture_end;
1053 api->gesture_move = _ewk_view_smart_gesture_move;
1055 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
1056 api->popup_menu_show = _ewk_view_popup_menu_show;
1057 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1058 api->multiple_popup_menu_show = _ewk_view_multiple_popup_menu_show;
1060 api->popup_menu_hide = _ewk_view_popup_menu_hide;
1061 api->popup_menu_update = _ewk_view_popup_menu_update;
1063 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
1064 api->text_selection_down = _ewk_view_text_selection_down;
1065 api->text_selection_move = _ewk_view_text_selection_move;
1066 api->text_selection_up = _ewk_view_text_selection_up;
1068 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1069 api->input_picker_show = _ewk_view_input_picker_show;
1071 #if ENABLE(TIZEN_DATALIST_ELEMENT)
1072 api->data_list_show = _ewk_view_data_list_show;
1073 api->data_list_hide = _ewk_view_data_list_hide;
1075 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
1076 api->orientation_lock = _ewk_orientation_lock;
1077 api->orientation_unlock = _ewk_orientation_unlock;
1079 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1080 api->input_picker_color_request = _ewk_input_picker_color_request;
1081 api->input_picker_color_dismiss = _ewk_input_picker_color_dismiss;
1083 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1084 api->formdata_candidate_show = _ewk_view_smart_formdata_candidate_show;
1085 api->formdata_candidate_hide = _ewk_view_smart_formdata_candidate_hide;
1086 api->formdata_candidate_update_data = _ewk_view_smart_formdata_candidate_update_data;
1087 api->formdata_candidate_is_showing = _ewk_view_smart_formdata_candidate_is_showing;
1089 #if ENABLE(TIZEN_SCREEN_READER)
1090 api->screen_reader_command_execute = _ewk_view_screen_reader_command_execute;
1092 #endif //#if OS(TIZEN)
1097 static inline Evas_Smart* _ewk_view_smart_class_new(void)
1099 static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View");
1100 static Evas_Smart* smart = 0;
1102 if (EINA_UNLIKELY(!smart)) {
1103 ewk_view_smart_class_set(&api);
1104 smart = evas_smart_class_new(&api.sc);
1110 static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef)
1112 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1113 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1114 EINA_SAFETY_ON_NULL_RETURN(context);
1116 if (impl->pageClient)
1119 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
1120 bool isOpenGL = ewk_view_is_opengl_backend(ewkView);
1122 impl->pageClient = PageClientEvasGL::create(impl);
1124 impl->pageClient = PageClientImpl::create(impl);
1126 impl->pageClient = PageClientImpl::create(impl);
1130 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), toImpl(pageGroupRef));
1132 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), WebPageGroup::create().get());
1134 EwkViewImpl::addToPageViewMap(ewkView);
1137 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
1138 impl->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
1139 impl->pageProxy->pageGroup()->preferences()->setFrameFlatteningEnabled(true);
1140 impl->pageProxy->pageGroup()->preferences()->setAllowUniversalAccessFromFileURLs(true);
1142 int deviceWidth, deviceHeight;
1143 ecore_evas_screen_geometry_get(ecore_evas_ecore_evas_get(evas_object_evas_get(ewkView)), 0, 0, &deviceWidth, &deviceHeight);
1144 impl->pageProxy->pageGroup()->preferences()->setDeviceWidth(deviceWidth);
1145 impl->pageProxy->pageGroup()->preferences()->setDeviceHeight(deviceHeight);
1148 impl->pageProxy->initializeWebPage();
1150 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
1151 impl->pageProxy->setCustomDeviceScaleFactor((float)getMobileDPI() / 160);
1153 impl->pageProxy->setCustomDeviceScaleFactor((float)getDPI() / 160);
1156 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) && !ENABLE(TIZEN_WEBKIT2_EFL_WTR)
1157 impl->pageProxy->setUseFixedLayout(true);
1159 #if ENABLE(FULLSCREEN_API)
1160 impl->pageProxy->fullScreenManager()->setWebView(ewkView);
1163 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
1165 impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(true);
1167 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(false);
1168 impl->pageProxy->pageGroup()->preferences()->setWebGLEnabled(false);
1169 impl->pageProxy->drawingArea()->layerTreeCoordinatorProxy()->initializeAcceleratedCompositingMode(false);
1173 impl->backForwardList = Ewk_Back_Forward_List::create(toAPI(impl->pageProxy->backForwardList()));
1175 impl->context = context;
1178 ewkViewContextMenuClientAttachClient(ewkView);
1179 ewkViewTizenClientAttachClient(ewkView);
1181 #if ENABLE(TIZEN_GEOLOCATION)
1182 ewkViewGeolocationProviderAttachProvider(ewkView, impl->context->wkContext());
1185 #if ENABLE(TIZEN_NOTIFICATIONS)
1186 ewkViewNotificationProviderAttachProvider(ewkView, impl->context->wkContext());
1189 #if ENABLE(TIZEN_ICON_DATABASE)
1190 ewk_view_icondatabase_client_attach(ewkView, impl->context->wkContext());
1193 ewk_view_javascript_alert_callback_set(ewkView, _ewk_view_default_javascript_alert, 0);
1194 ewk_view_javascript_confirm_callback_set(ewkView, _ewk_view_default_javascript_confirm, 0);
1195 ewk_view_javascript_prompt_callback_set(ewkView, _ewk_view_default_javascript_prompt, 0);
1196 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
1197 ewk_view_before_unload_confirm_panel_callback_set(ewkView, _ewk_view_default_before_unload_confirm_panel, 0);
1199 ewk_view_open_panel_callback_set(ewkView, _ewk_view_default_open_panel, 0);
1200 #else // #if OS(TIZEN)
1201 #if USE(COORDINATED_GRAPHICS)
1202 impl->viewportHandler = EflViewportHandler::create(impl->pageClient.get());
1204 #endif // #if OS(TIZEN)
1206 #if ENABLE(FULLSCREEN_API)
1207 impl->pageProxy->fullScreenManager()->setWebView(ewkView);
1208 impl->pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true);
1211 // Initialize page clients.
1212 impl->pageLoadClient = PageLoadClientEfl::create(impl);
1213 impl->pagePolicyClient = PagePolicyClientEfl::create(impl);
1214 impl->pageUIClient = PageUIClientEfl::create(impl);
1215 impl->resourceLoadClient = ResourceLoadClientEfl::create(impl);
1216 impl->findClient = FindClientEfl::create(impl);
1217 impl->formClient = FormClientEfl::create(impl);
1219 /* Listen for favicon changes */
1220 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();
1221 iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView));
1223 #if ENABLE(TIZEN_WEBKIT2_THEME_SET_INTERNAL)
1224 ewk_view_theme_set(ewkView, "/usr/share/edje/webkit.edj");
1227 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
1228 if (!impl->context->xWindow())
1229 impl->context->setXWindow(elm_win_xwindow_get(ewkView));
1232 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1233 impl->focusRing = FocusRing::create(impl);
1237 static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart)
1239 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1240 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
1242 #if ENABLE(TIZEN_WEBKIT2_DDK_CHECK)
1244 using namespace EGL;
1245 if(!eglGetDisplay(EGL_DEFAULT_DISPLAY)) {
1246 EINA_LOG_CRIT("Fail in initiziling view because No DDK is installed.");
1252 Evas_Object* ewkView = evas_object_smart_add(canvas, smart);
1256 EWK_VIEW_SD_GET(ewkView, smartData);
1258 evas_object_del(ewkView);
1262 EWK_VIEW_IMPL_GET(smartData, impl);
1264 evas_object_del(ewkView);
1273 * Constructs a ewk_view Evas_Object with WKType parameters.
1275 Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
1277 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1278 EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0);
1280 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, _ewk_view_smart_class_new());
1284 _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef);
1289 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context)
1291 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
1292 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0);
1293 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1295 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, smart);
1299 #if ENABLE(TIZEN_ICON_DATABASE)
1300 //set default iconDatabasePath
1301 WKContextRef contextRef = context->wkContext();
1302 toImpl(contextRef)->setIconDatabasePath(toImpl(contextRef)->iconDatabasePath());
1305 #if ENABLE(TIZEN_WEBKIT2_CREATE_VIEW_WITH_CREATED_PAGE_GROUP_WITH_IDENTIFIER)
1306 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1307 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1308 _ewk_view_initialize(ewkView, context, toAPI(impl->pageGroup.get()));
1310 _ewk_view_initialize(ewkView, context, 0);
1316 Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context)
1318 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1319 return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context);
1322 Evas_Object* ewk_view_add(Evas* canvas)
1324 return ewk_view_add_with_context(canvas, ewk_context_default_get());
1327 Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView)
1329 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1330 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1332 return impl->ewkContext();
1335 Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url)
1337 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1338 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1339 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
1341 impl->pageProxy->loadURL(url);
1342 impl->informURLChange();
1347 const char* ewk_view_url_get(const Evas_Object* ewkView)
1349 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1350 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1355 const char *ewk_view_icon_url_get(const Evas_Object *ewkView)
1357 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1358 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1360 return impl->faviconURL();
1363 Eina_Bool ewk_view_reload(Evas_Object* ewkView)
1365 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1366 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1368 impl->pageProxy->reload(/*reloadFromOrigin*/ false);
1369 impl->informURLChange();
1374 Eina_Bool ewk_view_reload_bypass_cache(Evas_Object* ewkView)
1376 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1377 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1379 impl->pageProxy->reload(/*reloadFromOrigin*/ true);
1380 impl->informURLChange();
1385 Eina_Bool ewk_view_stop(Evas_Object* ewkView)
1387 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1388 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1390 impl->pageProxy->stopLoading();
1395 Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView)
1397 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1398 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1400 return impl->settings();
1403 const char* ewk_view_title_get(const Evas_Object* ewkView)
1405 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1406 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1408 return impl->title();
1413 * Reports that the requested text was found.
1415 * Emits signal: "text,found" with the number of matches.
1417 void ewk_view_text_found(Evas_Object* ewkView, unsigned int matchCount)
1419 evas_object_smart_callback_call(ewkView, "text,found", &matchCount);
1422 double ewk_view_load_progress_get(const Evas_Object* ewkView)
1424 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
1425 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0);
1427 return impl->pageProxy->estimatedProgress();
1430 Eina_Bool ewk_view_scale_set(Evas_Object* ewkView, double scaleFactor, int x, int y)
1432 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1433 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1439 scaleFactor = impl->pageClient->adjustScaleWithViewport(scaleFactor);
1441 IntPoint scrollPosition = impl->pageClient->scrollPosition();
1442 double scaleDifference = scaleFactor / impl->pageClient->scaleFactor();
1443 int newScrollX = (scrollPosition.x() + centerX - smartData->view.x) * scaleDifference - (centerX - smartData->view.x);
1444 int newScrollY = (scrollPosition.y() + centerY - smartData->view.y) * scaleDifference - (centerY - smartData->view.y);
1446 impl->pageProxy->scale(scaleFactor, IntPoint(newScrollX, newScrollY));
1448 impl->pageProxy->scalePage(scaleFactor, IntPoint(x, y));
1453 double ewk_view_scale_get(const Evas_Object* ewkView)
1455 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1);
1456 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1);
1459 return impl->pageProxy->scaleFactor();
1461 return impl->pageProxy->pageScaleFactor();
1465 Eina_Bool ewk_view_device_pixel_ratio_set(Evas_Object* ewkView, float ratio)
1467 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1468 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1470 impl->pageProxy->setCustomDeviceScaleFactor(ratio);
1475 float ewk_view_device_pixel_ratio_get(const Evas_Object* ewkView)
1477 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, -1.0);
1478 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0);
1480 return impl->pageProxy->deviceScaleFactor();
1483 void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
1485 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1486 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1488 impl->setThemePath(path);
1491 const char* ewk_view_theme_get(const Evas_Object* ewkView)
1493 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1494 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1496 return impl->themePath();
1499 Eina_Bool ewk_view_back(Evas_Object* ewkView)
1501 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1502 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1504 WebPageProxy* page = impl->pageProxy.get();
1505 if (page->canGoBack()) {
1513 Eina_Bool ewk_view_forward(Evas_Object* ewkView)
1515 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1516 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1518 WebPageProxy* page = impl->pageProxy.get();
1519 if (page->canGoForward()) {
1527 Eina_Bool ewk_view_intent_deliver(Evas_Object* ewkView, Ewk_Intent* intent)
1529 #if ENABLE(WEB_INTENTS)
1530 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1531 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1532 EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false);
1534 WebPageProxy* page = impl->pageProxy.get();
1535 page->deliverIntentToFrame(page->mainFrame(), intent->webIntentData());
1543 Eina_Bool ewk_view_back_possible(Evas_Object* ewkView)
1545 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1546 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1548 return impl->pageProxy->canGoBack();
1551 Eina_Bool ewk_view_forward_possible(Evas_Object* ewkView)
1553 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1554 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1556 return impl->pageProxy->canGoForward();
1559 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
1561 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1562 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1564 return impl->backForwardList.get();
1567 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1568 void ewk_view_text_change_in_textfield(Evas_Object* ewkView, const String& name, const String& value)
1570 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1571 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1573 if (!ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
1576 InputMethodContextEfl* imfContext = impl->inputMethodContext();
1577 if (!imfContext || !imfContext->isShow())
1580 if (value.isEmpty()) {
1581 if(smartData->api->formdata_candidate_is_showing(smartData))
1582 smartData->api->formdata_candidate_hide(smartData);
1586 Vector<String> popupCandidates;
1587 ewk_view_form_candidate_data_get(ewkView, name, popupCandidates);
1588 std::sort(popupCandidates.begin(), popupCandidates.end(), WTF::codePointCompareLessThan);
1590 Eina_List* candidateList = 0;
1591 for (size_t i = 0; i < popupCandidates.size(); ++i) {
1592 if (popupCandidates[i].startsWith(value, false))
1593 candidateList = eina_list_append(candidateList, eina_stringshare_add(popupCandidates[i].utf8().data()));
1596 if (!eina_list_count(candidateList)) {
1597 if(smartData->api->formdata_candidate_is_showing(smartData))
1598 smartData->api->formdata_candidate_hide(smartData);
1602 smartData->api->formdata_candidate_update_data(smartData, candidateList);
1604 if (!smartData->api->formdata_candidate_is_showing(smartData))
1605 smartData->api->formdata_candidate_hide(smartData);
1607 IntRect inputFieldRect = impl->pageClient->focusedNodeRect();
1608 smartData->api->formdata_candidate_show(smartData, inputFieldRect.x(), inputFieldRect.y(), inputFieldRect.width(), inputFieldRect.height());
1611 void ewk_view_form_data_add(Evas_Object* ewkView, WKDictionaryRef& formData, bool isPasswordForm)
1613 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1614 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1615 if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView))
1616 && !ewk_settings_form_candidate_data_enabled_get(ewk_view_settings_get(ewkView)))
1618 ewk_view_context_get(ewkView)->addFormData(impl->url(), formData, isPasswordForm);
1621 void ewk_view_form_password_data_fill(Evas_Object* ewkView)
1623 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1624 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1626 if (!ewk_settings_autofill_password_form_enabled_get(ewk_view_settings_get(ewkView)))
1629 Vector<std::pair<String, String> > passwordFormData;
1630 ewk_view_context_get(ewkView)->passwordFormData(impl->url(), passwordFormData);
1632 if (!passwordFormData.size())
1635 String passwordFormAutofill = "try { function passwordFormAutofill() { var inputFields;";
1636 for (size_t i = 0; i < passwordFormData.size(); i++) {
1637 passwordFormAutofill += String::format(" inputFields = document.getElementsByName(\"%s\");"
1638 " for (var i = 0; i < inputFields.length; i++)"
1639 " if (inputFields[i].tagName.toLowerCase() == \"input\" && (inputFields[i].type.toLowerCase() == \"text\" || inputFields[i].type.toLowerCase() == \"password\" || inputFields[i].type.toLowerCase() == \"email\"))"
1640 " inputFields[i].value = \"%s\";",
1641 passwordFormData[i].first.utf8().data(), passwordFormData[i].second.utf8().data());
1643 passwordFormAutofill += "} passwordFormAutofill(); } catch(e) { }";
1644 ewk_view_script_execute(ewkView, passwordFormAutofill.utf8().data(), 0, 0);
1647 void ewk_view_form_candidate_data_get(Evas_Object* ewkView, const String& name, Vector<String>& candidates)
1649 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1650 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1651 ewk_view_context_get(ewkView)->candidateFormData(name, candidates);
1655 Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, const char* baseUrl, const char* unreachableUrl)
1657 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1658 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1659 EINA_SAFETY_ON_NULL_RETURN_VAL(html, false);
1661 if (unreachableUrl && *unreachableUrl)
1662 impl->pageProxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));
1664 impl->pageProxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");
1666 impl->informURLChange();
1671 const char* ewk_view_custom_encoding_get(const Evas_Object* ewkView)
1673 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1674 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1676 return impl->customTextEncodingName();
1679 Eina_Bool ewk_view_custom_encoding_set(Evas_Object* ewkView, const char* encoding)
1681 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1682 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1684 impl->setCustomTextEncodingName(encoding);
1690 // FIXME: It should be removed.
1691 WKPageRef ewk_view_WKPage_get(Evas_Object* ewkView)
1693 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1694 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1696 return toAPI(impl->pageProxy.get());
1699 Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
1701 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1702 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1704 impl->setMouseEventsEnabled(!!enabled);
1709 Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView)
1711 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1712 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1714 return impl->mouseEventsEnabled();
1717 Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
1719 #if ENABLE(INPUT_TYPE_COLOR)
1720 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1721 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1723 return impl->setColorPickerColor(WebCore::Color(r, g, b, a));
1729 static Eina_Bool _ewk_view_default_javascript_alert(Evas_Object* ewkView, const char* alertText, void* userData)
1731 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1732 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1734 return impl->javascriptPopup->alert(alertText);
1737 static Eina_Bool _ewk_view_default_javascript_confirm(Evas_Object* ewkView, const char* message, void* userData)
1739 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1740 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1742 return impl->javascriptPopup->confirm(message);
1745 static Eina_Bool _ewk_view_default_javascript_prompt(Evas_Object* ewkView, const char* message, const char* defaultValue, void* userData)
1747 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1748 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1750 return impl->javascriptPopup->prompt(message, defaultValue);
1753 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
1754 static Eina_Bool _ewk_view_default_before_unload_confirm_panel(Evas_Object* ewkView, const char* message, void* userData)
1756 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1757 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1759 return impl->javascriptPopup->beforeUnloadConfirmPanel(message);
1763 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)
1765 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1766 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1768 return impl->openPanel->openPanel(ewkView, allow_multiple_files, accepted_mime_types, capture, impl);
1771 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
1772 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)
1774 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1776 if (impl->popupPicker)
1777 ewk_popup_picker_del(impl->popupPicker);
1779 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1780 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex, false);
1782 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, selectedIndex);
1788 #if ENABLE(TIZEN_MULTIPLE_SELECT)
1789 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)
1791 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1793 if (impl->popupPicker)
1794 ewk_popup_picker_del(impl->popupPicker);
1796 impl->popupPicker = ewk_popup_picker_new(smartData->self, items, 0, true);
1802 Eina_Bool _ewk_view_popup_menu_hide(Ewk_View_Smart_Data* smartData)
1804 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1806 if (!impl->popupPicker)
1809 ewk_popup_picker_del(impl->popupPicker);
1810 impl->popupPicker = 0;
1815 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)
1817 // FIXME: The rect should be updated if it was changed
1819 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1821 if (!impl->popupPicker)
1824 ewk_popup_picker_update(smartData->self, impl->popupPicker, items, selectedIndex);
1830 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
1831 static Eina_Bool _ewk_view_input_picker_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, const char* inputValue)
1833 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1835 impl->inputPicker->show(inputType, inputValue);
1840 #if ENABLE(TIZEN_DATALIST_ELEMENT)
1841 static Eina_Bool _ewk_view_data_list_show(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType, Eina_List* optionList)
1843 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1845 impl->inputPicker->showDataList(inputType, optionList);
1849 static Eina_Bool _ewk_view_data_list_hide(Ewk_View_Smart_Data* smartData, Ewk_Input_Type inputType)
1851 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1853 impl->inputPicker->hideDataList(inputType);
1858 #if ENABLE(TIZEN_INPUT_COLOR_PICKER)
1859 static Eina_Bool _ewk_input_picker_color_request(Ewk_View_Smart_Data* smartData, int r, int g, int b, int a)
1861 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1863 impl->inputPicker->showColorPicker(r, g, b, a);
1867 static Eina_Bool _ewk_input_picker_color_dismiss(Ewk_View_Smart_Data* smartData)
1869 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1871 impl->inputPicker->hideColorPicker();
1876 PageClientImpl* ewkViewGetPageClient(const Evas_Object* ewkView)
1878 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1879 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1881 return impl->pageClient.get();
1884 double ewk_view_text_zoom_get(const Evas_Object* ewkView)
1886 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 1);
1887 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 1);
1889 return WKPageGetTextZoomFactor(toAPI(impl->pageProxy.get()));
1892 Eina_Bool ewk_view_text_zoom_set(Evas_Object* ewkView, double textZoomFactor)
1894 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
1895 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
1897 WKPageSetTextZoomFactor(toAPI(impl->pageProxy.get()), textZoomFactor);
1901 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1902 FocusRing* ewkViewGetFocusRing(Evas_Object* ewkView)
1904 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1905 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1907 return impl->focusRing.get();
1911 Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* ewkView)
1913 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1914 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1916 return static_cast<Ewk_Frame_Ref>(WKPageGetMainFrame(toAPI(impl->pageProxy.get())));
1919 Ewk_Frame_Ref ewk_view_focused_frame_get(Evas_Object* ewkView)
1921 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1922 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1924 return static_cast<Ewk_Frame_Ref>(WKPageGetFocusedFrame(toAPI(impl->pageProxy.get())));
1927 JSGlobalContextRef ewkViewGetJavascriptGlobalContext(Evas_Object* ewkView)
1929 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
1930 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
1932 if (!impl->javascriptGlobalContext)
1933 impl->javascriptGlobalContext = JSGlobalContextCreate(0);
1934 return impl->javascriptGlobalContext;
1937 void ewkViewLoadCommitted(Evas_Object* ewkView)
1939 #if ENABLE(TIZEN_GESTURE)
1940 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1941 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1942 impl->gestureClient->reset();
1944 #if ENABLE(TIZEN_ISF_PORT)
1945 impl->inputMethodContext()->hideIMFContext();
1947 impl->informURLChange();
1948 evas_object_smart_callback_call(ewkView, "load,committed", 0);
1951 void ewkViewLoadError(Evas_Object* ewkView, WKErrorRef error)
1953 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1954 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1956 OwnPtr<Ewk_Error> ewkError = Ewk_Error::create(error);
1957 ewk_error_load_error_page(ewkError.get(), toAPI(impl->pageProxy.get()));
1958 evas_object_smart_callback_call(ewkView, "load,error", ewkError.get());
1961 void ewkViewDidFirstVisuallyNonEmptyLayout(Evas_Object* ewkView)
1963 #if ENABLE(TIZEN_GESTURE)
1964 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1965 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1966 impl->gestureClient->reset();
1968 evas_object_smart_callback_call(ewkView, "load,nonemptylayout,finished", 0);
1971 void ewkViewDidReceiveAuthenticationChallenge(Evas_Object* ewkView, Ewk_Auth_Challenge* authChallenge)
1973 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
1974 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
1976 if (impl->authChallenge)
1977 ewkAuthChallengeDelete(impl->authChallenge);
1978 impl->authChallenge = authChallenge;
1980 evas_object_smart_callback_call(ewkView, "authentication,challenge", impl->authChallenge);
1983 void ewk_view_process_crashed(Evas_Object* ewkView)
1985 bool handled = false;
1986 evas_object_smart_callback_call(ewkView, "process,crashed", &handled);
1992 #if ENABLE(TIZEN_SQL_DATABASE)
1993 unsigned long long ewkViewExceededDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage)
1995 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, currentQuota);
1996 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, currentQuota);
1998 TIZEN_LOGI("database,quota,exceeded");
1999 uint64_t defaultQuota = ewkContextGetDatabaseQuota(impl->context.get());
2000 if (defaultQuota >= expectedUsage + currentQuota)
2001 return defaultQuota;
2003 if (impl->exceededDatabaseQuota)
2004 ewkContextDeleteExceededQuota(impl->exceededDatabaseQuota);
2005 impl->exceededDatabaseQuota = ewkContextCreateExceededQuota(origin, databaseName, displayName, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage);
2006 evas_object_smart_callback_call(ewkView, "database,quota,exceeded", impl->exceededDatabaseQuota);
2008 return ewkContextGetNewQuotaForExceededQuota(impl->context.get(), impl->exceededDatabaseQuota);
2012 #if ENABLE(TIZEN_NOTIFICATIONS)
2013 void ewkViewCancelNotification(Evas_Object* ewkView, uint64_t notificationID)
2015 TIZEN_LOGI("notification,cancel");
2016 evas_object_smart_callback_call(ewkView, "notification,cancel", ¬ificationID);
2019 void ewkViewRequestNotificationPermission(Evas_Object* ewkView, Ewk_Notification_Permission_Request* notificationPermissionRequest)
2021 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2022 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2024 TIZEN_LOGI("notification,permission,request");
2025 impl->notificationPermissionRequests = eina_list_append(impl->notificationPermissionRequests, notificationPermissionRequest);
2026 evas_object_smart_callback_call(ewkView, "notification,permission,request", notificationPermissionRequest);
2029 void ewkViewShowNotification(Evas_Object* ewkView, Ewk_Notification* notification)
2031 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2032 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2034 TIZEN_LOGI("notification,show");
2035 Eina_List* listIterator=0;
2037 const char* replaceID = ewkNotificationGetReplaceID(notification);
2038 if(strlen(replaceID)) {
2039 EINA_LIST_FOREACH(impl->notifications, listIterator, data) {
2040 Ewk_Notification* notificationForReplace = static_cast<Ewk_Notification*>(data);
2041 if(!strcmp(ewkNotificationGetReplaceID(notificationForReplace), replaceID))
2042 ewkViewCancelNotification(ewkView, ewk_notification_id_get(notificationForReplace));
2046 impl->notifications = eina_list_append(impl->notifications, notification);
2047 evas_object_smart_callback_call(ewkView, "notification,show", notification);
2050 void ewkViewDeleteNotificationPermissionRequest(Evas_Object* ewkView, Ewk_Notification_Permission_Request* ewkNotificationPermissionRequest)
2052 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2053 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2055 impl->notificationPermissionRequests = eina_list_remove(impl->notificationPermissionRequests, ewkNotificationPermissionRequest);
2059 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
2060 void ewkViewRegisterProtocolHandlers(Evas_Object* ewkView, const char* scheme, const char* baseUrl, const char* url, const char* title)
2062 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2064 TIZEN_LOGI("protocolhandler,registration,requested");
2065 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseUrl, url, title);
2066 evas_object_smart_callback_call(ewkView, "protocolhandler,registration,requested", static_cast<void*>(customHandlersData));
2067 ewkCustomHandlersDeleteData(customHandlersData);
2071 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
2072 Ewk_Custom_Handlers_State ewkViewIsProtocolHandlerRegistered(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url)
2074 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
2076 TIZEN_LOGI("protocolhandler,isregistered");
2077 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseURL, url);
2078 evas_object_smart_callback_call(ewkView, "protocolhandler,isregistered", static_cast<void*>(customHandlersData));
2080 Ewk_Custom_Handlers_State result;
2081 result = ewkGetCustomHandlersDataResult(customHandlersData);
2082 ewkCustomHandlersDeleteData(customHandlersData);
2087 void ewkViewUnregisterProtocolHandlers(Evas_Object* ewkView, const char* scheme, const char* baseURL, const char* url)
2089 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2091 TIZEN_LOGI("protocolhandler,unregistration,requested");
2092 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(scheme, baseURL, url);
2093 evas_object_smart_callback_call(ewkView, "protocolhandler,unregistration,requested", static_cast<void*>(customHandlersData));
2094 ewkCustomHandlersDeleteData(customHandlersData);
2098 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
2099 void ewkViewRegisterContentHandlers(Evas_Object* ewkView, const char* mimeType, const char* baseUrl, const char* url, const char* title)
2101 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2103 TIZEN_LOGI("contenthandler,registration,requested");
2104 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseUrl, url, title);
2105 evas_object_smart_callback_call(ewkView, "contenthandler,registration,requested", static_cast<void*>(customHandlersData));
2106 ewkCustomHandlersDeleteData(customHandlersData);
2109 Ewk_Custom_Handlers_State ewkViewIsContentHandlerRegistered(Evas_Object* ewkView, const char* mimeType, const char* baseURL, const char* url)
2111 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, EWK_CUSTOM_HANDLERS_DECLINED);
2113 TIZEN_LOGI("contenthandler,isregistered");
2114 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseURL, url);
2115 evas_object_smart_callback_call(ewkView, "contenthandler,isregistered", static_cast<void*>(customHandlersData));
2117 Ewk_Custom_Handlers_State result;
2118 result = ewkGetCustomHandlersDataResult(customHandlersData);
2119 ewkCustomHandlersDeleteData(customHandlersData);
2124 void ewkViewUnregisterContentHandlers(Evas_Object* ewkView, const char* mimeType, const char* baseURL, const char* url)
2126 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2128 TIZEN_LOGI("contenthandler,unregistration,requested");
2129 Ewk_Custom_Handlers_Data* customHandlersData = ewkCustomHandlersCreateData(mimeType, baseURL, url);
2130 evas_object_smart_callback_call(ewkView, "contenthandler,unregistration,requested", static_cast<void*>(customHandlersData));
2131 ewkCustomHandlersDeleteData(customHandlersData);
2135 #if ENABLE(TIZEN_SEARCH_PROVIDER)
2136 void ewkViewAddSearchProvider(Evas_Object* ewkView, const char* baseURL, const char* engineURL)
2138 EINA_SAFETY_ON_NULL_RETURN(ewkView);
2140 TIZEN_LOGI("searchProvider,add");
2141 Ewk_Search_Provider_Data* searchProviderData = ewkSearchProviderCreateData(baseURL, engineURL);
2142 evas_object_smart_callback_call(ewkView, "searchProvider,add", static_cast<void*>(searchProviderData));
2143 ewkSearchProviderDeleteData(searchProviderData);
2146 unsigned long ewkViewIsSearchProviderInstalled(Evas_Object* ewkView, const char* baseURL, const char* engineURL)
2148 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
2150 TIZEN_LOGI("searchProvider,installed");
2151 Ewk_Search_Provider_Data* searchProviderData = ewkSearchProviderCreateData(baseURL, engineURL);
2152 evas_object_smart_callback_call(ewkView, "searchProvider,installed", static_cast<void*>(searchProviderData));
2153 unsigned long result;
2154 result = ewkGetSearchProviderResult(searchProviderData);
2155 ewkSearchProviderDeleteData(searchProviderData);
2160 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
2161 bool ewkViewGetStandaloneStatus(Evas_Object* ewkView)
2163 TIZEN_LOGI("webapp,metatag,standalone");
2164 bool standalone = true;
2165 evas_object_smart_callback_call(ewkView, "webapp,metatag,standalone", (void*)&standalone);
2170 #if ENABLE(TIZEN_MEDIA_STREAM)
2171 void ewkViewRequestUserMediaPermission(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* userMediaPermission)
2173 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2174 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2176 impl->userMediaPermissionRequests = eina_list_append(impl->userMediaPermissionRequests, userMediaPermission);
2177 evas_object_smart_callback_call(ewkView, "usermedia,permission,request", userMediaPermission);
2180 void ewkViewDeleteUserMediaPermissionRequest(Evas_Object* ewkView, Ewk_User_Media_Permission_Request* permission)
2182 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2183 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2185 impl->userMediaPermissionRequests = eina_list_remove(impl->userMediaPermissionRequests, permission);
2190 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
2191 void ewkViewProcessJSBridgePlugin(Evas_Object* ewkView, WKStringRef request, WKStringRef message)
2193 int requestLength = WKStringGetMaximumUTF8CStringSize(request);
2194 OwnArrayPtr<char> requestBuffer = adoptArrayPtr(new char[requestLength]);
2195 int messageLength = WKStringGetMaximumUTF8CStringSize(message);
2196 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[messageLength]);
2197 WKStringGetUTF8CString(request, requestBuffer.get(), requestLength);
2198 WKStringGetUTF8CString(message, messageBuffer.get(), messageLength);
2200 evas_object_smart_callback_call(ewkView, requestBuffer.get(), static_cast<void*>(messageBuffer.get()));
2204 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
2205 void ewkViewRequestCertificateConfirm(Evas_Object* ewkView, Ewk_Certificate_Policy_Decision* certificatePolicyDecision)
2207 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2208 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2209 if (impl->certificatePolicyDecision)
2210 ewkCertificatePolicyDecisionDelete(impl->certificatePolicyDecision);
2211 impl->certificatePolicyDecision = certificatePolicyDecision;
2213 evas_object_smart_callback_call(ewkView, "request,certificate,confirm", certificatePolicyDecision);
2217 void ewkViewCustomizeContextMenu(Evas_Object* ewkView, Ewk_Context_Menu* menu)
2219 evas_object_smart_callback_call(ewkView, "contextmenu,customize", static_cast<void*>(menu));
2222 void ewkViewCustomContextMenuItemSelected(Evas_Object* ewkView, Ewk_Context_Menu_Item* item)
2224 evas_object_smart_callback_call(ewkView, "contextmenu,selected", static_cast<void*>(item));
2227 #if ENABLE(TIZEN_GEOLOCATION)
2228 void ewkViewRequestGeolocationPermission(Evas_Object* ewkView, Ewk_Geolocation_Permission_Request* geolocationPermissionRequest)
2230 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2231 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2233 TIZEN_LOGI("geolocation,permission,request");
2234 impl->geolocationPermissionRequests = eina_list_append(impl->geolocationPermissionRequests, geolocationPermissionRequest);
2235 evas_object_smart_callback_call(ewkView, "geolocation,permission,request", geolocationPermissionRequest);
2238 void ewkViewDeleteGeolocationPermission(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 impl->geolocationPermissionRequests = eina_list_remove(impl->geolocationPermissionRequests, geolocationPermissionRequest);
2246 void ewkViewSetGeolocation(Evas_Object* ewkView, Ewk_Geolocation* geolocation)
2248 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2249 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2251 impl->geolocation = geolocation;
2254 Ewk_Geolocation* ewkViewGetGeolocation(Evas_Object* ewkView)
2256 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2257 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2259 return impl->geolocation;
2262 bool ewkViewIsValidLocationService(Evas_Object* ewkView)
2264 TIZEN_LOGI("geolocation,valid");
2267 evas_object_smart_callback_call(ewkView, "geolocation,valid", &valid);
2272 void ewkViewFormSubmit(Evas_Object* ewkView, Ewk_Form_Data* formData)
2274 evas_object_smart_callback_call(ewkView, "form,submit", formData);
2277 void ewkViewPolicyNavigationDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2279 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2280 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2281 if (impl->policyDecision)
2282 ewkPolicyDecisionDelete(impl->policyDecision);
2283 impl->policyDecision = policyDecision;
2285 evas_object_smart_callback_call(ewkView, "policy,navigation,decide", impl->policyDecision);
2288 void ewkViewPolicyNewWindowDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2290 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2291 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2292 if (impl->policyDecision)
2293 ewkPolicyDecisionDelete(impl->policyDecision);
2294 impl->policyDecision = policyDecision;
2296 evas_object_smart_callback_call(ewkView, "policy,newwindow,decide", impl->policyDecision);
2299 void ewkViewPolicyResponseDecide(Evas_Object* ewkView, Ewk_Policy_Decision* policyDecision)
2301 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
2302 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
2303 if (impl->policyDecision)
2304 ewkPolicyDecisionDelete(impl->policyDecision);
2305 impl->policyDecision = policyDecision;
2307 evas_object_smart_callback_call(ewkView, "policy,response,decide", impl->policyDecision);
2310 void ewkViewSendScrollEvent(Evas_Object* ewkView, int deltaX, int deltaY)
2312 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2313 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2315 IntPoint scrollPosition = impl->pageClient->scrollPosition();
2316 IntSize contentsSize = impl->pageProxy->contentsSize();
2317 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2318 contentsSize.scale(impl->pageClient->scaleFactor());
2321 // some website's contents size is smaller than view size,
2322 // so we have to adjust contents size to view size for that case.
2323 if (contentsSize.width() < smartData->view.w)
2324 contentsSize.setWidth(smartData->view.w);
2325 if (contentsSize.height() < smartData->view.h)
2326 contentsSize.setHeight(smartData->view.h);
2328 // Call "scroll,down" if webview can be scrolled down.
2329 if (deltaY > 0 && (scrollPosition.y() + smartData->view.h) < contentsSize.height())
2330 evas_object_smart_callback_call(ewkView, "scroll,down", 0);
2331 // Call "scroll,up" if webview can be scrolled up.
2332 else if (deltaY < 0 && scrollPosition.y() > 0)
2333 evas_object_smart_callback_call(ewkView, "scroll,up", 0);
2335 // Call "scroll,right" if webview can be scrolled down.
2336 if (deltaX > 0 && (scrollPosition.x() + smartData->view.w) < contentsSize.width())
2337 evas_object_smart_callback_call(ewkView, "scroll,right", 0);
2338 // Call "scroll,left" if webview can be scrolled up.
2339 else if (deltaX < 0 && scrollPosition.x() > 0)
2340 evas_object_smart_callback_call(ewkView, "scroll,left", 0);
2343 void ewkViewSendEdgeEvent(Evas_Object* ewkView, const IntPoint& scrollPosition, int deltaX, int deltaY)
2345 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2346 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2348 IntSize contentsSize = impl->pageProxy->contentsSize();
2349 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2350 contentsSize.scale(impl->pageClient->scaleFactor());
2353 int maxScrollY = contentsSize.height() - smartData->view.h;
2354 if (!impl->isVerticalEdge) {
2355 if (deltaY < 0 && (scrollPosition.y() + deltaY) <= 0) {
2356 evas_object_smart_callback_call(ewkView, "edge,top", NULL);
2357 impl->isVerticalEdge = true;
2358 } else if (deltaY > 0 && (scrollPosition.y() + deltaY) >= maxScrollY) {
2359 evas_object_smart_callback_call(ewkView, "edge,bottom", NULL);
2360 impl->isVerticalEdge = true;
2363 if (maxScrollY && ((scrollPosition.y() == 0 && deltaY > 0)
2364 || (scrollPosition.y() == maxScrollY && deltaY < 0)))
2365 impl->isVerticalEdge = false;
2368 int maxScrollX = contentsSize.width() - smartData->view.w;
2369 if (!impl->isHorizontalEdge) {
2370 if (deltaX < 0 && (scrollPosition.x() + deltaX) <= 0) {
2371 evas_object_smart_callback_call(ewkView, "edge,left", NULL);
2372 impl->isHorizontalEdge = true;
2373 } else if (deltaX > 0 && (scrollPosition.x() + deltaX) >= maxScrollX) {
2374 evas_object_smart_callback_call(ewkView, "edge,right", NULL);
2375 impl->isHorizontalEdge = true;
2378 if (maxScrollX && ((scrollPosition.x() == 0 && deltaX > 0)
2379 || (scrollPosition.x() == maxScrollX && deltaX < 0)))
2380 impl->isHorizontalEdge = false;
2384 void ewkViewClearEdges(Evas_Object* ewkView)
2386 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2387 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2389 impl->isVerticalEdge = false;
2390 impl->isHorizontalEdge = false;
2393 void ewk_view_scale_range_get(Evas_Object* ewkView, double* minimumScale, double* maximumScale)
2395 EWK_VIEW_SD_GET(ewkView, smartData);
2396 if (!smartData || !smartData->priv) {
2404 PageClientImpl::ViewportConstraints constraints = smartData->priv->pageClient->viewportConstraints();
2406 *minimumScale = constraints.minimumScale;
2408 *maximumScale = constraints.maximumScale;
2411 bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExternalKeyboard)
2413 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2414 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2416 double scaleFactor = impl->pageClient->scaleFactor();
2417 IntSize contentsSize = impl->pageProxy->contentsSize();
2419 double newScaleFactor = scaleFactor;
2420 // Readable zoom value is dependent on device DPI
2421 if (scaleFactor < impl->pageProxy->deviceScaleFactor()
2422 && impl->pageClient->viewportConstraints().userScalable)
2423 newScaleFactor = impl->pageProxy->deviceScaleFactor();
2425 // Readable zoom value should be inside of viewport scale range
2426 newScaleFactor = impl->pageClient->adjustScaleWithViewport(newScaleFactor);
2428 // scale contents' size with new scale factor
2429 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2430 contentsSize.scale(newScaleFactor);
2432 contentsSize.scale(newScaleFactor / scaleFactor);
2435 #if ENABLE(TIZEN_ISF_PORT)
2436 Ecore_X_Window rootWin = ecore_x_window_root_first_get();
2437 ecore_x_event_mask_set(rootWin, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
2438 Ecore_X_Atom xAtom = ecore_x_atom_get("X External Keyboard Exist");
2439 unsigned int connectedKeyboardNum = 0;
2440 bool isExternalKeyboardConnected = false;
2442 // get connected keyboard number
2443 if (ecore_x_window_prop_card32_get(rootWin, xAtom, &connectedKeyboardNum, 1)
2444 && connectedKeyboardNum)
2445 isExternalKeyboardConnected = true;
2447 // We should treat both of ECORE_IMF_INPUT_PANEL_STATE_SHOW and ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW
2448 // as IME is shown. ECORE_IMF_INPUT_PANEL_STATE_HIDE is ignored at here.
2449 // input field zoom should not work with below conditions
2450 // 1. view is not focused
2451 // 2. external keyboard is not connected(if adjustForExternalKeyboard is true)
2452 // 3. imfContext is null(if adjustForExternalKeyboard is false)
2453 // 4. input panel state is hidden(if adjustForExternalKeyboard is false)
2454 if ((!(static_cast<PageClient*>(impl->pageClient.get()))->isViewFocused()
2455 || (adjustForExternalKeyboard && !isExternalKeyboardConnected)
2456 || (!adjustForExternalKeyboard && !impl->inputMethodContext())
2457 || (!adjustForExternalKeyboard && !impl->inputMethodContext()->isShow()))
2458 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
2459 && !(impl->pageClient->isClipboardWindowOpened())
2465 // caret position can be outside of visible rect.
2466 // we need to consider it.
2467 IntRect selectionRect = impl->pageProxy->getSelectionRect(true);
2468 IntRect focusedNodeRect = impl->pageClient->focusedNodeRect();
2469 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2470 selectionRect.scale(newScaleFactor);
2471 focusedNodeRect.scale(newScaleFactor);
2473 selectionRect.scale(newScaleFactor / scaleFactor);
2474 focusedNodeRect.scale(newScaleFactor / scaleFactor);
2476 if (selectionRect.isEmpty())
2479 IntRect visibleRect = impl->pageClient->visibleContentRect();
2480 IntPoint scrollPosition = visibleRect.location();
2481 // Do not adjust scroll position if selection rect (caret) is visible after scaling.
2482 if (!visibleRect.contains(selectionRect)) {
2484 scrollPosition = IntPoint(selectionRect.x() - visibleRect.width() / 3, selectionRect.y() - visibleRect.height() / 3);
2485 // If both input field's position x and selection rect can be displayed together,
2486 // adjust scroll position to input field's position x.
2487 if (!focusedNodeRect.isEmpty() && selectionRect.x() - focusedNodeRect.x() < visibleRect.width() * 4 / 5)
2488 scrollPosition.setX(focusedNodeRect.x());
2491 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2492 impl->pageClient->setVisibleContentRect(IntRect(scrollPosition, impl->size()), newScaleFactor);
2494 if (newScaleFactor != scaleFactor)
2495 impl->pageProxy->scalePage(newScaleFactor, scrollPosition);
2497 impl->pageProxy->scrollMainFrameTo(scrollPosition);
2499 evas_object_move(smartData->image, smartData->view.x, smartData->view.y);
2503 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
2504 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
2505 static Eina_Bool _ewk_view_composite(void* data)
2507 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
2508 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2510 if (!evas_object_visible_get(smartData->image))
2511 return ECORE_CALLBACK_CANCEL;
2514 evas_object_image_size_get(smartData->image, &ow, &oh);
2515 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(smartData->image, true));
2517 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)));
2518 RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get()));
2520 cairo_save(context.get());
2521 cairo_set_operator(context.get(), CAIRO_OPERATOR_CLEAR);
2522 cairo_rectangle(context.get(), 0, 0, ow, oh);
2523 cairo_fill(context.get());
2524 cairo_restore(context.get());
2526 impl->pageClient->drawContents(context.get());
2528 evas_object_image_data_set(smartData->image, pixels);
2529 evas_object_image_data_update_add(smartData->image, 0, 0, ow, oh);
2531 ewkViewFrameRendered(smartData->self);
2533 impl->compositionAnimator = 0;
2535 return ECORE_CALLBACK_CANCEL;
2539 void ewk_view_mark_for_sync(Evas_Object* ewkView)
2541 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2542 EINA_SAFETY_ON_NULL_RETURN(smartData->image);
2544 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
2545 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2547 if (!ewk_view_is_opengl_backend(ewkView)) {
2548 if (!impl->compositionAnimator)
2549 impl->compositionAnimator = ecore_animator_add(_ewk_view_composite, smartData);
2554 evas_object_image_pixels_dirty_set(smartData->image, true);
2557 static void on_pixels_for_accelerated_compositing(void* data, Evas_Object* obj)
2559 Evas_Object* ewkView = static_cast<Evas_Object*>(data);
2560 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2561 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2562 impl->pageClient->drawContents();
2565 bool ewk_view_image_native_surface_set(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface)
2567 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2568 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2570 if (!smartData->image)
2573 evas_object_image_native_surface_set(smartData->image, nativeSurface);
2574 evas_object_image_pixels_get_callback_set(smartData->image, on_pixels_for_accelerated_compositing, ewkView);
2580 void _ewk_view_suspend_painting(Evas_Object* ewkView)
2582 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2583 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2585 if (!impl->suspendedPainting) {
2586 impl->pageProxy->suspendPainting();
2587 impl->suspendedPainting = true;
2591 void _ewk_view_resume_painting(Evas_Object* ewkView)
2593 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2594 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2596 if (impl->suspendedPainting) {
2597 impl->pageProxy->resumePainting();
2598 impl->suspendedPainting = false;
2602 void ewk_view_suspend(Evas_Object* ewkView)
2604 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2605 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2607 if (impl->pageProxy->estimatedProgress() < 1.0) {
2608 impl->suspendRequested = true;
2611 impl->suspendRequested = false;
2613 _ewk_view_suspend_painting(ewkView);
2615 // FIXME Workaround for suspend/resume while javascript popup is displayed.
2616 // condition ' && !private->isWaitingForJavaScriptPopupReply' is added to
2617 // skip suspendJavaScriptAndResource to prevent multiple ActiveDOMObject
2619 // During the javascript popup is displayed, PageGroupLoadDeferrer is activated,
2620 // which suspends resource loading and scheduled tasks, including ActiveDOMObject.
2621 // When ewk_view_suspend() is called during the javascript popup, scheduled tasks
2622 // will be suspended again.
2623 // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of
2624 // the ActiveDOMObject.
2625 if (!impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) {
2626 impl->pageProxy->suspendJavaScriptAndResource();
2627 impl->suspendedResources = true;
2630 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
2631 impl->pageProxy->suspendPlugin();
2635 void ewk_view_resume(Evas_Object* ewkView)
2637 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2638 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2640 if (impl->suspendRequested) {
2641 impl->suspendRequested = false;
2645 _ewk_view_resume_painting(ewkView);
2647 // FIXME Workaround for suspend/resume while javascript popup is displayed.
2648 // condition ' && !private->isWaitingForJavaScriptPopupReply' is added to
2649 // skip suspendJavaScriptAndResource to prevent multiple ActiveDOMObject
2651 // During the javascript popup is displayed, PageGroupLoadDeferrer is activated,
2652 // which suspends resource loading and scheduled tasks, including ActiveDOMObject.
2653 // When ewk_view_suspend() is called during the javascript popup, scheduled tasks
2654 // will be suspended again.
2655 // Multiple suspend of ActiveDOMObject makes unintended suspend/resume status of
2656 // the ActiveDOMObject.
2657 if (impl->suspendedResources && (!impl->isWaitingForJavaScriptPopupReply || !impl->isWaitingForApplicationCachePermission || !impl->isWaitingForExceededQuotaPopupReply)) {
2658 impl->pageProxy->resumeJavaScriptAndResource();
2659 impl->suspendedResources = false;
2662 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
2663 impl->pageProxy->resumePlugin();
2667 Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Http_Method method, Eina_Hash* headers, const char* body)
2669 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2670 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2671 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
2673 ResourceRequest request(String::fromUTF8(url));
2676 case EWK_HTTP_METHOD_GET:
2677 request.setHTTPMethod("GET");
2679 case EWK_HTTP_METHOD_HEAD:
2680 request.setHTTPMethod("HEAD");
2682 case EWK_HTTP_METHOD_POST:
2683 request.setHTTPMethod("POST");
2685 case EWK_HTTP_METHOD_PUT:
2686 request.setHTTPMethod("PUT");
2688 case EWK_HTTP_METHOD_DELETE:
2689 request.setHTTPMethod("DELETE");
2696 Eina_Iterator* it = eina_hash_iterator_tuple_new(headers);
2698 while (eina_iterator_next(it, &data)) {
2699 Eina_Hash_Tuple* t = static_cast<Eina_Hash_Tuple*>(data);
2700 const char* name = static_cast<const char*>(t->key);
2701 const char* value = static_cast<const char*>(t->data);
2702 request.addHTTPHeaderField(name, value);
2704 eina_iterator_free(it);
2708 request.setHTTPBody(FormData::create(body));
2710 WKRetainPtr<WKURLRequestRef> urlRequest(AdoptWK,toAPI(WebURLRequest::create(request).leakRef()));
2711 WKPageLoadURLRequest(toAPI(impl->pageProxy.get()), urlRequest.get());
2716 Eina_Bool ewk_view_plain_text_set(Evas_Object* ewkView, const char* plainText)
2718 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2719 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2721 WKRetainPtr<WKStringRef> plainTextRef(AdoptWK, WKStringCreateWithUTF8CString(plainText));
2722 WKPageLoadPlainTextString(toAPI(impl->pageProxy.get()), plainTextRef.get());
2727 Eina_Bool ewk_view_contents_set(Evas_Object* ewkView, const char* contents, size_t contentsSize, char* mimeType, char* encoding, char* baseUri)
2729 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2730 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2731 EINA_SAFETY_ON_NULL_RETURN_VAL(contents, false);
2733 if (contentsSize == 0)
2736 String mimeTypeString;
2738 mimeTypeString = String::fromUTF8(mimeType);
2740 mimeTypeString = String::fromUTF8("text/html");
2742 String encodingString;
2744 encodingString = String::fromUTF8(encoding);
2746 encodingString = String::fromUTF8("UTF-8");
2748 String baseUriString;
2750 baseUriString = String::fromUTF8(baseUri);
2752 baseUriString = String::fromUTF8("about:blank");
2754 WKRetainPtr<WKDataRef> contentsRef(AdoptWK, WKDataCreate(reinterpret_cast<const unsigned char*>(contents), contentsSize));
2755 impl->pageProxy->loadContentsbyMimeType(toImpl(contentsRef.get()), mimeTypeString, encodingString, baseUriString);
2760 Eina_Bool ewk_view_html_contents_set(Evas_Object* ewkView, const char* html, const char* baseUri)
2762 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2763 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2765 WKRetainPtr<WKStringRef> htmlString(AdoptWK, WKStringCreateWithUTF8CString(html));
2766 WKRetainPtr<WKURLRef> baseURL(AdoptWK, WKURLCreateWithUTF8CString(baseUri));
2768 WKPageLoadHTMLString(toAPI(impl->pageProxy.get()), htmlString.get(), baseURL.get());
2773 Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State pageVisibilityState, Eina_Bool initialState)
2775 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2776 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2778 TIZEN_LOGI("initialState (%d)", initialState);
2779 #if ENABLE(TIZEN_PAGE_VISIBILITY_API)
2780 WKPageSetPageVisibility(toAPI(impl->pageProxy.get()), static_cast<WKPageVisibilityState>(pageVisibilityState), initialState);
2787 Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* userAgent)
2789 EINA_SAFETY_ON_NULL_RETURN_VAL(userAgent, false);
2791 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2792 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2794 impl->userAgent = userAgent;
2796 WKRetainPtr<WKStringRef> userAgentString(AdoptWK, WKStringCreateWithUTF8CString(userAgent));
2797 WKPageSetCustomUserAgent(toAPI(impl->pageProxy.get()), userAgentString.get());
2802 const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
2804 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2805 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2807 if (!impl->userAgent) {
2808 WKRetainPtr<WKStringRef> userAgentString(AdoptWK, WKPageCopyUserAgent(toAPI(impl->pageProxy.get())));
2810 int length = WKStringGetMaximumUTF8CStringSize(userAgentString.get());
2811 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
2812 WKStringGetUTF8CString(userAgentString.get(), buffer.get(), length);
2813 impl->userAgent = buffer.get();
2816 return impl->userAgent;
2818 Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value)
2820 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2821 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2822 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2824 WKRetainPtr<WKStringRef> customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name));
2825 WKRetainPtr<WKStringRef> customHeaderValue(AdoptWK, WKStringCreateWithUTF8CString(value));
2827 WKPageAddCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get(), customHeaderValue.get());
2830 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2835 Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* name)
2837 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2838 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2839 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2841 WKRetainPtr<WKStringRef> customHeaderName(AdoptWK, WKStringCreateWithUTF8CString(name));
2843 WKPageRemoveCustomHeader(toAPI(impl->pageProxy.get()), customHeaderName.get());
2846 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2851 Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView)
2853 #if ENABLE(TIZEN_CUSTOM_HEADERS)
2854 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2855 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2857 WKPageClearCustomHeaders(toAPI(impl->pageProxy.get()));
2860 ERR("TIZEN_CUSTOM_HEADERS not enabled!");
2865 #if ENABLE(TIZEN_WEBKIT2_VIEW_VISIBILITY)
2866 Eina_Bool ewk_view_visibility_set(Evas_Object* ewkView, Eina_Bool enable)
2868 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2869 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2871 #if ENABLE(TIZEN_DRAG_SUPPORT)
2872 if (impl->pageClient->isDragMode())
2873 impl->pageClient->setDragMode(false);
2876 impl->pageClient->setIsVisible(enable);
2881 Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, Eina_Rectangle viewArea, float scaleFactor, Evas* canvas)
2883 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
2885 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
2886 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
2889 rect.origin.x = viewArea.x;
2890 rect.origin.y = viewArea.y;
2891 rect.size.width = viewArea.w;
2892 rect.size.height = viewArea.h;
2894 WKRetainPtr<WKImageRef> snapshot(AdoptWK, WKPageCreateSnapshot(toAPI(impl->pageProxy.get()), rect, scaleFactor));
2895 if (!snapshot.get())
2898 RefPtr<cairo_surface_t> screenshotSurface = adoptRef(WKImageCreateCairoSurface(snapshot.get()));
2900 Evas_Object* screenshotImage = evas_object_image_add(canvas);
2901 int surfaceWidth = cairo_image_surface_get_width(screenshotSurface.get());
2902 int surfaceHeight = cairo_image_surface_get_height(screenshotSurface.get());
2903 evas_object_image_size_set(screenshotImage, surfaceWidth, surfaceHeight);
2904 evas_object_image_colorspace_set(screenshotImage, EVAS_COLORSPACE_ARGB8888);
2906 uint8_t* pixels = static_cast<uint8_t*>(evas_object_image_data_get(screenshotImage, true));
2908 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)));
2909 RefPtr<cairo_t> cairo = adoptRef(cairo_create(imageSurface.get()));
2911 cairo_set_source_surface(cairo.get(), screenshotSurface.get(), 0, 0);
2912 cairo_rectangle(cairo.get(), 0, 0, surfaceWidth, surfaceHeight);
2913 cairo_fill(cairo.get());
2915 evas_object_image_smooth_scale_set(screenshotImage, true);
2916 evas_object_size_hint_min_set(screenshotImage, surfaceWidth, surfaceHeight);
2917 evas_object_resize(screenshotImage, surfaceWidth, surfaceHeight);
2918 evas_object_image_fill_set(screenshotImage, 0, 0, surfaceWidth, surfaceHeight);
2919 evas_object_image_data_set(screenshotImage, pixels);
2921 return screenshotImage;
2924 unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port)
2926 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
2927 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, 0);
2928 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, 0);
2930 return impl->pageProxy->startInspectorServer(port);
2932 LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n");
2937 Eina_Bool ewk_view_inspector_server_stop(Evas_Object* ewkView)
2939 #if ENABLE(TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR)
2940 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd, false);
2941 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false);
2943 return impl->pageProxy->stopInspectorServer();
2945 LOG_ERROR("TIZEN_WEBKIT2_REMOTE_WEB_INSPECTOR is disabled.\n");
2950 void ewk_view_scroll_by(Evas_Object* ewkView, int deltaX, int deltaY)
2952 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
2953 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
2955 WKPageScrollBy(toAPI(impl->pageProxy.get()), toAPI(IntSize(deltaX, deltaY)));
2958 Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y)
2964 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2965 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2967 IntPoint scrollPosition = impl->pageClient->scrollPosition();
2969 *x = scrollPosition.x();
2971 *y = scrollPosition.y();
2976 Eina_Bool ewk_view_scroll_set(Evas_Object* ewkView, int x, int y)
2978 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2979 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2981 impl->pageProxy->scrollMainFrameTo(IntPoint(x, y));
2985 Eina_Bool ewk_view_scroll_size_get(const Evas_Object* ewkView, int* width, int* height)
2991 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
2992 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
2994 IntSize contentsSize = impl->pageProxy->contentsSize();
2995 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
2996 contentsSize.scale(impl->pageClient->scaleFactor());
2999 if (width && contentsSize.width() > smartData->view.w)
3000 *width = contentsSize.width() - smartData->view.w;
3001 if (height && contentsSize.height() > smartData->view.h)
3002 *height = contentsSize.height() - smartData->view.h;
3006 bool ewkViewRunJavaScriptAlert(Evas_Object* ewkView, WKStringRef alertText)
3008 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3009 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3010 if (!impl->alertContext || !impl->alertContext->javascriptAlertCallback)
3012 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->alertContext->ewkView == ewkView, false);
3014 impl->isWaitingForJavaScriptPopupReply = true;
3015 int length = WKStringGetMaximumUTF8CStringSize(alertText);
3016 OwnArrayPtr<char> alertTextBuffer = adoptArrayPtr(new char[length]);
3017 WKStringGetUTF8CString(alertText, alertTextBuffer.get(), length);
3018 return impl->alertContext->javascriptAlertCallback(impl->alertContext->ewkView, alertTextBuffer.get(), impl->alertContext->userData) == EINA_TRUE;
3021 bool ewkViewRunJavaScriptConfirm(Evas_Object* ewkView, WKStringRef message)
3023 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3024 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3025 if (!impl->confirmContext || !impl->confirmContext->javascriptConfirmCallback)
3027 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->confirmContext->ewkView == ewkView, false);
3029 impl->isWaitingForJavaScriptPopupReply = true;
3030 int length = WKStringGetMaximumUTF8CStringSize(message);
3031 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3032 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3033 return impl->confirmContext->javascriptConfirmCallback(impl->confirmContext->ewkView, messageBuffer.get(), impl->confirmContext->userData) == EINA_TRUE;
3036 bool ewkViewRunJavaScriptPrompt(Evas_Object* ewkView, WKStringRef message, WKStringRef defaultValue)
3038 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3039 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3040 if (!impl->promptContext || !impl->promptContext->javascriptPromptCallback)
3042 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->promptContext->ewkView == ewkView, false);
3044 impl->isWaitingForJavaScriptPopupReply = true;
3045 int length = WKStringGetMaximumUTF8CStringSize(message);
3046 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3047 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3048 length = WKStringGetMaximumUTF8CStringSize(defaultValue);
3049 OwnArrayPtr<char> defaultValueBuffer = adoptArrayPtr(new char[length]);
3050 WKStringGetUTF8CString(defaultValue, defaultValueBuffer.get(), length);
3051 return impl->promptContext->javascriptPromptCallback(impl->promptContext->ewkView, messageBuffer.get(), defaultValueBuffer.get(), impl->promptContext->userData) == EINA_TRUE;
3054 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
3055 bool ewk_view_run_before_unload_confirm_panel(Evas_Object* ewkView, WKStringRef message)
3057 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3058 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3059 if (!impl->beforeUnloadConfirmPanelContext || !impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback)
3061 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->beforeUnloadConfirmPanelContext->ewkView == ewkView, false);
3063 impl->isWaitingForJavaScriptPopupReply = true;
3064 int length = WKStringGetMaximumUTF8CStringSize(message);
3065 OwnArrayPtr<char> messageBuffer = adoptArrayPtr(new char[length]);
3066 WKStringGetUTF8CString(message, messageBuffer.get(), length);
3067 bool result = impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback(impl->beforeUnloadConfirmPanelContext->ewkView, messageBuffer.get(), impl->beforeUnloadConfirmPanelContext->userData) == EINA_TRUE;
3072 bool ewkViewRunOpenPanel(Evas_Object* ewkView, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener)
3074 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3075 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3076 if (!impl->openpanelContext || !impl->openpanelContext->openPanelCallback)
3079 EINA_SAFETY_ON_FALSE_RETURN_VAL(impl->openpanelContext->ewkView == ewkView, false);
3081 impl->openPanelListener = listener;
3083 Eina_Bool allowMultipleFiles = WKOpenPanelParametersGetAllowsMultipleFiles(parameters) ? EINA_TRUE : EINA_FALSE;
3084 Eina_List* acceptedMimeTypes = 0;
3085 WKRetainPtr<WKArrayRef> array(AdoptWK, WKOpenPanelParametersCopyAcceptedMIMETypes(parameters));
3086 size_t len = WKArrayGetSize(array.get());
3087 for (size_t i = 0; i < len; i++) {
3088 WKTypeRef item = WKArrayGetItemAtIndex(array.get(), i);
3089 if (WKGetTypeID(item) != WKStringGetTypeID())
3091 WKStringRef mime = static_cast<WKStringRef>(item);
3092 int length = WKStringGetMaximumUTF8CStringSize(mime);
3093 char* buffer = new char[length];
3094 WKStringGetUTF8CString(mime, buffer, length);
3095 acceptedMimeTypes = eina_list_append(acceptedMimeTypes, static_cast<const void*>(const_cast<const char*>(buffer)));
3097 const char* capture = 0;
3098 #if ENABLE(MEDIA_CAPTURE)
3099 WKRetainPtr<WKStringRef> captureRef(AdoptWK, WKOpenPanelParametersCopyCapture(parameters));
3100 capture = eina_stringshare_add(toImpl(captureRef.get())->string().utf8().data());
3102 bool result = impl->openpanelContext->openPanelCallback(impl->openpanelContext->ewkView, allowMultipleFiles, acceptedMimeTypes, capture, 0);
3103 if (!acceptedMimeTypes)
3108 EINA_LIST_FOREACH(acceptedMimeTypes, list, data)
3109 delete[] (char*)data;
3110 eina_list_free(acceptedMimeTypes);
3114 void ewk_view_javascript_alert_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Alert_Callback callback, void* userData)
3116 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3117 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3119 if (!impl->alertContext)
3120 impl->alertContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3121 impl->alertContext->javascriptAlertCallback = callback;
3122 impl->alertContext->ewkView = ewkView;
3123 impl->alertContext->userData = userData;
3126 void ewk_view_javascript_alert_reply(Evas_Object* ewkView)
3128 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3129 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3131 WKPageReplyJavaScriptAlert(toAPI(impl->page()));
3132 impl->isWaitingForJavaScriptPopupReply = false;
3135 void ewk_view_javascript_confirm_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Confirm_Callback callback, void* userData)
3137 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3138 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3140 if (!impl->confirmContext)
3141 impl->confirmContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3142 impl->confirmContext->javascriptConfirmCallback = callback;
3143 impl->confirmContext->ewkView = ewkView;
3144 impl->confirmContext->userData = userData;
3147 void ewk_view_javascript_confirm_reply(Evas_Object* ewkView, Eina_Bool result)
3149 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3150 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3152 WKPageReplyJavaScriptConfirm(toAPI(impl->page()), result == EINA_TRUE);
3153 impl->isWaitingForJavaScriptPopupReply = false;
3156 void ewk_view_javascript_prompt_callback_set(Evas_Object* ewkView, Ewk_View_JavaScript_Prompt_Callback callback, void* userData)
3158 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3159 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3161 if (!impl->promptContext)
3162 impl->promptContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3163 impl->promptContext->javascriptPromptCallback = callback;
3164 impl->promptContext->ewkView = ewkView;
3165 impl->promptContext->userData = userData;
3168 void ewk_view_javascript_prompt_reply(Evas_Object* ewkView, const char* result)
3170 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3171 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3173 WKRetainPtr<WKStringRef> resultString(AdoptWK, WKStringCreateWithUTF8CString(result));
3174 WKPageReplyJavaScriptPrompt(toAPI(impl->page()), result ? resultString.get() : 0);
3175 impl->isWaitingForJavaScriptPopupReply = false;
3178 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
3179 void ewk_view_before_unload_confirm_panel_callback_set(Evas_Object* ewkView, Ewk_View_Before_Unload_Confirm_Panel_Callback callback, void* userData)
3181 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3182 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3184 if (!impl->beforeUnloadConfirmPanelContext)
3185 impl->beforeUnloadConfirmPanelContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3186 impl->beforeUnloadConfirmPanelContext->beforeUnloadConfirmPanelCallback = callback;
3187 impl->beforeUnloadConfirmPanelContext->ewkView = ewkView;
3188 impl->beforeUnloadConfirmPanelContext->userData = userData;
3191 void ewk_view_before_unload_confirm_panel_reply(Evas_Object* ewkView, Eina_Bool result)
3193 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3194 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3196 WKPageReplyBeforeUnloadConfirmPanel(toAPI(impl->page()), result == EINA_TRUE);
3197 impl->isWaitingForJavaScriptPopupReply = false;
3201 void ewk_view_open_panel_callback_set(Evas_Object* ewkView, Ewk_View_Open_Panel_Callback callback, void* userData)
3203 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3204 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3206 if (!impl->openpanelContext)
3207 impl->openpanelContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
3209 impl->openpanelContext->openPanelCallback = callback;
3210 impl->openpanelContext->ewkView = ewkView;
3211 impl->openpanelContext->userData = userData;
3214 void ewk_view_open_panel_reply(Evas_Object* ewkView, Eina_List* fileUrls, Eina_Bool result)
3216 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3217 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3219 if (!impl->openPanelListener)
3222 unsigned int size = eina_list_count(fileUrls);
3223 if ((result == EINA_FALSE) || (size == 0)) {
3224 WKOpenPanelResultListenerCancel(impl->openPanelListener);
3225 impl->openPanelListener = 0;
3229 WKTypeRef* items = new WKTypeRef[size];
3233 KURL base(KURL(), "file://");
3234 EINA_LIST_FOREACH(fileUrls, list, data) {
3235 KURL url(base, static_cast<char*>(data));
3236 items[i++] = WKURLCreateWithUTF8CString(url.string().utf8().data());
3238 WKRetainPtr<WKArrayRef> filesArray(AdoptWK, WKArrayCreate(items, size));
3239 WKOpenPanelResultListenerChooseFiles(impl->openPanelListener, filesArray.get());
3240 impl->openPanelListener = 0;
3242 eina_list_free(fileUrls);
3245 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3246 static void didGetWebAppCapable(WKBooleanRef capable, WKErrorRef, void* context)
3248 EINA_SAFETY_ON_NULL_RETURN(capable);
3249 EINA_SAFETY_ON_NULL_RETURN(context);
3251 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3253 ASSERT(webAppContext->webAppCapableCallback);
3255 TIZEN_LOGI("webAppCapableCallback exist. capable(%b)", capable);
3257 webAppContext->webAppCapableCallback(toImpl(capable)->value(), webAppContext->userData);
3259 webAppContext->webAppCapableCallback(0, webAppContext->userData);
3261 delete webAppContext;
3264 static void didGetWebAppIconURL(WKStringRef iconURL, WKErrorRef, void* context)
3266 EINA_SAFETY_ON_NULL_RETURN(iconURL);
3267 EINA_SAFETY_ON_NULL_RETURN(context);
3269 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3271 EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
3272 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3274 ASSERT(webAppContext->webAppIconURLCallback);
3277 impl->webAppIconURL = toImpl(iconURL)->string().utf8().data();
3278 webAppContext->webAppIconURLCallback(impl->webAppIconURL, webAppContext->userData);
3280 webAppContext->webAppIconURLCallback(0, webAppContext->userData);
3282 delete webAppContext;
3285 static void didGetWebAppIconURLs(WKDictionaryRef iconURLs, WKErrorRef, void* context)
3287 EINA_SAFETY_ON_NULL_RETURN(iconURLs);
3288 EINA_SAFETY_ON_NULL_RETURN(context);
3290 Ewk_View_Callback_Context* webAppContext = static_cast<Ewk_View_Callback_Context*>(context);
3292 EWK_VIEW_SD_GET_OR_RETURN(webAppContext->ewkView, smartData);
3293 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3295 ASSERT(webAppContext->webAppIconURLsCallback);
3297 if (impl->webAppIconURLs) {
3299 EINA_LIST_FREE(impl->webAppIconURLs, data)
3300 ewkWebAppIconDataDelete(static_cast<Ewk_Web_App_Icon_Data*>(data));
3303 WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(iconURLs));
3304 size_t iconURLCount = WKArrayGetSize(wkKeys.get());
3305 for (size_t i = 0; i < iconURLCount; i++) {
3306 WKStringRef urlRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));
3307 WKStringRef sizeRef = static_cast<WKStringRef>(WKDictionaryGetItemForKey(iconURLs, urlRef));
3308 impl->webAppIconURLs = eina_list_append(impl->webAppIconURLs, ewkWebAppIconDataCreate(sizeRef, urlRef));
3310 TIZEN_LOGI("webAppIconURLsCallback exist. found %d icon urls", iconURLCount);
3312 webAppContext->webAppIconURLsCallback(impl->webAppIconURLs, webAppContext->userData);
3313 delete webAppContext;
3317 Eina_Bool ewk_view_web_application_capable_get(Evas_Object* ewkView, Ewk_Web_App_Capable_Get_Callback callback, void* userData)
3319 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3320 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3321 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3322 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3324 TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
3325 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3326 context->webAppCapableCallback = callback;
3327 context->ewkView = ewkView;
3328 context->userData = userData;
3330 WKPageGetWebAppCapable(toAPI(impl->pageProxy.get()), context, didGetWebAppCapable);
3338 Eina_Bool ewk_view_web_application_icon_url_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URL_Get_Callback callback, void* userData)
3340 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3341 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3342 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3343 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3345 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3346 context->webAppIconURLCallback = callback;
3347 context->ewkView = ewkView;
3348 context->userData = userData;
3350 WKPageGetWebAppIconURL(toAPI(impl->page()), context, didGetWebAppIconURL);
3358 Eina_Bool ewk_view_web_application_icon_urls_get(Evas_Object* ewkView, Ewk_Web_App_Icon_URLs_Get_Callback callback, void* userData)
3360 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
3361 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3362 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3363 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3365 TIZEN_LOGI("callback(%d), userData(%d)", callback, userData);
3366 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3367 context->webAppIconURLsCallback = callback;
3368 context->ewkView = ewkView;
3369 context->userData = userData;
3371 WKPageGetWebAppIconURLs(toAPI(impl->page()), context, didGetWebAppIconURLs);
3375 UNUSED_PARAM(ewkView);
3376 UNUSED_PARAM(callback);
3377 UNUSED_PARAM(userData);
3382 Eina_Bool ewk_view_command_execute(Evas_Object* ewkView, const char* command, const char* value)
3384 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3385 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3386 EINA_SAFETY_ON_NULL_RETURN_VAL(command, false);
3388 WKRetainPtr<WKStringRef> commandString(AdoptWK, WKStringCreateWithUTF8CString(command));
3389 WKRetainPtr<WKStringRef> valueString(AdoptWK, WKStringCreateWithUTF8CString(value));
3390 WKPageExecuteCommandWithArgument(toAPI(impl->pageProxy.get()), commandString.get(), valueString.get());
3395 Eina_Bool ewk_view_contents_size_get(Evas_Object* ewkView, Evas_Coord* width, Evas_Coord* height)
3402 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3403 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3405 IntSize contentsSize = impl->pageProxy->contentsSize();
3408 *width = contentsSize.width();
3410 *height = contentsSize.height();
3415 Eina_Bool ewk_view_contents_pdf_get_temp(Evas_Object* ewkView, int width, int height, const char* fileName)
3417 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
3418 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3419 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3420 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false);
3422 IntSize contentsSize = impl->pageProxy->contentsSize();
3423 WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName));
3431 Eina_Bool ewk_view_contents_pdf_get(Evas_Object* ewkView, int width, int height, const char* fileName)
3433 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
3434 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3435 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3436 EINA_SAFETY_ON_NULL_RETURN_VAL(fileName, false);
3438 IntSize contentsSize = impl->pageProxy->contentsSize();
3439 WKPageGetSnapshotPdfFile(toAPI(impl->pageProxy.get()), toAPI(IntSize(width, height)), toAPI(IntSize(contentsSize.width(), contentsSize.height())), WKStringCreateWithUTF8CString(fileName));
3447 static void runJavaScriptCallback(WKSerializedScriptValueRef scriptValue, WKErrorRef error, void* context)
3449 EINA_SAFETY_ON_NULL_RETURN(context);
3450 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3452 if (!callbackContext->scriptExecuteCallback) {
3453 delete callbackContext;
3457 JSGlobalContextRef jsGlobalContext = ewkViewGetJavascriptGlobalContext(callbackContext->ewkView);
3460 JSValueRef value = WKSerializedScriptValueDeserialize(scriptValue, jsGlobalContext, 0);
3461 JSRetainPtr<JSStringRef> jsStringValue(JSValueToStringCopy(jsGlobalContext, value, 0));
3462 size_t length = JSStringGetMaximumUTF8CStringSize(jsStringValue.get());
3463 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
3464 JSStringGetUTF8CString(jsStringValue.get(), buffer.get(), length);
3465 callbackContext->scriptExecuteCallback(callbackContext->ewkView, buffer.get(), callbackContext->userData);
3467 callbackContext->scriptExecuteCallback(callbackContext->ewkView, 0, callbackContext->userData);
3469 delete callbackContext;
3472 Eina_Bool ewk_view_script_execute(Evas_Object* ewkView, const char* script, Ewk_View_Script_Execute_Callback callback, void* user_data)
3474 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3475 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3476 EINA_SAFETY_ON_NULL_RETURN_VAL(script, false);
3477 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false);
3479 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3480 context->scriptExecuteCallback = callback;
3481 context->ewkView = ewkView;
3482 context->userData = user_data;
3483 WKRetainPtr<WKStringRef> scriptString(AdoptWK, WKStringCreateWithUTF8CString(script));
3484 WKPageRunJavaScriptInMainFrame(toAPI(impl->pageProxy.get()), scriptString.get(), context, runJavaScriptCallback);
3489 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
3490 static void didGetWebStorageQuota(WKUInt32Ref quota, WKErrorRef error, void* context)
3492 Ewk_View_Callback_Context* storageContext = static_cast<Ewk_View_Callback_Context*>(context);
3495 storageContext->webStorageQuotaCallback(toImpl(quota)->value(), storageContext->userData);
3497 storageContext->webStorageQuotaCallback(0, storageContext->userData);
3499 delete storageContext;
3503 Eina_Bool ewk_view_web_storage_quota_get(const Evas_Object* ewkView, Ewk_Web_Storage_Quota_Get_Callback resultCallback, void* userData)
3505 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
3506 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false);
3507 EINA_SAFETY_ON_NULL_RETURN_VAL(resultCallback, false);
3508 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3509 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3510 TIZEN_LOGI("resultCallback (%p)", resultCallback);
3512 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3513 context->webStorageQuotaCallback = resultCallback;
3514 context->userData = userData;
3516 WKPageRef pageRef = toAPI(impl->page());
3517 WKPageGetWebStorageQuota(pageRef, context, didGetWebStorageQuota);
3525 Eina_Bool ewk_view_web_storage_quota_set(Evas_Object* ewkView, uint32_t quota)
3527 #if ENABLE(TIZEN_WEB_STORAGE)
3528 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, false);
3529 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3530 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3532 TIZEN_LOGI("quota (%d)", quota);
3533 WKPageRef pageRef = toAPI(impl->page());
3534 WKPageSetWebStorageQuota(pageRef, quota);
3542 static void getContentsAsStringCallback(WKStringRef plain_text, WKErrorRef error, void* context)
3544 EINA_SAFETY_ON_NULL_RETURN(context);
3545 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3547 ASSERT(callbackContext->plainTextGetCallback);
3550 size_t length = WKStringGetMaximumUTF8CStringSize(plain_text);
3551 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
3552 WKStringGetUTF8CString(plain_text, buffer.get(), length);
3554 callbackContext->plainTextGetCallback(callbackContext->ewkView, buffer.get(), callbackContext->userData);
3556 callbackContext->plainTextGetCallback(callbackContext->ewkView, 0, callbackContext->userData);
3558 delete callbackContext;
3561 Eina_Bool ewk_view_plain_text_get(Evas_Object* ewkView, Ewk_View_Plain_Text_Get_Callback callback, void* user_data)
3563 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3564 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3565 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3566 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->pageClient, false);
3568 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3569 context->plainTextGetCallback = callback;
3570 context->ewkView = ewkView;
3571 context->userData = user_data;
3572 WKPageGetContentsAsString(toAPI(impl->pageProxy.get()), context, getContentsAsStringCallback);
3577 #if ENABLE(TIZEN_SUPPORT_MHTML)
3580 * Callback function used for ewk_view_mhtml_data_get().
3582 static void getContentsAsMHTMLCallback(WKDataRef wkData, WKErrorRef, void* context)
3584 EINA_SAFETY_ON_NULL_RETURN(context);
3585 Ewk_View_Callback_Context* callbackContext = static_cast<Ewk_View_Callback_Context*>(context);
3587 ASSERT(callbackContext->mhtmlDataGetCallback);
3589 callbackContext->mhtmlDataGetCallback(callbackContext->ewkView, reinterpret_cast<const char*>(WKDataGetBytes(wkData)), callbackContext->userData);
3591 delete callbackContext;
3594 Eina_Bool ewk_view_mhtml_data_get(Evas_Object* ewkView, Ewk_View_MHTML_Data_Get_Callback callback, void* user_data)
3596 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
3597 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3598 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3600 Ewk_View_Callback_Context* context = new Ewk_View_Callback_Context;
3601 context->mhtmlDataGetCallback = callback;
3602 context->ewkView = ewkView;
3603 context->userData = user_data;
3605 WKPageGetContentsAsMHTMLData(toAPI(impl->page()), false, context, getContentsAsMHTMLCallback);
3609 #endif // ENABLE(TIZEN_SUPPORT_MHTML)
3611 Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hitTestMode)
3613 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
3614 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3615 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3617 IntPoint pointForHitTest = impl->transformFromScene().mapPoint(IntPoint(x, y));
3618 WebHitTestResult::Data hitTestResultData = impl->pageProxy->hitTestResultAtPoint(pointForHitTest, hitTestMode);
3619 Ewk_Hit_Test* hitTest = ewkHitTestCreate(hitTestResultData);
3627 Ewk_History* ewk_view_history_get(Evas_Object* ewkView)
3629 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0);
3630 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3631 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3632 WebPageProxy* page = impl->page();
3633 EINA_SAFETY_ON_NULL_RETURN_VAL(page, 0);
3635 return ewkHistoryCreate(WKPageGetBackForwardList(toAPI(page)));
3638 Eina_Bool ewk_view_recording_surface_enable_set(Evas_Object* ewkView, Eina_Bool enable)
3640 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3641 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3643 WKPageRecordingSurfaceSetEnable(toAPI(impl->pageProxy.get()), enable);
3648 Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* ewkNotifications)
3650 #if ENABLE(TIZEN_NOTIFICATIONS)
3651 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3652 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3653 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context, false);
3655 TIZEN_LOGI("ewkNotifications (%p)", ewkNotifications);
3656 if (!eina_list_count(ewkNotifications))
3659 Eina_List* listIterator = 0;
3661 Vector<WKTypeRef> ids;
3662 EINA_LIST_FOREACH(ewkNotifications, listIterator, data) {
3663 Ewk_Notification* notification = static_cast<Ewk_Notification*>(data);
3664 WKUInt64Ref idRef = WKUInt64Create(ewk_notification_id_get(notification));
3666 impl->notifications = eina_list_remove(impl->notifications, notification);
3669 WKRetainPtr<WKArrayRef> notificationIDsArray(AdoptWK, WKArrayCreate(ids.data(), ids.size()));
3670 WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(impl->context->wkContext());
3671 WKNotificationManagerProviderDidCloseNotifications(notificationManager, notificationIDsArray.get());
3672 ewkNotificationDeleteNotificationList(ewkNotifications);
3680 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3681 static Eina_List* createPopupMenuList(const Vector<WebPopupItem>& items)
3683 Eina_List* popupItems = 0;
3684 size_t size = items.size();
3685 for (size_t i = 0; i < size; ++i)
3686 popupItems = eina_list_append(popupItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr());
3687 TIZEN_LOGI("size : %d", size);
3691 static void releasePopupMenuList(Eina_List* popupMenuItems)
3693 if (!popupMenuItems)
3697 EINA_LIST_FREE(popupMenuItems, item)
3698 delete static_cast<Ewk_Popup_Menu_Item*>(item);
3702 Eina_Bool ewk_view_popup_menu_close(Evas_Object* ewkView)
3704 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3705 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3706 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
3708 TIZEN_LOGI("proxy : %p", impl->popupMenuProxy);
3711 if (!impl->popupMenuProxy)
3714 impl->popupMenuProxy = 0;
3716 if (smartData->api->popup_menu_hide)
3717 smartData->api->popup_menu_hide(smartData);
3718 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3719 ewk_view_touch_events_enabled_set(ewkView, true);
3721 releasePopupMenuList(impl->popupMenuItems);
3722 impl->popupMenuItems = 0;
3725 EINA_LIST_FREE(impl->popupMenuItems, item)
3726 delete static_cast<Ewk_Popup_Menu_Item*>(item);
3732 Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
3734 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3735 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3736 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
3738 TIZEN_LOGI("proxy : %p / index : %d", impl->popupMenuProxy, selectedIndex);
3740 if (!impl->popupMenuItems)
3744 if (selectedIndex >= eina_list_count(impl->popupMenuItems))
3747 impl->popupMenuProxy->valueChanged(selectedIndex);
3752 #if ENABLE(TIZEN_WEBKIT2_POPUP_INTERNAL)
3753 void ewk_view_popup_menu_update(Evas_Object* ewkView, TextDirection textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex)
3755 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3756 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3757 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3758 TIZEN_LOGI("proxy : %p", impl->popupMenuProxy);
3760 if (!impl->popupMenuProxy)
3763 if (!smartData->api->popup_menu_update)
3766 releasePopupMenuList(impl->popupMenuItems);
3767 impl->popupMenuItems = createPopupMenuList(items);
3769 // TODO: Instead of passing a dummy rect, updated rect should be coming from WebProcess
3770 smartData->api->popup_menu_update(smartData, IntRect(), static_cast<Ewk_Text_Direction>(textDirection), impl->popupMenuItems, selectedIndex);
3774 #if ENABLE(TIZEN_MULTIPLE_SELECT)
3775 Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray* changeList)
3777 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3778 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3779 EINA_SAFETY_ON_NULL_RETURN_VAL(impl->popupMenuProxy, false);
3781 Vector<int> selectedIndex;
3783 if (!impl->popupMenuItems)
3788 itr = eina_inarray_iterator_new(changeList);
3789 EINA_ITERATOR_FOREACH(itr, data)
3791 int* pData = static_cast<int*>(data);
3792 selectedIndex.append(*pData);
3794 eina_iterator_free(itr);
3796 impl->popupMenuProxy->multipleValueChanged(selectedIndex);
3801 void ewk_view_orientation_send(Evas_Object* ewkView, int orientation)
3803 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
3804 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3805 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3806 TIZEN_LOGI("orientation : %d", orientation);
3808 if (orientation != 0 && orientation != 90 && orientation != -90 && orientation != 180)
3811 if (impl->orientation == orientation)
3814 impl->orientation = orientation;
3816 impl->pageProxy->sendOrientationChangeEvent(orientation);
3820 void ewkViewFrameRendered(Evas_Object* ewkView)
3822 evas_object_smart_callback_call(ewkView, "frame,rendered", 0);
3825 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3826 Eina_Bool ewk_view_text_selection_enable_set(Evas_Object* ewkView, Eina_Bool enable)
3828 return ewk_settings_text_selection_enabled_set(ewk_view_settings_get(ewkView), enable);
3831 Eina_Bool ewk_view_text_selection_range_get(Evas_Object* ewkView, Eina_Rectangle* leftRect, Eina_Rectangle* rightRect)
3833 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3834 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3836 IntRect leftSelectionRect;
3837 IntRect rightSelectionRect;
3838 if (!impl->pageProxy->getSelectionHandlers(leftSelectionRect, rightSelectionRect)) {
3851 AffineTransform contentToScreen = impl->transformToScene();
3852 leftSelectionRect = contentToScreen.mapRect(leftSelectionRect);
3853 rightSelectionRect = contentToScreen.mapRect(rightSelectionRect);
3855 leftRect->x = leftSelectionRect.x();
3856 leftRect->y = leftSelectionRect.y();
3857 leftRect->w = leftSelectionRect.width();
3858 leftRect->h = leftSelectionRect.height();
3860 rightRect->x = rightSelectionRect.x();
3861 rightRect->y = rightSelectionRect.y();
3862 rightRect->w = rightSelectionRect.width();
3863 rightRect->h = rightSelectionRect.height();
3868 const char* ewk_view_text_selection_text_get(Evas_Object* ewkView)
3870 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3871 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3873 const CString selectedString = impl->pageProxy->getSelectionText().utf8();
3874 impl->selectedText = selectedString.data();
3876 return impl->selectedText;
3879 Eina_Bool ewk_view_auto_clear_text_selection_mode_set(Evas_Object* ewkView, Eina_Bool enable)
3881 return ewk_settings_clear_text_selection_automatically_set(ewk_view_settings_get(ewkView), enable);
3884 Eina_Bool ewk_view_auto_clear_text_selection_mode_get(Evas_Object* ewkView)
3886 return ewk_settings_clear_text_selection_automatically_get(ewk_view_settings_get(ewkView));
3888 #endif // #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
3890 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3891 void ewkViewInputPickerRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, const String& inputValue)
3893 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3894 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3895 EINA_SAFETY_ON_NULL_RETURN(smartData->api->input_picker_show);
3897 smartData->api->input_picker_show(smartData, inputType, inputValue.utf8().data());
3901 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
3902 void ewkViewGetWindowFrame(Evas_Object* ewkView, int *x, int *y, int *w, int *h)
3904 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3905 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3906 IntPoint drawingPosition = (IntPoint)(impl->pageClient->visibleContentRect().location() - impl->pageClient->scrollPosition());
3908 *x = drawingPosition.x();
3910 *y = drawingPosition.y();
3912 *w = impl->pageClient->visibleContentRect().width();
3914 *h = impl->pageClient->visibleContentRect().height();
3918 void ewk_view_focused_input_element_value_set(Evas_Object* ewkView, const char* value)
3920 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3921 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3922 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3924 impl->pageProxy->setFocusedInputElementValue(String::fromUTF8(value));
3925 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3928 const char* ewk_view_focused_input_element_value_get(Evas_Object* ewkView)
3930 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3931 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
3932 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
3934 impl->inputValue = impl->pageProxy->getFocusedInputElementValue().utf8().data();
3935 return impl->inputValue;
3938 #endif // ENABLE(TIZEN_INPUT_TAG_EXTENSION)
3941 #if ENABLE(TIZEN_DATALIST_ELEMENT)
3942 void ewkViewDataListShowRequest(Evas_Object* ewkView, Ewk_Input_Type inputType, Vector<String> optionList)
3944 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3945 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3946 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3947 EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_show);
3950 ewkViewDataListHideRequest(ewkView, inputType);
3952 for (Vector<String>::const_iterator it = optionList.begin(); it != optionList.end(); ++it) {
3954 impl->dataList = eina_list_append(impl->dataList, eina_stringshare_add(value.utf8().data()));
3957 smartData->api->data_list_show(smartData, inputType, impl->dataList);
3960 void ewkViewDataListHideRequest(Evas_Object* ewkView, Ewk_Input_Type inputType)
3962 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3963 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3964 EINA_SAFETY_ON_NULL_RETURN(impl->dataList);
3965 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
3966 EINA_SAFETY_ON_NULL_RETURN(smartData->api->data_list_hide);
3968 impl->deleteDataList();
3970 smartData->api->data_list_hide(smartData, inputType);
3974 void ewk_view_data_list_close(Evas_Object* ewkView, const char* value)
3976 #if ENABLE(TIZEN_DATALIST_ELEMENT)
3977 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
3978 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
3980 impl->deleteDataList();
3982 ewk_view_focused_input_element_value_set(ewkView, value);
3986 Eina_Bool ewk_view_horizontal_panning_hold_get(Evas_Object* ewkView)
3988 #if ENABLE(TIZEN_GESTURE)
3989 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
3990 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
3991 return impl->holdHorizontalPanning;
3997 void ewk_view_horizontal_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold)
3999 #if ENABLE(TIZEN_GESTURE)
4000 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4001 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4002 impl->holdHorizontalPanning = hold;
4006 Eina_Bool ewk_view_vertical_panning_hold_get(Evas_Object* ewkView)
4008 #if ENABLE(TIZEN_GESTURE)
4009 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4010 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4011 return impl->holdVerticalPanning;
4017 void ewk_view_vertical_panning_hold_set(Evas_Object* ewkView, Eina_Bool hold)
4019 #if ENABLE(TIZEN_GESTURE)
4020 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4021 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4022 impl->holdVerticalPanning = hold;
4026 void ewk_view_touch_event_handler_result_set(Evas_Object* ewkView, WebKit::WebEvent::Type type, bool wasHandled)
4028 #if ENABLE(TIZEN_GESTURE)
4029 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4030 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4032 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4033 if (impl->focusRing && wasHandled)
4034 impl->focusRing->hide();
4035 #endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4037 if (impl->mouseEventsEnabled())
4040 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
4041 if (wasHandled && impl->pageClient->isTextSelectionMode()) {
4042 if (type == WebEvent::TouchStart)
4043 impl->pageClient->updateTextSelectionHandlesAndContextMenu(false);
4044 else if (type == WebEvent::TouchMove)
4045 impl->pageClient->updateTextSelectionHandlesAndContextMenu(false);
4046 else if (type == WebEvent::TouchEnd)
4047 impl->pageClient->requestToShowTextSelectionHandlesAndContextMenu();
4051 // We have to check TouchStart, TouchMove and TouchEnd with handled.
4052 // The Pan and Flick will be enabled if Touch Start was not handled,
4053 // and Touch Move was not handled or did not occur.
4054 // Tap will be enabled if Touch Start and End was not handled
4055 // and Touch Move did not occur.
4056 // The gestures are disabled as a default.
4057 // o: handled, x: not handled
4058 // ------------------------------------------------------------
4059 // Touch Start | Touch Move | Touch End || Tap | Pan, Flick
4060 // ------------------------------------------------------------
4061 // o | o or x | o or x || disable | disable
4062 // x | o | o or x || disable | disable
4063 // x | x | o or x || disable | enable
4064 // x |not occured | x || enable | enable
4065 // ------------------------------------------------------------
4066 if (type == WebEvent::TouchStart) {
4067 impl->gestureClient->setGestureEnabled(!wasHandled);
4068 impl->wasHandledTouchStart = wasHandled;
4070 // Initialize wasHandledTouchMove to true and notify that to the application
4071 // to prevent applications scrolling at the beginning of touch.
4072 impl->wasHandledTouchMove = true;
4073 evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast<void*>(&impl->wasHandledTouchMove));
4074 } else if (type == WebEvent::TouchMove) {
4075 impl->gestureClient->setMovingEnabled(!wasHandled);
4077 // We have to set wasHandled to true if touchstart was handled even though current touchmove was not handled.
4078 if (impl->wasHandledTouchStart)
4081 // Notify the result of touchmove to applications when handled value is changed
4082 // in order to make applications to choose whether scrolling its scrollable objects or not.
4083 if (impl->wasHandledTouchMove != wasHandled)
4084 evas_object_smart_callback_call(ewkView, "touchmove,handled", static_cast<void*>(&wasHandled));
4085 impl->wasHandledTouchMove = wasHandled;
4086 } else if (type == WebEvent::TouchEnd && !impl->exceedTouchMoveThreshold && !wasHandled) {
4087 impl->gestureClient->setMovingEnabled(!wasHandled);
4088 impl->gestureClient->setTapEnabled(!wasHandled);
4093 #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION)
4094 void ewkViewDidGetTextStyleStateForSelection(Evas_Object* ewkView, int underlineState, int italicState, int boldState, const IntPoint& startPoint, const IntPoint& endPoint)
4096 Ewk_Text_Style* textStyle = ewkTextStyleCreate(underlineState, italicState, boldState, startPoint, endPoint);
4097 evas_object_smart_callback_call(ewkView, "text,style,state", static_cast<void*>(textStyle));
4098 ewkTextStyleDelete(textStyle);
4102 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
4103 bool ewk_view_orientation_lock(Evas_Object* ewkView, int willLockOrientation)
4105 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4106 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, false);
4108 TIZEN_LOGI("willLockOrientation (%d)", willLockOrientation);
4109 if (!smartData->api->orientation_lock) {
4114 return smartData->api->orientation_lock(smartData, willLockOrientation);
4117 void ewk_view_orientation_unlock(Evas_Object* ewkView)
4119 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4120 EINA_SAFETY_ON_NULL_RETURN(smartData->api);
4122 TIZEN_LOGI("ewkView (%p)", ewkView);
4123 if (!smartData->api->orientation_unlock) {
4128 smartData->api->orientation_unlock(smartData);
4132 void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data)
4134 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
4135 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4136 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4137 TIZEN_LOGI("callbacks: %p / data: %p", func, data);
4139 impl->orientationLock.callback = func;
4140 impl->orientationLock.data = data;
4144 #if ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT_INTERNAL)
4145 Eina_Bool _ewk_orientation_lock(Ewk_View_Smart_Data *sd, int orientations)
4147 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl, false);
4148 TIZEN_LOGI("locked orientations : %d", orientations);
4150 if (impl->orientationLock.callback)
4151 return impl->orientationLock.callback(sd->self, true, orientations, impl->orientationLock.data);
4156 void _ewk_orientation_unlock(Ewk_View_Smart_Data *sd)
4158 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
4159 TIZEN_LOGI("unlock is requested");
4161 if (impl->orientationLock.callback)
4162 impl->orientationLock.callback(sd->self, false, 0, impl->orientationLock.data);
4166 #if ENABLE(TIZEN_RUNTIME_BACKEND_SELECTION)
4167 bool ewk_view_is_opengl_backend(Evas_Object* ewkView)
4169 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4171 Ecore_Evas* ee = ecore_evas_ecore_evas_get(smartData->base.evas);
4172 const char *engine = ecore_evas_engine_name_get(ee);
4173 if (engine && !strcmp(engine, "opengl_x11"))
4179 void ewk_view_zoomable_area_set(Evas_Object* ewkView, const IntPoint& target, const IntRect& area)
4181 #if ENABLE(TIZEN_GESTURE)
4182 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4183 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4185 impl->gestureClient->setZoomableArea(target, area);
4189 #if ENABLE(TIZEN_BACKFORWARD_LIST_CLEAR)
4190 void ewk_view_back_forward_list_clear(const Evas_Object* ewkView)
4192 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4193 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4195 WKBackForwardListClearBackForwardList(WKPageGetBackForwardList(toAPI(impl->pageProxy.get())));
4199 #if ENABLE(TIZEN_SIGNAL_APP_BACK_FORWARD_LIST_CHANGED)
4200 void ewkViewBackForwardListChanged(Evas_Object* ewkView)
4202 evas_object_smart_callback_call(ewkView, "back,forward,list,changed", 0);
4206 #if ENABLE(TIZEN_ICON_DATABASE)
4207 void ewkViewIconReceived(Evas_Object* ewkView)
4211 evas_object_smart_callback_call(ewkView, "icon,received", 0);
4215 #endif // #if OS(TIZEN)
4217 Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers)
4219 #if ENABLE(TOUCH_EVENTS)
4220 EINA_SAFETY_ON_NULL_RETURN_VAL(points, false);
4221 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4222 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4224 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) && ENABLE(TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP)
4225 if (impl->pageClient->isTextSelectionMode() && eina_list_count(points) == 1) {
4226 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4227 IntPoint handlePoint(point->x, point->y);
4229 if (type == EWK_TOUCH_START)
4230 impl->pageClient->textSelectonHandleDown(handlePoint);
4231 else if (type == EWK_TOUCH_MOVE)
4232 impl->pageClient->textSelectonHandleMove(handlePoint);
4234 impl->pageClient->textSelectonHandleUp();
4238 #if ENABLE(TIZEN_GESTURE)
4239 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
4240 // We don't want to process touch event when context menu is shown.
4241 if (impl->pageClient->isContextMenuVisible() && type != EWK_TOUCH_CANCEL)
4244 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
4245 if (impl->pageClient->isTextSelectionDowned() && type != EWK_TOUCH_CANCEL)
4249 if (type == EWK_TOUCH_START) {
4250 if (eina_list_count(points) == 1) {
4251 impl->gestureClient->reset();
4252 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4253 impl->touchDownPoint.x = point->x;
4254 impl->touchDownPoint.y = point->y;
4255 impl->exceedTouchMoveThreshold = false;
4257 } else if (type == EWK_TOUCH_MOVE && !impl->exceedTouchMoveThreshold) {
4258 if (eina_list_count(points) == 1) {
4259 unsigned int threshold = elm_config_scroll_thumbscroll_threshold_get();
4260 Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_data_get(points));
4261 int diffX = impl->touchDownPoint.x - point->x;
4262 int diffY = impl->touchDownPoint.y - point->y;
4263 if (static_cast<unsigned int>(diffX * diffX + diffY * diffY) > threshold * threshold)
4264 impl->exceedTouchMoveThreshold = true;
4268 impl->exceedTouchMoveThreshold = true;
4271 #endif // #if ENABLE(TIZEN_GESTURE)
4273 // FIXME: impl is used in the webkit opensource, but tizen webkit does not use it yet.
4274 //impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
4275 impl->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, impl->transformFromScene(), impl->transformToScreen(), ecore_time_get()));
4283 Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enabled)
4285 #if ENABLE(TOUCH_EVENTS)
4286 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4287 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4289 impl->setTouchEventsEnabled(!!enabled);
4297 Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView)
4299 #if ENABLE(TOUCH_EVENTS)
4300 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4301 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4303 return impl->touchEventsEnabled();
4309 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewkView, Eina_Bool visible)
4311 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
4312 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4313 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4315 impl->mainFrameScrollbarVisibility = visible;
4316 impl->pageClient->updateVisibility();
4324 Eina_Bool ewk_view_main_frame_scrollbar_visible_get(const Evas_Object* ewkView)
4326 #if ENABLE(TIZEN_WEBKIT2_TILED_SCROLLBAR)
4327 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4328 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4330 return impl->mainFrameScrollbarVisibility;
4336 Eina_Bool ewk_view_page_save(Evas_Object* ewkView, const char* path)
4338 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
4339 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4340 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4341 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
4343 String title = ewk_view_title_get(ewkView);
4344 String url = ewk_view_url_get(ewkView);
4345 String directoryPath(path);
4346 impl->pageClient->startOfflinePageSave(directoryPath, url, title);
4350 UNUSED_PARAM(ewkView);
4358 * Callback function used for ewk_view_page_contents_get().
4360 static void ewkViewPageContentsAsMHTMLCallback(WKDataRef wkData, WKErrorRef, void* context)
4362 EINA_SAFETY_ON_NULL_RETURN(context);
4364 RefPtr<WebData> webData = toImpl(wkData);
4365 Ewk_Page_Contents_Context* contentsContext= static_cast<Ewk_Page_Contents_Context*>(context);
4366 contentsContext->callback(contentsContext->type, reinterpret_cast<const char*>(webData->bytes()));
4371 * Callback function used for ewk_view_page_contents_get().
4373 static void ewkViewPageContentsAsStringCallback(WKStringRef wkString, WKErrorRef, void* context)
4375 EINA_SAFETY_ON_NULL_RETURN(context);
4377 RefPtr<WebString> webString = toImpl(wkString);
4378 Ewk_Page_Contents_Context* contentsContext= static_cast<Ewk_Page_Contents_Context*>(context);
4379 contentsContext->callback(contentsContext->type, webString->string().utf8().data());
4382 Eina_Bool ewk_view_page_contents_get(const Evas_Object* ewkView, Ewk_Page_Contents_Context* context)
4384 EINA_SAFETY_ON_NULL_RETURN_VAL(context, false);
4385 EINA_SAFETY_ON_NULL_RETURN_VAL(context->callback, false);
4386 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4387 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4389 switch (context->type) {
4390 case EWK_PAGE_CONTENTS_TYPE_MHTML:
4391 impl->pageProxy->getContentsAsMHTMLData(DataCallback::create(context, ewkViewPageContentsAsMHTMLCallback), false);
4394 case EWK_PAGE_CONTENTS_TYPE_STRING:
4395 impl->pageProxy->getContentsAsString(StringCallback::create(context, ewkViewPageContentsAsStringCallback));
4399 ASSERT_NOT_REACHED();
4406 Eina_Bool ewk_view_animated_scroll_set(Evas_Object* ewkView, int x, int y)
4408 #if ENABLE(TIZEN_GESTURE)
4409 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4410 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4412 return impl->gestureClient->scrollToWithAnimation(x, y);
4414 UNUSED_PARAM(ewkView);
4421 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
4422 void ewkViewFocusRingHide(Evas_Object* ewkView)
4424 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4425 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4427 if (impl->focusRing)
4428 impl->focusRing->hide();
4432 void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* policy, Ewk_CSP_Header_Type type)
4434 #if ENABLE(TIZEN_CSP)
4435 EWK_VIEW_SD_GET_OR_RETURN(ewkView, sd);
4436 EWK_VIEW_IMPL_GET_OR_RETURN(sd, impl);
4438 TIZEN_LOGI("policy(%s), type(%d)\n", policy, type);
4439 impl->pageProxy->setContentSecurityPolicy(String::fromUTF8(policy), static_cast<WebCore::ContentSecurityPolicy::HeaderType>(type));
4443 #if ENABLE(TIZEN_APPLICATION_CACHE)
4444 Eina_Bool ewkViewRequestApplicationCachePermission(Evas_Object* ewkView, WKSecurityOriginRef origin)
4446 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4447 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4449 if (!impl->applicationCachePermissionContext || !impl->applicationCachePermissionContext->applicationCachePermissionCallback)
4452 impl->isWaitingForApplicationCachePermission = true;
4453 if (impl->applicationCachePermissionOrigin)
4454 deleteSecurityOrigin(impl->applicationCachePermissionOrigin);
4455 impl->applicationCachePermissionOrigin = createSecurityOrigin(origin);
4457 return impl->applicationCachePermissionContext->applicationCachePermissionCallback(ewkView, impl->applicationCachePermissionOrigin, impl->applicationCachePermissionContext->userData) == EINA_TRUE;
4461 void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData)
4463 #if ENABLE(TIZEN_APPLICATION_CACHE)
4464 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4465 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4467 if (!impl->applicationCachePermissionContext)
4468 impl->applicationCachePermissionContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4469 impl->applicationCachePermissionContext->applicationCachePermissionCallback = callback;
4470 impl->applicationCachePermissionContext->userData = userData;
4472 UNUSED_PARAM(ewkView);
4473 UNUSED_PARAM(callback);
4474 UNUSED_PARAM(userData);
4478 void ewk_view_application_cache_permission_reply(Evas_Object* ewkView, Eina_Bool allow)
4480 #if ENABLE(TIZEN_APPLICATION_CACHE)
4481 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4482 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4484 TIZEN_LOGI("allow %d", allow);
4485 WKPageReplyApplicationCachePermission(toAPI(impl->page()), allow);
4486 if (impl->applicationCachePermissionOrigin)
4487 deleteSecurityOrigin(impl->applicationCachePermissionOrigin);
4488 impl->applicationCachePermissionOrigin = 0;
4489 impl->isWaitingForApplicationCachePermission = false;
4491 UNUSED_PARAM(ewkView);
4492 UNUSED_PARAM(allow);
4496 #if ENABLE(TIZEN_INDEXED_DATABASE)
4497 bool ewkViewExceededIndexedDatabaseQuota(Evas_Object* ewkView, WKSecurityOriginRef origin, long long currentUsage)
4499 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4500 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4502 if (!impl->exceededIndexedDatabaseQuotaContext || !impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback)
4505 impl->isWaitingForExceededQuotaPopupReply = true;
4506 if (impl->exceededQuotaOrigin)
4507 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4508 impl->exceededQuotaOrigin = createSecurityOrigin(origin);
4510 TIZEN_LOGI("currentUsage(%lld)", currentUsage);
4512 return impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback(ewkView, impl->exceededQuotaOrigin, currentUsage, impl->exceededIndexedDatabaseQuotaContext->userData) == EINA_TRUE;
4516 void ewk_view_exceeded_indexed_database_quota_callback_set(Evas_Object* ewkView, Ewk_View_Exceeded_Indexed_Database_Quota_Callback callback, void* userData)
4518 #if ENABLE(TIZEN_INDEXED_DATABASE)
4519 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4520 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4522 if (!impl->exceededIndexedDatabaseQuotaContext)
4523 impl->exceededIndexedDatabaseQuotaContext = adoptPtr<Ewk_View_Callback_Context>(new Ewk_View_Callback_Context);
4524 impl->exceededIndexedDatabaseQuotaContext->exceededIndexedDatabaseQuotaCallback = callback;
4525 impl->exceededIndexedDatabaseQuotaContext->userData = userData;
4527 UNUSED_PARAM(ewkView);
4528 UNUSED_PARAM(callback);
4529 UNUSED_PARAM(userData);
4533 void ewk_view_exceeded_indexed_database_quota_reply(Evas_Object* ewkView, Eina_Bool allow)
4535 #if ENABLE(TIZEN_INDEXED_DATABASE)
4536 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
4537 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
4539 TIZEN_LOGI("allow %d", allow);
4540 WKPageReplyExceededIndexedDatabaseQuota(toAPI(impl->page()), allow == EINA_TRUE);
4541 if (impl->exceededQuotaOrigin)
4542 deleteSecurityOrigin(impl->exceededQuotaOrigin);
4543 impl->exceededQuotaOrigin = 0;
4544 impl->isWaitingForExceededQuotaPopupReply = false;
4546 UNUSED_PARAM(ewkView);
4547 UNUSED_PARAM(allow);
4551 // EwkFindOptions should be matched up orders with WkFindOptions.
4552 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_CASE_INSENSITIVE, kWKFindOptionsCaseInsensitive);
4553 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_AT_WORD_STARTS, kWKFindOptionsAtWordStarts);
4554 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START, kWKFindOptionsTreatMedialCapitalAsWordStart);
4555 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_BACKWARDS, kWKFindOptionsBackwards);
4556 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_WRAP_AROUND, kWKFindOptionsWrapAround);
4557 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_OVERLAY, kWKFindOptionsShowOverlay);
4558 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_FIND_INDICATOR, kWKFindOptionsShowFindIndicator);
4559 COMPILE_ASSERT_MATCHING_ENUM(EWK_FIND_OPTIONS_SHOW_HIGHLIGHT, kWKFindOptionsShowHighlight);
4561 Eina_Bool ewk_view_text_find(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
4563 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4564 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4565 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
4567 impl->pageProxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);
4572 Eina_Bool ewk_view_text_find_highlight_clear(Evas_Object* ewkView)
4574 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4575 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4577 impl->pageProxy->hideFindUI();
4582 Eina_Bool ewk_view_text_matches_count(Evas_Object* ewkView, const char* text, Ewk_Find_Options options, unsigned maxMatchCount)
4584 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
4585 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
4586 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false);
4588 impl->pageProxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);