Put date into field that was used to activate DatePicker instead of currectly focused...
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / efl / WebPageProxyEfl.cpp
1 /*
2  * Copyright (C) 2011 Samsung Electronics
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "WebPageProxy.h"
28
29 #include "EwkViewImpl.h"
30 #include "NativeWebKeyboardEvent.h"
31 #include "NotImplemented.h"
32 #include "PageClientImpl.h"
33 #include "WebPageMessages.h"
34 #include "WebProcessProxy.h"
35
36 #include <sys/utsname.h>
37
38 #if OS(TIZEN)
39 #include "DrawingAreaMessages.h"
40
41 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
42 #include "LayerTreeCoordinatorProxy.h"
43 #endif
44 #include "NativeWebKeyboardEvent.h"
45 #include "WebImage.h"
46 #include "WebPageMessages.h"
47 #include "WebProcessProxy.h"
48 #include <WebCore/IntSize.h>
49 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
50 #include "WebContextMenuProxy.h"
51 #include "ewk_view_private.h"
52 #endif
53
54 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, m_process->connection())
55
56 #if ENABLE(TIZEN_LINK_MAGNIFIER)
57 #include "LinkMagnifierProxy.h"
58 #endif
59
60 #if ENABLE(TIZEN_SCREEN_READER)
61 #include "ScreenReaderProxy.h"
62 #include "ewk_view_private.h"
63 #endif
64
65 #if ENABLE(TIZEN_CSP)
66 #include <WebCore/ContentSecurityPolicy.h>
67 #endif
68
69 #include <system_info.h>
70 #include "WebKitVersion.h"
71
72 using namespace WebCore;
73 #endif
74
75 namespace WebKit {
76
77 Evas_Object* WebPageProxy::viewWidget()
78 {
79     return static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->view();
80 }
81
82 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
83 {
84 #if OS(TIZEN)
85     WTF::String appleWebkitVer = makeString(String::number(WEBKIT_MAJOR_VERSION), '.', String::number(WEBKIT_MINOR_VERSION));
86
87     char* versionName = NULL;
88     WTF::String platformVer;
89     int ret = system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &versionName);
90     if (ret == SYSTEM_INFO_ERROR_NONE) {
91         char* versionNameCopy = NULL;
92         versionNameCopy = strdup(versionName);
93
94         char* majorVersion = NULL;
95         char* minorVersion = NULL;
96         majorVersion = strtok(versionNameCopy, ".");
97         minorVersion = strtok(NULL, ".");
98
99         if (majorVersion == NULL || minorVersion == NULL) {
100             platformVer = String("2.2");
101         } else {
102             WTF::String platformVerMajor;
103             WTF::String platformVerMinor;
104             platformVerMajor = String(majorVersion);
105             platformVerMinor = String(minorVersion);
106             platformVer = makeString(platformVerMajor, ".", platformVerMinor);
107         }
108         free(versionNameCopy);
109     }
110
111     if (versionName)
112         free(versionName);
113
114     WTF::String userAgentString = makeString("Mozilla/5.0 (Linux; Tizen ", platformVer, "; sdk) AppleWebKit/", appleWebkitVer, " (KHTML, like Gecko)");
115     if (applicationNameForUserAgent.isEmpty())
116         userAgentString.append(makeString("Version/", platformVer));
117     else
118         userAgentString.append(applicationNameForUserAgent);
119     userAgentString.append(makeString(" Mobile Safari/", appleWebkitVer));
120
121     return userAgentString;
122 #endif
123
124     WTF::String platform;
125     WTF::String version;
126     WTF::String osVersion;
127
128 #if PLATFORM(X11)
129     platform = "X11";
130 #else
131     platform = "Unknown";
132 #endif
133     version = makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.',
134                          String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+');
135     struct utsname name;
136     if (uname(&name) != -1)
137         osVersion = WTF::String(name.sysname) + " " + WTF::String(name.machine);
138     else
139         osVersion = "Unknown";
140
141     if (applicationNameForUserAgent.isEmpty())
142         return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
143                " (KHTML, like Gecko) Version/5.0 Safari/", version);
144
145     return makeString("Mozilla/5.0 (", platform, "; ", osVersion, ") AppleWebKit/", version,
146            " (KHTML, like Gecko) Version/5.0 Safari/", version, applicationNameForUserAgent);
147 }
148
149 void WebPageProxy::getEditorCommandsForKeyEvent(Vector<WTF::String>& commandsList)
150 {
151     notImplemented();
152 }
153
154 void WebPageProxy::saveRecentSearches(const String&, const Vector<String>&)
155 {
156     notImplemented();
157 }
158
159 void WebPageProxy::loadRecentSearches(const String&, Vector<String>&)
160 {
161     notImplemented();
162 }
163
164 void WebPageProxy::setThemePath(const String& themePath)
165 {
166     process()->send(Messages::WebPage::SetThemePath(themePath), m_pageID, 0);
167 }
168
169 #if ENABLE(TIZEN_CUSTOM_HEADERS)
170 void WebPageProxy::addCustomHeader(const String& name, const String& value)
171 {
172     if (name.isEmpty())
173         return;
174
175     if (value.isEmpty())
176         return;
177
178     if (!isValid())
179         return;
180
181     process()->send(Messages::WebPage::AddCustomHeader(name, value), m_pageID);
182 }
183
184 void WebPageProxy::removeCustomHeader(const String& name)
185 {
186     if (name.isEmpty())
187         return;
188
189     if (!isValid())
190         return;
191
192     process()->send(Messages::WebPage::RemoveCustomHeader(name), m_pageID);
193 }
194
195 void WebPageProxy::clearCustomHeaders()
196 {
197     if (!isValid())
198         return;
199
200     process()->send(Messages::WebPage::ClearCustomHeaders(), m_pageID);
201 }
202 #endif
203
204 #if OS(TIZEN)
205 bool WebPageProxy::scrollMainFrameBy(const IntSize& scrollOffset)
206 {
207 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
208     return static_cast<PageClientImpl*>(m_pageClient)->scrollBy(scrollOffset);
209 #else
210     if (!isValid())
211         return false;
212
213     process()->send(Messages::WebPage::ScrollMainFrameBy(scrollOffset), m_pageID);
214     return true;
215 #endif
216 }
217
218 void WebPageProxy::scrollMainFrameTo(const IntPoint& scrollPosition)
219 {
220 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
221     static_cast<PageClientImpl*>(m_pageClient)->scrollTo(scrollPosition);
222 #else
223     if (!isValid())
224         return;
225
226     process()->send(Messages::WebPage::ScrollMainFrameTo(scrollPosition), m_pageID);
227 #endif
228 }
229
230 void WebPageProxy::didChangeScrollPositionForMainFrame(const IntPoint& scrollPosition)
231 {
232 #if !ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
233     m_scrollPosition = scrollPosition;
234 #endif
235 }
236
237 void WebPageProxy::didChangeContentsSize(const IntSize& size)
238 {
239     if (m_contentsSize == size)
240         return;
241
242     m_contentsSize = size;
243     m_pageClient->didChangeContentsSize(size);
244 }
245
246 PassRefPtr<WebImage> WebPageProxy::createSnapshot(const IntRect& rect, float scaleFactor)
247 {
248     if (!isValid())
249         return 0;
250
251     ShareableBitmap::Handle snapshotHandle;
252     // Do not wait for more than a second (arbitrary) for the WebProcess to get the snapshot so
253     // that the UI Process is not permanently stuck waiting on a potentially crashing Web Process.
254     static const double createSnapshotSyncMessageTimeout = 1.0;
255 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
256     float baseScaleFactor = static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
257     scaleFactor = scaleFactor * baseScaleFactor;
258
259     IntRect visibleContentRect = static_cast<PageClientImpl*>(m_pageClient)->visibleContentRect();
260     IntRect scaledRect = rect;
261     scaledRect.move(visibleContentRect.x(), visibleContentRect.y());
262     scaledRect.scale(1/baseScaleFactor);
263     process()->sendSync(Messages::WebPage::CreateSnapshot(scaledRect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
264 #else
265     process()->sendSync(Messages::WebPage::CreateSnapshot(rect, scaleFactor), Messages::WebPage::CreateSnapshot::Reply(snapshotHandle), m_pageID, createSnapshotSyncMessageTimeout);
266 #endif
267     if (snapshotHandle.isNull())
268         return 0;
269     return WebImage::create(ShareableBitmap::create(snapshotHandle));
270 }
271
272 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
273 void WebPageProxy::textChangeInTextField(const String& name, const String& value)
274 {
275     static_cast<PageClientImpl*>(m_pageClient)->textChangeInTextField(name, value);
276 }
277 #endif
278
279 #if ENABLE(TIZEN_ISF_PORT)
280 void WebPageProxy::prepareKeyDownEvent()
281 {
282     if (!isValid())
283         return;
284
285     process()->send(Messages::WebPage::PrepareKeyDownEvent(), m_pageID);
286 }
287
288 void WebPageProxy::deleteSurroundingText(int offset, int count)
289 {
290     if (!isValid())
291         return;
292
293     process()->send(Messages::WebPage::DeleteSurroundingText(offset, count), m_pageID);
294 }
295
296 void WebPageProxy::didCancelComposition()
297 {
298     m_didCancelCompositionFromWebProcess = true;
299     InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
300     if (inputMethodContext)
301         inputMethodContext->resetIMFContext();
302     m_didCancelCompositionFromWebProcess = false;
303 }
304
305 void WebPageProxy::removeInputMethodContext(uintptr_t id)
306 {
307     if (m_editorState.inputMethodContextID == id) {
308         m_editorState.inputMethodContextID = 0;
309         m_editorState.isContentEditable = false;
310     }
311
312     InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
313     if (!inputMethodContext)
314         return;
315
316     inputMethodContext->removeIMFContext(id);
317 }
318
319 void WebPageProxy::recalcFilterEvent(const EditorState& editorState, bool isStart, bool& isFiltered)
320 {
321     if (isStart)
322         process()->send(Messages::WebPage::EndRecalcFilterEvent(), m_pageID);
323
324     editorStateChanged(editorState);
325     isFiltered = false;
326
327     InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
328     if (!inputMethodContext || m_keyEventQueue.isEmpty())
329         return;
330
331 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
332     NativeWebKeyboardEvent event = m_keyEventQueue.first().forwardedEvent;
333 #else
334     NativeWebKeyboardEvent event = m_keyEventQueue.first();
335 #endif
336     if (!event.nativeEvent() || event.nativeEvent()->type() != ECORE_IMF_EVENT_KEY_DOWN)
337         return;
338
339     isFiltered = inputMethodContext->recalcFilterEvent(event.nativeEvent()->event());
340 }
341 #endif // #if ENABLE(TIZEN_ISF_PORT)
342
343 void WebPageProxy::requestUpdateFormNavigation()
344 {
345     if (!isValid())
346         return;
347
348     process()->send(Messages::WebPage::RequestUpdateFormNavigation(), m_pageID);
349 }
350
351 void WebPageProxy::moveFocus(int newIndex)
352 {
353     if (!isValid())
354         return;
355
356     process()->send(Messages::WebPage::MoveFocus(newIndex), m_pageID);
357 }
358
359 void WebPageProxy::updateFormNavigation(int length, int offset)
360 {
361     static_cast<PageClientImpl*>(m_pageClient)->updateFormNavigation(length, offset);
362 }
363
364 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
365 Eina_Bool WebPageProxy::pageContentResumeTimerFired(void* data)
366 {
367     static_cast<WebPageProxy*>(data)->resumeActiveDOMObjectsAndAnimations();
368     static_cast<WebPageProxy*>(data)->m_pageContentResumeTimer = 0;
369     return ECORE_CALLBACK_CANCEL;
370 }
371 #endif
372
373 #if ENABLE(TIZEN_TEXT_CARET_HANDLING_WK2)
374 void WebPageProxy::setCaretPosition(const WebCore::IntPoint& pos)
375 {
376     if (!isValid())
377         return;
378
379     process()->send(Messages::WebPage::SetCaretPosition(pos), m_pageID);
380 }
381 #endif
382
383 #if ENABLE(TIZEN_PLUGIN_CUSTOM_REQUEST)
384 void WebPageProxy::processPluginCustomRequest(const String& request, const String& msg)
385 {
386     if (String("requestKeyboard,plugin") == request) {
387         bool active = false;
388         if (String("show") == msg)
389             active = true;
390 #if ENABLE(TIZEN_ISF_PORT)
391         m_editorState = EditorState();
392         m_editorState.isContentEditable = active;
393         m_pageClient->updateTextInputState();
394 #endif
395     }
396 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
397     else if (String("requestToNative,json") == request)
398         m_tizenClient.processJSBridgePlugin(this, request, msg);
399 #endif
400 }
401 #endif
402
403
404 #if ENABLE(TIZEN_INPUT_TAG_EXTENSION) || ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
405 void WebPageProxy::setCurrentTargetInputElementValue(const String& inputValue)
406 {
407     if (!isValid())
408         return;
409
410     process()->send(Messages::WebPage::SetCurrentTargetInputElementValue(inputValue), m_pageID);
411 }
412
413 void WebPageProxy::setFocusedInputElementValue(const String& inputValue)
414 {
415     if (!isValid())
416         return;
417
418     process()->send(Messages::WebPage::SetFocusedInputElementValue(inputValue), m_pageID);
419 }
420
421 String WebPageProxy::getFocusedInputElementValue()
422 {
423     if (!isValid())
424         return String();
425
426     String inputValue;
427     process()->sendSync(Messages::WebPage::GetFocusedInputElementValue(), Messages::WebPage::GetFocusedInputElementValue::Reply(inputValue), m_pageID);
428     return inputValue;
429 }
430 #endif
431
432 #if ENABLE(TIZEN_DATALIST_ELEMENT)
433 Vector<String> WebPageProxy::getFocusedInputElementDataList()
434 {
435     if (!isValid())
436         return Vector<String>();
437
438     Vector<String> optionList;
439     process()->sendSync(Messages::WebPage::GetFocusedInputElementDataList(), Messages::WebPage::GetFocusedInputElementDataList::Reply(optionList), m_pageID);
440     return optionList;
441 }
442 #endif
443
444 void WebPageProxy::focusedNodeChanged(const IntRect& focusedNodeRect)
445 {
446     static_cast<PageClientImpl*>(m_pageClient)->setFocusedNodeRect(focusedNodeRect);
447 }
448
449 void WebPageProxy::initializeTizenClient(const WKPageTizenClient* client)
450 {
451     m_tizenClient.initialize(client);
452 }
453
454 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
455 #if ENABLE(TOUCH_ADJUSTMENT)
456 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, const IntSize& area)
457 #else
458 WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode)
459 #endif
460 {
461     WebHitTestResult::Data hitTestResultData;
462     if (!isValid())
463         return hitTestResultData;
464
465 #if ENABLE(TOUCH_ADJUSTMENT)
466     process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode, area),
467                         Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
468 #else
469     process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode),
470                         Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID);
471 #endif
472
473     return hitTestResultData;
474 }
475 #endif
476
477 #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
478 void WebPageProxy::hideContextMenu()
479 {
480     if (m_activeContextMenu)
481         m_activeContextMenu->hideContextMenu();
482 }
483
484 String WebPageProxy::contextMenuAbsoluteLinkURLString()
485 {
486     if (!m_activeContextMenu)
487         return String();
488
489     return m_activeContextMenuHitTestResultData.absoluteLinkURL;
490 }
491
492 String WebPageProxy::contextMenuAbsoluteImageURLString()
493 {
494     if (!m_activeContextMenu)
495         return String();
496
497     return m_activeContextMenuHitTestResultData.absoluteImageURL;
498 }
499 #endif
500
501 #if ENABLE(TIZEN_WEBKIT2_CLIPBOARD_HELPER)
502 void WebPageProxy::pasteContextMenuSelected()
503 {
504     static_cast<PageClientImpl*>(m_pageClient)->pasteContextMenuSelected();
505 }
506
507 void WebPageProxy::didSelectPasteMenuFromContextMenu(const String& data, const String& type)
508 {
509     if (!isValid())
510         return;
511
512 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
513     process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
514 #endif
515     WebContextMenuItemData item(ActionType, ContextMenuItemTagPaste, String("Paste"), true, false);
516     process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
517 }
518 #endif
519
520 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
521 void WebPageProxy::setClipboardData(const String& data, const String& type)
522 {
523     static_cast<PageClientImpl*>(m_pageClient)->setClipboardData(data, type);
524 }
525
526 void WebPageProxy::clearClipboardData()
527 {
528     static_cast<PageClientImpl*>(m_pageClient)->clearClipboardData();
529 }
530 #endif
531
532 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
533 void WebPageProxy::executePasteFromClipboardItem(const String& data, const String& type)
534 {
535     if (!isValid())
536         return;
537
538 #if ENABLE(TIZEN_CLIPBOARD) || ENABLE(TIZEN_PASTEBOARD)
539     process()->send(Messages::WebPage::SetClipboardDataForPaste(data, type), m_pageID);
540 #endif
541     process()->send(Messages::WebPage::ExecuteEditCommandWithArgument("Paste", data), m_pageID);
542 }
543
544 void WebPageProxy::clipboardContextMenuSelected()
545 {
546     static_cast<PageClientImpl*>(m_pageClient)->clipboardContextMenuSelected();
547 }
548 #endif
549
550 #if ENABLE(TIZEN_REMOTE_WEB_INSPECTOR)
551 uint32_t WebPageProxy::startInspectorServer(uint32_t port)
552 {
553     if (!isValid())
554         return 0;
555
556     uint32_t assignedPort = 0;
557     process()->sendSync(Messages::WebPage::StartInspectorServer(port), Messages::WebPage::StartInspectorServer::Reply(assignedPort), m_pageID);
558     return assignedPort;
559 }
560
561 bool WebPageProxy::stopInspectorServer()
562 {
563     if (!isValid())
564         return false;
565
566     bool result = false;
567     process()->sendSync(Messages::WebPage::StopInspectorServer(), Messages::WebPage::StopInspectorServer::Reply(result), m_pageID);
568     return result;
569 }
570 #endif
571
572 #if ENABLE(TIZEN_MOBILE_WEB_PRINT)
573 void WebPageProxy::createPagesToPDF(const IntSize& surfaceSize, const IntSize& contentsSize, const String& fileName)
574 {
575     process()->send(Messages::WebPage::CreatePagesToPDF(surfaceSize, contentsSize, fileName), m_pageID);
576 }
577 #endif
578
579 #if ENABLE(TIZEN_WEB_STORAGE)
580 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
581 void WebPageProxy::getWebStorageQuotaBytes(PassRefPtr<WebStorageQuotaCallback> prpCallback)
582 {
583     RefPtr<WebStorageQuotaCallback> callback = prpCallback;
584     if (!isValid()) {
585         callback->invalidate();
586         return;
587     }
588
589     uint64_t callbackID = callback->callbackID();
590     m_quotaCallbacks.set(callbackID, callback.get());
591     process()->send(Messages::WebPage::GetStorageQuotaBytes(callbackID), m_pageID);
592 }
593
594 void WebPageProxy::didGetWebStorageQuotaBytes(const uint32_t quota, uint64_t callbackID)
595 {
596     RefPtr<WebStorageQuotaCallback> callback = m_quotaCallbacks.take(callbackID);
597     if (!callback) {
598         // FIXME: Log error or assert.
599         // this can validly happen if a load invalidated the callback, though
600         return;
601     }
602
603     m_quotaCallbacks.remove(callbackID);
604
605     RefPtr<WebUInt32> uint32Object = WebUInt32::create(quota);
606     callback->performCallbackWithReturnValue(uint32Object.release().leakRef());
607 }
608 #endif
609
610 void WebPageProxy::setWebStorageQuotaBytes(uint32_t quota)
611 {
612     if (!isValid())
613         return;
614
615     process()->send(Messages::WebPage::SetStorageQuotaBytes(quota), m_pageID, 0);
616 }
617 #endif
618
619 void WebPageProxy::scale(double scaleFactor, const IntPoint& origin)
620 {
621 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
622     static_cast<PageClientImpl*>(m_pageClient)->scaleContents(scaleFactor, origin);
623 #else
624     scalePage(scaleFactor, origin);
625 #endif
626 }
627
628 void WebPageProxy::scaleImage(double scaleFactor, const IntPoint& origin)
629 {
630 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
631     static_cast<PageClientImpl*>(m_pageClient)->scaleImage(scaleFactor, origin);
632 #else
633     scalePage(scaleFactor, origin);
634 #endif
635 }
636
637 double WebPageProxy::scaleFactor()
638 {
639 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
640     return static_cast<PageClientImpl*>(m_pageClient)->scaleFactor();
641 #else
642     return pageScaleFactor();
643 #endif
644 }
645
646 #if ENABLE(TIZEN_ORIENTATION_EVENTS)
647 void WebPageProxy::sendOrientationChangeEvent(int orientation)
648 {
649     process()->send(Messages::WebPage::SendOrientationChangeEvent(orientation), m_pageID, 0);
650 }
651 #endif
652
653 void WebPageProxy::suspendPainting()
654 {
655     if (!isValid())
656         return;
657
658     process()->send(Messages::DrawingArea::SuspendPainting(), m_pageID);
659 }
660
661 void WebPageProxy::resumePainting()
662 {
663     if (!isValid())
664         return;
665
666     process()->send(Messages::DrawingArea::ResumePainting(), m_pageID);
667 }
668
669 void WebPageProxy::suspendJavaScriptAndResource()
670 {
671     if (!isValid())
672         return;
673
674     process()->send(Messages::WebPage::SuspendJavaScriptAndResources(), m_pageID);
675 }
676
677 void WebPageProxy::resumeJavaScriptAndResource()
678 {
679     if (!isValid())
680         return;
681
682     process()->send(Messages::WebPage::ResumeJavaScriptAndResources(), m_pageID);
683 }
684
685 void WebPageProxy::suspendAnimations()
686 {
687     if (!isValid())
688         return;
689
690     process()->send(Messages::WebPage::SuspendAnimations(), m_pageID);
691 }
692
693 void WebPageProxy::resumeAnimations()
694 {
695     if (!isValid())
696         return;
697
698     process()->send(Messages::WebPage::ResumeAnimations(), m_pageID);
699 }
700
701 #if ENABLE(TIZEN_PLUGIN_SUSPEND_RESUME)
702 void WebPageProxy::suspendPlugin()
703 {
704     if (!isValid())
705         return;
706
707     process()->send(Messages::WebPage::SuspendPlugin(), m_pageID);
708 }
709
710 void WebPageProxy::resumePlugin()
711 {
712     if (!isValid())
713         return;
714
715     process()->send(Messages::WebPage::ResumePlugin(), m_pageID);
716 }
717 #endif
718
719 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
720 void WebPageProxy::purgeBackingStoresOfInactiveView()
721 {
722     if (!isValid() || isViewVisible())
723         return;
724
725     process()->send(Messages::LayerTreeCoordinator::PurgeBackingStores(), m_pageID);
726 }
727 #endif
728
729 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
730 bool WebPageProxy::scrollOverflow(const FloatPoint& offset)
731 {
732     if (!isValid())
733         return false;
734
735 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE)
736     if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableLayerFocused())
737         return drawingArea()->layerTreeCoordinatorProxy()->setOffsetForFocusedScrollingContentsLayer(offset);
738 #endif
739     if (static_cast<PageClientImpl*>(m_pageClient)->isScrollableNodeFocused()) {
740         bool scrolled = false;
741         process()->sendSync(Messages::WebPage::ScrollOverflow(offset), Messages::WebPage::ScrollOverflow::Reply(scrolled), m_pageID);
742         return scrolled;
743     }
744
745     return false;
746 }
747
748 bool WebPageProxy::setPressedNodeAtPoint(const IntPoint& point, bool checkOverflowLayer, WebLayerID& webLayerID)
749 {
750     if (!isValid())
751         return false;
752
753     bool pressed = false;
754     process()->sendSync(Messages::WebPage::SetPressedNodeAtPoint(point, checkOverflowLayer), Messages::WebPage::SetPressedNodeAtPoint::Reply(pressed, webLayerID), m_pageID);
755
756     return pressed;
757 }
758
759 void WebPageProxy::setOverflowResult(bool pressed, uint32_t webLayerID)
760 {
761     static_cast<PageClientImpl*>(m_pageClient)->setOverflowResult(pressed, webLayerID);
762 }
763 #endif
764
765 void WebPageProxy::executeEditCommandWithArgument(const String& commandName, const String& argument)
766 {
767     if (!isValid())
768         return;
769
770     DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, ("ignoreSpelling"));
771     if (commandName == ignoreSpellingCommandName)
772         ++m_pendingLearnOrIgnoreWordMessageCount;
773
774     process()->send(Messages::WebPage::ExecuteEditCommandWithArgument(commandName, argument), m_pageID);
775 }
776
777 void WebPageProxy::replyJavaScriptAlert()
778 {
779     if (!m_alertReply)
780         return;
781
782     m_alertReply->send();
783     m_alertReply = nullptr;
784 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
785     m_uiClient.notifyPopupReplyWaitingState(this, false);
786 #endif
787 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
788     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
789 #endif
790 }
791
792 void WebPageProxy::replyJavaScriptConfirm(bool result)
793 {
794     if (!m_confirmReply)
795         return;
796
797     m_confirmReply->send(result);
798     m_confirmReply = nullptr;
799 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
800     m_uiClient.notifyPopupReplyWaitingState(this, false);
801 #endif
802 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
803     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
804 #endif
805 }
806
807 void WebPageProxy::replyJavaScriptPrompt(const String& result)
808 {
809     if (!m_promptReply)
810         return;
811
812     m_promptReply->send(result);
813     m_promptReply = nullptr;
814 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
815     m_uiClient.notifyPopupReplyWaitingState(this, false);
816 #endif
817 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
818     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
819 #endif
820 }
821
822 #if ENABLE(TIZEN_SUPPORT_BEFORE_UNLOAD_CONFIRM_PANEL)
823 void WebPageProxy::replyBeforeUnloadConfirmPanel(bool result)
824 {
825     if (!m_beforeUnloadConfirmPanelReply)
826         return;
827
828     m_beforeUnloadConfirmPanelReply->send(result);
829     m_beforeUnloadConfirmPanelReply = nullptr;
830 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
831     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
832 #endif
833 }
834 #endif
835
836 #if ENABLE(TIZEN_ON_AUTHENTICATION_REQUESTED)
837 void WebPageProxy::replyReceiveAuthenticationChallengeInFrame(bool result)
838 {
839     if (!m_AuthReply)
840         return;
841
842     m_AuthReply->send(result);
843     m_AuthReply = nullptr;
844 }
845 #endif
846
847 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
848 void WebPageProxy::replyPolicyForCertificateError(bool result)
849 {
850     if (!m_allowedReply)
851         return;
852
853     m_allowedReply->send(result);
854     m_allowedReply = nullptr;
855 }
856 #endif
857
858 #if PLUGIN_ARCHITECTURE(X11)
859 void WebPageProxy::createPluginContainer(uint64_t& windowID)
860 {
861     notImplemented();
862 }
863
864 void WebPageProxy::windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID)
865 {
866     notImplemented();
867 }
868 #endif
869
870 void WebPageProxy::didRenderFrame()
871 {
872     static_cast<PageClientImpl*>(m_pageClient)->didRenderFrame();
873 }
874
875 void WebPageProxy::setBackgroundColor(double red, double green, double blue, double alpha)
876 {
877     static_cast<PageClientImpl*>(m_pageClient)->setBackgroundColor(red, green, blue, alpha);
878 }
879
880 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
881 bool WebPageProxy::makeContextCurrent()
882 {
883     return static_cast<PageClientImpl*>(m_pageClient)->makeContextCurrent();
884 }
885 #endif
886
887 #if ENABLE(TIZEN_ICON_DATABASE)
888 void WebPageProxy::didReceiveIcon()
889 {
890     static_cast<PageClientImpl*>(m_pageClient)->didReceiveIcon();
891 }
892 #endif
893
894 #if ENABLE(TIZEN_MULTIPLE_SELECT)
895 void WebPageProxy::valueChangedForPopupMenuMultiple(WebPopupMenuProxy*, Vector<int32_t> newSelectedIndex)
896 {
897     process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenuMultiple(newSelectedIndex), m_pageID);
898 }
899 #endif
900
901 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
902 void WebPageProxy::pageDidRequestRestoreVisibleContentRect(const IntPoint& point, float scale)
903 {
904     m_pageClient->pageDidRequestRestoreVisibleContentRect(point, scale);
905 }
906 #endif
907
908 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
909 void WebPageProxy::saveSerializedHTMLDataForMainPage(const String& serializedData, const String& fileName)
910 {
911     static_cast<PageClientImpl*>(m_pageClient)->saveSerializedHTMLDataForMainPage(serializedData, fileName);
912 }
913
914 void WebPageProxy::saveSubresourcesData(Vector<WebSubresourceTizen> subresourceData)
915 {
916     static_cast<PageClientImpl*>(m_pageClient)->saveSubresourcesData(subresourceData);
917 }
918
919 void WebPageProxy::startOfflinePageSave(String subresourceFolderName)
920 {
921     if (!isValid())
922         return;
923
924     process()->send(Messages::WebPage::StartOfflinePageSave(subresourceFolderName), m_pageID);
925 }
926 #endif
927
928 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
929 bool WebPageProxy::selectClosestWord(const IntPoint& point, bool isAutoWordSelection)
930 {
931     if (!isValid())
932         return false;
933
934     bool result = false;
935     process()->sendSync(Messages::WebPage::SelectClosestWord(point, isAutoWordSelection), Messages::WebPage::SelectClosestWord::Reply(result), m_pageID);
936     return result;
937 }
938
939 int WebPageProxy::setLeftSelection(const IntPoint& point, const int direction)
940 {
941     if (!isValid())
942         return 0;
943
944     int result = 0;
945     process()->sendSync(Messages::WebPage::SetLeftSelection(point, direction), Messages::WebPage::SetLeftSelection::Reply(result), m_pageID);
946     return result;
947 }
948
949 int WebPageProxy::setRightSelection(const IntPoint& point, const int direction)
950 {
951     if (!isValid())
952         return 0;
953
954     int result = 0;
955     process()->sendSync(Messages::WebPage::SetRightSelection(point, direction), Messages::WebPage::SetRightSelection::Reply(result), m_pageID);
956     return result;
957 }
958
959 bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect, int& selectionDirection)
960 {
961     if (!isValid())
962         return false;
963
964     bool result = false;
965     IntRect updateEditorRect(0, 0, 0, 0);
966     process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect, selectionDirection, updateEditorRect), m_pageID);
967     if (!leftRect.size().isZero() || !rightRect.size().isZero())
968         result = true;
969     if(m_editorState.editorRect != updateEditorRect) {
970         m_editorState.editorRect = updateEditorRect;
971         m_editorState.updateEditorRectOnly = true;
972     }
973     return result;
974 }
975
976 bool WebPageProxy::getFocusedSubFrameRect(IntRect& focusedFrameViewRect) {
977     if (!isValid())
978         return false;
979
980     bool isSubFrameFocused = false;
981
982     process()->sendSync(Messages::WebPage::GetFocusedSubFrameRect(), Messages::WebPage::GetFocusedSubFrameRect::Reply(focusedFrameViewRect, isSubFrameFocused), m_pageID);
983     return isSubFrameFocused;
984 }
985
986 String WebPageProxy::getSelectionText()
987 {
988     String ret;
989     if (!isValid())
990         return ret;
991
992     process()->sendSync(Messages::WebPage::GetSelectionText(), Messages::WebPage::GetSelectionText::Reply(ret), m_pageID);
993     return ret;
994 }
995
996 bool WebPageProxy::selectionRangeClear()
997 {
998     if (!isValid())
999         return false;
1000
1001     bool result = false;
1002     process()->sendSync(Messages::WebPage::SelectionRangeClear(), Messages::WebPage::SelectionRangeClear::Reply(result), m_pageID);
1003     return result;
1004 }
1005
1006 bool WebPageProxy::scrollContentByCharacter(const IntPoint& point, SelectionDirection direction)
1007 {
1008     if (!isValid())
1009         return false;
1010
1011     bool result = false;
1012     process()->sendSync(Messages::WebPage::ScrollContentByCharacter(point, direction), Messages::WebPage::ScrollContentByCharacter::Reply(result), m_pageID);
1013     return result;
1014 }
1015
1016 bool WebPageProxy::scrollContentByLine(const IntPoint& point, SelectionDirection direction)
1017 {
1018     if (!isValid())
1019         return false;
1020
1021     bool result = false;
1022     process()->sendSync(Messages::WebPage::ScrollContentByLine(point, direction), Messages::WebPage::ScrollContentByLine::Reply(result), m_pageID);
1023     return result;
1024 }
1025 #endif
1026
1027 #if ENABLE(TIZEN_LINK_MAGNIFIER)
1028 void WebPageProxy::getLinkMagnifierRect(const WebCore::IntPoint& position, const WebCore::IntSize& size)
1029 {
1030     process()->send(Messages::WebPage::GetLinkMagnifierRect(position, size), m_pageID);
1031 }
1032
1033 void WebPageProxy::didGetLinkMagnifierRect(const IntPoint& position, const IntRect& rect)
1034 {
1035     if (!rect.isEmpty())
1036         LinkMagnifierProxy::linkMagnifier().show(EwkViewImpl::fromEvasObject(viewWidget()), position, rect);
1037     else
1038         openLink(position);
1039 }
1040
1041 void WebPageProxy::openLink(const IntPoint& position)
1042 {
1043 #if ENABLE(GESTURE_EVENTS)
1044     IntPoint globalPosition(static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->transformToScreen().mapPoint(position));
1045     WebGestureEvent gesture(WebEvent::GestureSingleTap, position, globalPosition, WebEvent::Modifiers(0), ecore_time_get());
1046     handleGestureEvent(gesture);
1047 #endif
1048 }
1049 #endif
1050
1051 #if ENABLE(TIZEN_SCREEN_READER)
1052 bool WebPageProxy::moveScreenReaderFocus(bool forward)
1053 {
1054     bool result;
1055     process()->sendSync(Messages::WebPage::MoveScreenReaderFocus(forward), Messages::WebPage::MoveScreenReaderFocus::Reply(result), m_pageID);
1056     return result;
1057 }
1058
1059 void WebPageProxy::moveScreenReaderFocusByPoint(const IntPoint& point)
1060 {
1061     process()->send(Messages::WebPage::MoveScreenReaderFocusByPoint(point), m_pageID);
1062 }
1063
1064 void WebPageProxy::clearScreenReaderFocus()
1065 {
1066     process()->send(Messages::WebPage::ClearScreenReaderFocus(), m_pageID);
1067 }
1068
1069 bool WebPageProxy::raiseTapEvent(const IntPoint& position)
1070 {
1071     IntPoint globalPosition = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->transformToScreen().mapPoint(position);
1072     bool result;
1073     process()->sendSync(Messages::WebPage::RaiseTapEvent(position, globalPosition), Messages::WebPage::RaiseTapEvent::Reply(result), m_pageID);
1074
1075     return result;
1076 }
1077
1078 void WebPageProxy::adjustScreenReaderFocusedObjectValue(bool up)
1079 {
1080     process()->send(Messages::WebPage::AdjustScreenReaderFocusedObjectValue(up), m_pageID);
1081 }
1082
1083 void WebPageProxy::clearScreenReader()
1084 {
1085     process()->send(Messages::WebPage::ClearScreenReader(), m_pageID);
1086 }
1087
1088 void WebPageProxy::didScreenReaderTextChanged(const String& text)
1089 {
1090     ScreenReaderProxy::screenReader().setText(text);
1091 }
1092 #endif
1093
1094 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
1095 void WebPageProxy::didChangeFocusedRects(const Vector<IntRect>& rects)
1096 {
1097     EwkViewImpl* viewImpl = static_cast<PageClientImpl*>(m_pageClient)->viewImpl();
1098     FocusRing* focusRing = viewImpl->focusRing();
1099     if (!focusRing)
1100         return;
1101
1102     if (!rects.isEmpty()) {
1103         bool canUpdate = focusRing->canUpdate();
1104 #if ENABLE(TIZEN_SCREEN_READER)
1105         canUpdate |= ScreenReaderProxy::screenReader().isActive(viewImpl);
1106 #endif
1107 #if ENABLE(TIZEN_FOCUS_UI)
1108         canUpdate |= m_focusUIEnabled;
1109 #endif
1110
1111         if (canUpdate)
1112             focusRing->show(rects);
1113     } else
1114         focusRing->hide(false);
1115 }
1116
1117 void WebPageProxy::recalcFocusedRects()
1118 {
1119     process()->send(Messages::WebPage::RecalcFocusedRects(), m_pageID);
1120 }
1121 #endif
1122
1123 #if ENABLE(TIZEN_CSP)
1124 void WebPageProxy::setContentSecurityPolicy(const String& policy, WebCore::ContentSecurityPolicy::HeaderType type)
1125 {
1126     process()->send(Messages::WebPage::SetContentSecurityPolicy(policy, type), m_pageID);
1127 }
1128 #endif
1129
1130 #if ENABLE(TIZEN_APPLICATION_CACHE)
1131 void WebPageProxy::requestApplicationCachePermission(uint64_t frameID, const String& originIdentifier, PassRefPtr<Messages::WebPageProxy::RequestApplicationCachePermission::DelayedReply> allow)
1132 {
1133     WebFrameProxy* frame = process()->webFrame(frameID);
1134     MESSAGE_CHECK(frame);
1135
1136     // Since requestApplicationCachePermission() can spin a nested run loop we need to turn off the responsiveness timer.
1137     process()->responsivenessTimer()->stop();
1138
1139     m_applicationCacheReply = allow;
1140 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1141     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1142 #endif
1143     RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1144
1145     if (!m_tizenClient.decidePolicyForApplicationCachePermissionRequest(this, origin.get(), frame))
1146         replyApplicationCachePermission(true);
1147 }
1148
1149 void WebPageProxy::replyApplicationCachePermission(bool allow)
1150 {
1151     if (!m_applicationCacheReply)
1152         return;
1153
1154     m_applicationCacheReply->send(allow);
1155     m_applicationCacheReply = nullptr;
1156 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1157     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1158 #endif
1159 }
1160 #endif
1161
1162 #if ENABLE(TIZEN_INDEXED_DATABASE)
1163 void WebPageProxy::exceededIndexedDatabaseQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededIndexedDatabaseQuota::DelayedReply> reply)
1164 {
1165     WebFrameProxy* frame = process()->webFrame(frameID);
1166     MESSAGE_CHECK(frame);
1167
1168     // Since exceededIndexedDatabaseQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1169     process()->responsivenessTimer()->stop();
1170
1171     m_exceededIndexedDatabaseQuotaReply = reply;
1172 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1173     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1174 #endif
1175
1176     RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1177
1178     if (!m_tizenClient.exceededIndexedDatabaseQuota(this, origin.get(), currentUsage, frame))
1179         replyExceededIndexedDatabaseQuota(false);
1180 }
1181
1182 void WebPageProxy::replyExceededIndexedDatabaseQuota(bool allow)
1183 {
1184     if (!m_exceededIndexedDatabaseQuotaReply)
1185         return;
1186
1187     m_exceededIndexedDatabaseQuotaReply->send(allow);
1188     m_exceededIndexedDatabaseQuotaReply = nullptr;
1189 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1190     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1191 #endif
1192 }
1193 #endif
1194
1195 #if ENABLE(TIZEN_SQL_DATABASE)
1196 void WebPageProxy::replyExceededDatabaseQuota(bool allow)
1197 {
1198     if (!m_exceededDatabaseQuotaReply) {
1199         TIZEN_LOGE("m_exceededDatabaseQuotaReply does not exist");
1200         return;
1201     }
1202
1203     m_exceededDatabaseQuotaReply->send(allow);
1204     m_exceededDatabaseQuotaReply = nullptr;
1205 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1206     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1207 #endif
1208 }
1209 #endif
1210
1211 #if ENABLE(TIZEN_FILE_SYSTEM)
1212 void WebPageProxy::exceededLocalFileSystemQuota(uint64_t frameID, const String& originIdentifier, int64_t currentUsage, PassRefPtr<Messages::WebPageProxy::ExceededLocalFileSystemQuota::DelayedReply> reply)
1213 {
1214     WebFrameProxy* frame = process()->webFrame(frameID);
1215     MESSAGE_CHECK(frame);
1216
1217     // Since exceededLocalFileSystemQuota() can spin a nested run loop we need to turn off the responsiveness timer.
1218     process()->responsivenessTimer()->stop();
1219     m_exceededLocalFileSystemQuotaReply = reply;
1220 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1221     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
1222 #endif
1223
1224     RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
1225
1226     if (!m_tizenClient.exceededLocalFileSystemQuota(this, origin.get(), currentUsage, frame))
1227         replyExceededLocalFileSystemQuota(false);
1228 }
1229
1230 void WebPageProxy::replyExceededLocalFileSystemQuota(bool allow)
1231 {
1232     if (!m_exceededLocalFileSystemQuotaReply)
1233         return;
1234
1235     m_exceededLocalFileSystemQuotaReply->send(allow);
1236     m_exceededLocalFileSystemQuotaReply = nullptr;
1237 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1238     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(false);
1239 #endif
1240 }
1241 #endif
1242
1243 #endif // #if OS(TIZEN)
1244
1245 void WebPageProxy::handleInputMethodKeydown(bool& handled)
1246 {
1247 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
1248     handled = m_keyEventQueue.first().forwardedEvent.isFiltered();
1249 #else
1250     handled = m_keyEventQueue.first().isFiltered();
1251 #endif
1252 }
1253
1254 void WebPageProxy::confirmComposition(const String& compositionString)
1255 {
1256     if (!isValid())
1257         return;
1258
1259 #if ENABLE(TIZEN_ISF_PORT)
1260     if (m_didCancelCompositionFromWebProcess)
1261         return;
1262 #endif
1263
1264     process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID, 0);
1265 }
1266
1267 void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition)
1268 {
1269     if (!isValid())
1270         return;
1271
1272 #if ENABLE(TIZEN_REDUCE_KEY_LAGGING)
1273     // Suspend layout&paint at the key input, and resume layout&paint after 150 ms.
1274     suspendActiveDOMObjectsAndAnimations();
1275     if (m_pageContentResumeTimer)
1276         ecore_timer_del(m_pageContentResumeTimer);
1277     m_pageContentResumeTimer = ecore_timer_add(150.0/1000.0, pageContentResumeTimerFired, this);
1278 #endif
1279
1280     process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID, 0);
1281 }
1282
1283 void WebPageProxy::cancelComposition()
1284 {
1285     if (!isValid())
1286         return;
1287
1288     process()->send(Messages::WebPage::CancelComposition(), m_pageID, 0);
1289 }
1290
1291 #if ENABLE(TIZEN_USE_SETTINGS_FONT)
1292 void WebPageProxy::useSettingsFont()
1293 {
1294     process()->send(Messages::WebPage::UseSettingsFont(), m_pageID, 0);
1295 }
1296 #endif
1297
1298 #if ENABLE(TIZEN_WEBKIT2_NOTIFY_SUSPEND_BY_REMOTE_WEB_INSPECTOR)
1299 void WebPageProxy::setContentSuspendedByInspector(bool isSuspended)
1300 {
1301     m_contentSuspendedByInspector = isSuspended;
1302 }
1303 #endif
1304
1305 #if ENABLE(TIZEN_FOCUS_UI)
1306 void WebPageProxy::setFocusUIEnabled(bool enabled)
1307 {
1308     if (m_focusUIEnabled == enabled)
1309         return;
1310
1311     m_focusUIEnabled = enabled;
1312
1313     if (enabled)
1314         static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->focusRing()->setImage(FOCUS_UI_FOCUS_RING_IMAGE_PATH, 4, 2);
1315     else
1316         static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->focusRing()->setImage(String(), 0, 0);
1317
1318     process()->send(Messages::WebPage::SetFocusUIEnabled(enabled), m_pageID);
1319 }
1320 #endif
1321 } // namespace WebKit