d8c412e0f620ba95f0406370c42328546bc88b38
[WebKit-https.git] / WebKit2 / UIProcess / WebPageProxy.cpp
1 /*
2  * Copyright (C) 2010 Apple Inc. All rights reserved.
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 "WebPageProxy.h"
27
28 #include "AuthenticationChallengeProxy.h"
29 #include "AuthenticationDecisionListener.h"
30 #include "DataReference.h"
31 #include "DrawingAreaProxy.h"
32 #include "FindIndicator.h"
33 #include "MessageID.h"
34 #include "NativeWebKeyboardEvent.h"
35 #include "PageClient.h"
36 #include "StringPairVector.h"
37 #include "WKContextPrivate.h"
38 #include "WebBackForwardList.h"
39 #include "WebBackForwardListItem.h"
40 #include "WebCertificateInfo.h"
41 #include "WebContext.h"
42 #include "WebContextMenuProxy.h"
43 #include "WebContextUserMessageCoders.h"
44 #include "WebCoreArgumentCoders.h"
45 #include "WebData.h"
46 #include "WebEditCommandProxy.h"
47 #include "WebEvent.h"
48 #include "WebFormSubmissionListenerProxy.h"
49 #include "WebFramePolicyListenerProxy.h"
50 #include "WebOpenPanelResultListenerProxy.h"
51 #include "WebPageCreationParameters.h"
52 #include "WebPageGroup.h"
53 #include "WebPageGroupData.h"
54 #include "WebPageMessages.h"
55 #include "WebPopupItem.h"
56 #include "WebPopupMenuProxy.h"
57 #include "WebPreferences.h"
58 #include "WebProcessManager.h"
59 #include "WebProcessMessages.h"
60 #include "WebProcessProxy.h"
61 #include "WebProtectionSpace.h"
62 #include "WebSecurityOrigin.h"
63 #include "WebURLRequest.h"
64 #include <WebCore/FloatRect.h>
65 #include <WebCore/MIMETypeRegistry.h>
66 #include <WebCore/WindowFeatures.h>
67 #include <stdio.h>
68
69 #ifndef NDEBUG
70 #include <wtf/RefCountedLeakCounter.h>
71 #endif
72
73 // This controls what strategy we use for mouse wheel coalesing.
74 #define MERGE_WHEEL_EVENTS 0
75
76 using namespace WebCore;
77
78 namespace WebKit {
79
80 #ifndef NDEBUG
81 static WTF::RefCountedLeakCounter webPageProxyCounter("WebPageProxy");
82 #endif
83
84 PassRefPtr<WebPageProxy> WebPageProxy::create(WebContext* context, WebPageGroup* pageGroup, uint64_t pageID)
85 {
86     return adoptRef(new WebPageProxy(context, pageGroup, pageID));
87 }
88
89 WebPageProxy::WebPageProxy(WebContext* context, WebPageGroup* pageGroup, uint64_t pageID)
90     : m_pageClient(0)
91     , m_context(context)
92     , m_pageGroup(pageGroup)
93     , m_mainFrame(0)
94     , m_userAgent(standardUserAgent())
95     , m_estimatedProgress(0.0)
96     , m_isInWindow(false)
97     , m_backForwardList(WebBackForwardList::create(this))
98     , m_textZoomFactor(1)
99     , m_pageZoomFactor(1)
100     , m_viewScaleFactor(1)
101     , m_drawsBackground(true)
102     , m_drawsTransparentBackground(false)
103     , m_isValid(true)
104     , m_isClosed(false)
105     , m_inDecidePolicyForMIMEType(false)
106     , m_syncMimeTypePolicyActionIsValid(false)
107     , m_syncMimeTypePolicyAction(PolicyUse)
108     , m_syncMimeTypePolicyDownloadID(0)
109     , m_processingWheelEvent(false)
110     , m_pageID(pageID)
111     , m_mainFrameHasCustomRepresentation(false)
112 {
113 #ifndef NDEBUG
114     webPageProxyCounter.increment();
115 #endif
116
117     WebContext::statistics().wkPageCount++;
118
119     m_pageGroup->addPage(this);
120 }
121
122 WebPageProxy::~WebPageProxy()
123 {
124     WebContext::statistics().wkPageCount--;
125
126     m_pageGroup->removePage(this);
127
128 #ifndef NDEBUG
129     webPageProxyCounter.decrement();
130 #endif
131 }
132
133 WebProcessProxy* WebPageProxy::process() const
134 {
135     return m_context->process();
136 }
137
138 bool WebPageProxy::isValid()
139 {
140     // A page that has been explicitly closed is never valid.
141     if (m_isClosed)
142         return false;
143
144     return m_isValid;
145 }
146
147 void WebPageProxy::setPageClient(PageClient* pageClient)
148 {
149     m_pageClient = pageClient;
150 }
151
152 void WebPageProxy::setDrawingArea(PassOwnPtr<DrawingAreaProxy> drawingArea)
153 {
154     if (drawingArea == m_drawingArea)
155         return;
156
157     m_drawingArea = drawingArea;
158 }
159
160 void WebPageProxy::initializeLoaderClient(const WKPageLoaderClient* loadClient)
161 {
162     m_loaderClient.initialize(loadClient);
163 }
164
165 void WebPageProxy::initializePolicyClient(const WKPagePolicyClient* policyClient)
166 {
167     m_policyClient.initialize(policyClient);
168 }
169
170 void WebPageProxy::initializeFormClient(const WKPageFormClient* formClient)
171 {
172     m_formClient.initialize(formClient);
173 }
174
175 void WebPageProxy::initializeResourceLoadClient(const WKPageResourceLoadClient* client)
176 {
177     m_resourceLoadClient.initialize(client);
178 }
179
180 void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
181 {
182     m_uiClient.initialize(client);
183 }
184
185 void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
186 {
187     m_findClient.initialize(client);
188 }
189
190 void WebPageProxy::initializeContextMenuClient(const WKPageContextMenuClient* client)
191 {
192     m_contextMenuClient.initialize(client);
193 }
194
195 void WebPageProxy::relaunch()
196 {
197     m_isValid = true;
198     context()->relaunchProcessIfNecessary();
199     process()->addExistingWebPage(this, m_pageID);
200
201     m_pageClient->didRelaunchProcess();
202 }
203
204 void WebPageProxy::initializeWebPage(const IntSize& size)
205 {
206     if (!isValid()) {
207         relaunch();
208         return;
209     }
210
211     ASSERT(m_drawingArea);
212     process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters(size)), 0);
213 }
214
215 void WebPageProxy::reinitializeWebPage(const WebCore::IntSize& size)
216 {
217     if (!isValid())
218         return;
219
220     ASSERT(m_drawingArea);
221     process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters(size)), 0);
222 }
223
224 void WebPageProxy::close()
225 {
226     if (!isValid())
227         return;
228
229     m_isClosed = true;
230
231     process()->disconnectFramesFromPage(this);
232     m_mainFrame = 0;
233
234 #if ENABLE(INSPECTOR)
235     if (m_inspector) {
236         m_inspector->invalidate();
237         m_inspector = 0;
238     }
239 #endif
240
241     if (m_openPanelResultListener) {
242         m_openPanelResultListener->invalidate();
243         m_openPanelResultListener = 0;
244     }
245
246     m_toolTip = String();
247
248     invalidateCallbackMap(m_dataCallbacks);
249     invalidateCallbackMap(m_stringCallbacks);
250
251     Vector<WebEditCommandProxy*> editCommandVector;
252     copyToVector(m_editCommandSet, editCommandVector);
253     m_editCommandSet.clear();
254     for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
255         editCommandVector[i]->invalidate();
256
257     m_activePopupMenu = 0;
258
259     m_estimatedProgress = 0.0;
260     
261     m_loaderClient.initialize(0);
262     m_policyClient.initialize(0);
263     m_uiClient.initialize(0);
264
265     m_drawingArea.clear();
266
267     process()->send(Messages::WebPage::Close(), m_pageID);
268     process()->removeWebPage(m_pageID);
269 }
270
271 bool WebPageProxy::tryClose()
272 {
273     if (!isValid())
274         return true;
275
276     process()->send(Messages::WebPage::TryClose(), m_pageID);
277     return false;
278 }
279
280 static void initializeSandboxExtensionHandle(const KURL& url, SandboxExtension::Handle& sandboxExtensionHandle)
281 {
282     if (!url.isLocalFile())
283         return;
284
285     SandboxExtension::createHandle("/", SandboxExtension::ReadOnly, sandboxExtensionHandle);
286 }
287
288 void WebPageProxy::loadURL(const String& url)
289 {
290     if (!isValid())
291         relaunch();
292
293     SandboxExtension::Handle sandboxExtensionHandle;
294     initializeSandboxExtensionHandle(KURL(KURL(), url), sandboxExtensionHandle);
295     process()->send(Messages::WebPage::LoadURL(url, sandboxExtensionHandle), m_pageID);
296 }
297
298 void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
299 {
300     if (!isValid())
301         relaunch();
302
303     SandboxExtension::Handle sandboxExtensionHandle;
304     initializeSandboxExtensionHandle(urlRequest->resourceRequest().url(), sandboxExtensionHandle);
305     process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest(), sandboxExtensionHandle), m_pageID);
306 }
307
308 void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
309 {
310     if (!isValid())
311         return;
312     process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
313 }
314
315 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL)
316 {
317     if (!isValid())
318         return;
319
320     if (!m_mainFrame)
321         return;
322
323     m_mainFrame->setUnreachableURL(unreachableURL);
324     process()->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL), m_pageID);
325 }
326
327 void WebPageProxy::loadPlainTextString(const String& string)
328 {
329     if (!isValid())
330         return;
331     process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
332 }
333
334 void WebPageProxy::stopLoading()
335 {
336     if (!isValid())
337         return;
338     process()->send(Messages::WebPage::StopLoading(), m_pageID);
339 }
340
341 void WebPageProxy::reload(bool reloadFromOrigin)
342 {
343     if (!isValid())
344         return;
345     process()->send(Messages::WebPage::Reload(reloadFromOrigin), m_pageID);
346 }
347
348 void WebPageProxy::goForward()
349 {
350     if (!isValid())
351         return;
352
353     if (!canGoForward())
354         return;
355
356     process()->send(Messages::WebPage::GoForward(m_backForwardList->forwardItem()->itemID()), m_pageID);
357 }
358
359 bool WebPageProxy::canGoForward() const
360 {
361     return m_backForwardList->forwardItem();
362 }
363
364 void WebPageProxy::goBack()
365 {
366     if (!isValid())
367         return;
368
369     if (!canGoBack())
370         return;
371
372     process()->send(Messages::WebPage::GoBack(m_backForwardList->backItem()->itemID()), m_pageID);
373 }
374
375 bool WebPageProxy::canGoBack() const
376 {
377     return m_backForwardList->backItem();
378 }
379
380 void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
381 {
382     if (!isValid())
383         return;
384
385     process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
386 }
387
388 void WebPageProxy::didChangeBackForwardList()
389 {
390     m_loaderClient.didChangeBackForwardList(this);
391 }
392
393     
394 bool WebPageProxy::canShowMIMEType(const String& mimeType) const
395 {
396     if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType))
397         return true;
398
399     if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType))
400         return true;
401     
402     String newMimeType = mimeType;
403     PluginInfoStore::Plugin plugin = context()->pluginInfoStore()->findPlugin(newMimeType, KURL());
404     if (!plugin.path.isNull())
405         return true;
406
407     return false;
408 }
409
410 void WebPageProxy::setDrawsBackground(bool drawsBackground)
411 {
412     if (m_drawsBackground == drawsBackground)
413         return;
414
415     m_drawsBackground = drawsBackground;
416
417     if (isValid())
418         process()->send(Messages::WebPage::SetDrawsBackground(drawsBackground), m_pageID);
419 }
420
421 void WebPageProxy::setDrawsTransparentBackground(bool drawsTransparentBackground)
422 {
423     if (m_drawsTransparentBackground == drawsTransparentBackground)
424         return;
425
426     m_drawsTransparentBackground = drawsTransparentBackground;
427
428     if (isValid())
429         process()->send(Messages::WebPage::SetDrawsTransparentBackground(drawsTransparentBackground), m_pageID);
430 }
431
432 void WebPageProxy::setFocused(bool isFocused)
433 {
434     if (!isValid())
435         return;
436     process()->send(Messages::WebPage::SetFocused(isFocused), m_pageID);
437 }
438
439 void WebPageProxy::setInitialFocus(bool forward)
440 {
441     if (!isValid())
442         return;
443     process()->send(Messages::WebPage::SetInitialFocus(forward), m_pageID);
444 }
445
446 void WebPageProxy::setActive(bool active)
447 {
448     if (!isValid())
449         return;
450     process()->send(Messages::WebPage::SetActive(active), m_pageID);
451 }
452
453 void WebPageProxy::setWindowResizerSize(const IntSize& windowResizerSize)
454 {
455     if (!isValid())
456         return;
457     process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
458 }
459
460 void WebPageProxy::validateMenuItem(const String& commandName)
461 {
462     if (!isValid())
463         return;
464     process()->send(Messages::WebPage::ValidateMenuItem(commandName), m_pageID);
465 }
466     
467 void WebPageProxy::executeEditCommand(const String& commandName)
468 {
469     if (!isValid())
470         return;
471
472     process()->send(Messages::WebPage::ExecuteEditCommand(commandName), m_pageID);
473 }
474     
475 void WebPageProxy::setIsInWindow(bool isInWindow)
476 {
477     if (m_isInWindow == isInWindow)
478         return;
479     
480     m_isInWindow = isInWindow;
481     if (!isValid())
482         return;
483     process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
484 }
485
486 #if PLATFORM(MAC)
487 void WebPageProxy::updateWindowIsVisible(bool windowIsVisible)
488 {
489     if (!isValid())
490         return;
491     process()->send(Messages::WebPage::SetWindowIsVisible(windowIsVisible), m_pageID);
492 }
493
494 void WebPageProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates)
495 {
496     if (!isValid())
497         return;
498
499     process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates), m_pageID);
500 }
501
502 void WebPageProxy::getMarkedRange(uint64_t& location, uint64_t& length)
503 {
504     process()->sendSync(Messages::WebPage::GetMarkedRange(), Messages::WebPage::GetMarkedRange::Reply(location, length), m_pageID);
505 }
506     
507 uint64_t WebPageProxy::characterIndexForPoint(const IntPoint point)
508 {
509     uint64_t result;
510     process()->sendSync(Messages::WebPage::CharacterIndexForPoint(point), Messages::WebPage::CharacterIndexForPoint::Reply(result), m_pageID);
511     return result;
512 }
513
514 WebCore::IntRect WebPageProxy::firstRectForCharacterRange(uint64_t location, uint64_t length)
515 {
516     IntRect resultRect;
517     process()->sendSync(Messages::WebPage::FirstRectForCharacterRange(location, length), Messages::WebPage::FirstRectForCharacterRange::Reply(resultRect), m_pageID);
518     return resultRect;
519 }
520 #elif PLATFORM(WIN)
521 WebCore::IntRect WebPageProxy::firstRectForCharacterInSelectedRange(int characterPosition)
522 {
523     IntRect resultRect;
524     process()->sendSync(Messages::WebPage::FirstRectForCharacterInSelectedRange(characterPosition), Messages::WebPage::FirstRectForCharacterInSelectedRange::Reply(resultRect), m_pageID);
525     return resultRect;
526 }
527
528 String WebPageProxy::getSelectedText()
529 {
530     String text;
531     process()->sendSync(Messages::WebPage::GetSelectedText(), Messages::WebPage::GetSelectedText::Reply(text), m_pageID);
532     return text;
533 }
534 #endif
535
536 #if ENABLE(TILED_BACKING_STORE)
537 void WebPageProxy::setActualVisibleContentRect(const IntRect& rect)
538 {
539     if (!isValid())
540         return;
541
542     process()->send(Messages::WebPage::SetActualVisibleContentRect(rect), m_pageID);
543 }
544 #endif
545
546 void WebPageProxy::handleMouseEvent(const WebMouseEvent& event)
547 {
548     if (!isValid())
549         return;
550
551     // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
552     if (event.type() != WebEvent::MouseMove)
553         process()->responsivenessTimer()->start();
554     process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
555 }
556
557 static PassOwnPtr<WebWheelEvent> coalesceWheelEvents(WebWheelEvent* oldNextWheelEvent, const WebWheelEvent& newWheelEvent)
558 {
559 #if MERGE_WHEEL_EVENTS
560     // Merge model: Combine wheel event deltas (and wheel ticks) into a single wheel event.
561     if (!oldNextWheelEvent)
562         return adoptPtr(new WebWheelEvent(newWheelEvent));
563
564     if (oldNextWheelEvent->position() != newWheelEvent.position() || oldNextWheelEvent->modifiers() != newWheelEvent.modifiers() || oldNextWheelEvent->granularity() != newWheelEvent.granularity())
565         return adoptPtr(new WebWheelEvent(newWheelEvent));
566
567     FloatSize mergedDelta = oldNextWheelEvent->delta() + newWheelEvent.delta();
568     FloatSize mergedWheelTicks = oldNextWheelEvent->wheelTicks() + newWheelEvent.wheelTicks();
569
570     return adoptPtr(new WebWheelEvent(WebEvent::Wheel, newWheelEvent.position(), newWheelEvent.globalPosition(), mergedDelta, mergedWheelTicks, newWheelEvent.granularity(), newWheelEvent.modifiers(), newWheelEvent.timestamp()));
571 #else
572     // Simple model: Just keep the last event, dropping all interim events.
573     return adoptPtr(new WebWheelEvent(newWheelEvent));
574 #endif
575 }
576
577 void WebPageProxy::handleWheelEvent(const WebWheelEvent& event)
578 {
579     if (!isValid())
580         return;
581
582     if (m_processingWheelEvent) {
583         m_nextWheelEvent = coalesceWheelEvents(m_nextWheelEvent.get(), event);
584         return;
585     }
586
587     process()->responsivenessTimer()->start();
588     process()->send(Messages::WebPage::WheelEvent(event), m_pageID);
589     m_processingWheelEvent = true;
590 }
591
592 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
593 {
594     if (!isValid())
595         return;
596
597     m_keyEventQueue.append(event);
598
599     process()->responsivenessTimer()->start();
600     process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
601 }
602
603 #if ENABLE(TOUCH_EVENTS)
604 void WebPageProxy::handleTouchEvent(const WebTouchEvent& event)
605 {
606     if (!isValid())
607         return;
608     process()->send(Messages::WebPage::TouchEvent(event), m_pageID); 
609 }
610 #endif
611
612 void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
613 {
614     if (!isValid())
615         return;
616
617     uint64_t downloadID = 0;
618     if (action == PolicyDownload) {
619         // Create a download proxy.
620         downloadID = context()->createDownloadProxy();
621     }
622
623     // If we received a policy decision while in decidePolicyForMIMEType the decision will 
624     // be sent back to the web process by decidePolicyForMIMEType. 
625     if (m_inDecidePolicyForMIMEType) {
626         m_syncMimeTypePolicyActionIsValid = true;
627         m_syncMimeTypePolicyAction = action;
628         m_syncMimeTypePolicyDownloadID = downloadID;
629         return;
630     }
631
632     process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action, downloadID), m_pageID);
633 }
634
635 String WebPageProxy::pageTitle() const
636 {
637     // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
638     // crashed, page has been closed).
639     if (!m_mainFrame)
640         return String();
641
642     return m_mainFrame->title();
643 }
644
645 void WebPageProxy::setUserAgent(const String& userAgent)
646 {
647     if (m_userAgent == userAgent)
648         return;
649     m_userAgent = userAgent;
650
651     if (!isValid())
652         return;
653     process()->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID);
654 }
655
656 void WebPageProxy::setApplicationNameForUserAgent(const String& applicationName)
657 {
658     if (m_applicationNameForUserAgent == applicationName)
659         return;
660
661     m_applicationNameForUserAgent = applicationName;
662     if (!m_customUserAgent.isEmpty())
663         return;
664
665     setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
666 }
667
668 void WebPageProxy::setCustomUserAgent(const String& customUserAgent)
669 {
670     if (m_customUserAgent == customUserAgent)
671         return;
672
673     m_customUserAgent = customUserAgent;
674
675     if (m_customUserAgent.isEmpty()) {
676         setUserAgent(standardUserAgent(m_applicationNameForUserAgent));
677         return;
678     }
679
680     setUserAgent(m_customUserAgent);
681 }
682
683 bool WebPageProxy::supportsTextEncoding() const
684 {
685     return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument();
686 }
687
688 void WebPageProxy::setCustomTextEncodingName(const String& encodingName)
689 {
690     if (m_customTextEncodingName == encodingName)
691         return;
692     m_customTextEncodingName = encodingName;
693
694     if (!isValid())
695         return;
696     process()->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID);
697 }
698
699 void WebPageProxy::terminateProcess()
700 {
701     if (!isValid())
702         return;
703
704     process()->terminate();
705 }
706
707 #if !PLATFORM(CF) || defined(BUILDING_QT__)
708 PassRefPtr<WebData> WebPageProxy::sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const
709 {
710     // FIXME: Return session state data for saving Page state.
711     return 0;
712 }
713
714 void WebPageProxy::restoreFromSessionStateData(WebData*)
715 {
716     // FIXME: Restore the Page from the passed in session state data.
717 }
718 #endif
719
720 void WebPageProxy::setTextZoomFactor(double zoomFactor)
721 {
722     if (!isValid())
723         return;
724
725     if (m_textZoomFactor == zoomFactor)
726         return;
727
728     m_textZoomFactor = zoomFactor;
729     process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID); 
730 }
731
732 void WebPageProxy::setPageZoomFactor(double zoomFactor)
733 {
734     if (!isValid())
735         return;
736
737     if (m_pageZoomFactor == zoomFactor)
738         return;
739
740     m_pageZoomFactor = zoomFactor;
741     process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID); 
742 }
743
744 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
745 {
746     if (!isValid())
747         return;
748
749     if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
750         return;
751
752     m_pageZoomFactor = pageZoomFactor;
753     m_textZoomFactor = textZoomFactor;
754     process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); 
755 }
756
757 void WebPageProxy::scaleWebView(double scale, const IntPoint& origin)
758 {
759     if (!isValid())
760         return;
761
762     if (m_viewScaleFactor == scale)
763         return;
764
765     m_viewScaleFactor = scale;
766     process()->send(Messages::WebPage::ScaleWebView(scale, origin), m_pageID);
767 }
768
769 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
770 {
771     process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
772 }
773
774 void WebPageProxy::hideFindUI()
775 {
776     process()->send(Messages::WebPage::HideFindUI(), m_pageID);
777 }
778
779 void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
780 {
781     process()->send(Messages::WebPage::CountStringMatches(string, options, maxMatchCount), m_pageID);
782 }
783     
784 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<StringCallback> prpCallback)
785 {
786     RefPtr<StringCallback> callback = prpCallback;
787     uint64_t callbackID = callback->callbackID();
788     m_stringCallbacks.set(callbackID, callback.get());
789     process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
790 }
791
792 void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<StringCallback> prpCallback)
793 {
794     RefPtr<StringCallback> callback = prpCallback;
795     uint64_t callbackID = callback->callbackID();
796     m_stringCallbacks.set(callbackID, callback.get());
797     process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
798 }
799
800 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)
801 {
802     RefPtr<StringCallback> callback = prpCallback;
803     uint64_t callbackID = callback->callbackID();
804     m_stringCallbacks.set(callbackID, callback.get());
805     process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
806 }
807
808 void WebPageProxy::getContentsAsString(PassRefPtr<StringCallback> prpCallback)
809 {
810     RefPtr<StringCallback> callback = prpCallback;
811     uint64_t callbackID = callback->callbackID();
812     m_stringCallbacks.set(callbackID, callback.get());
813     process()->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
814 }
815
816 void WebPageProxy::getSelectionOrContentsAsString(PassRefPtr<StringCallback> prpCallback)
817 {
818     RefPtr<StringCallback> callback = prpCallback;
819     uint64_t callbackID = callback->callbackID();
820     m_stringCallbacks.set(callbackID, callback.get());
821     process()->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
822 }
823
824 void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
825 {
826     RefPtr<DataCallback> callback = prpCallback;
827     uint64_t callbackID = callback->callbackID();
828     m_dataCallbacks.set(callbackID, callback.get());
829     process()->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
830 }
831
832 void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
833 {
834     RefPtr<DataCallback> callback = prpCallback;
835     uint64_t callbackID = callback->callbackID();
836     m_dataCallbacks.set(callbackID, callback.get());
837     process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
838 }
839
840 void WebPageProxy::preferencesDidChange()
841 {
842     if (!isValid())
843         return;
844
845     // FIXME: It probably makes more sense to send individual preference changes.
846     // However, WebKitTestRunner depends on getting a preference change notification
847     // even if nothing changed in UI process, so that overrides get removed.
848     process()->send(Messages::WebPage::PreferencesDidChange(pageGroup()->preferences()->store()), m_pageID);
849 }
850
851 #if ENABLE(TILED_BACKING_STORE)
852 void WebPageProxy::setResizesToContentsUsingLayoutSize(const WebCore::IntSize& targetLayoutSize)
853 {
854     process()->send(Messages::WebPage::SetResizesToContentsUsingLayoutSize(targetLayoutSize), m_pageID);
855 }
856 #endif
857
858 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
859 {
860     if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
861         m_drawingArea->didReceiveMessage(connection, messageID, arguments);
862         return;
863     }
864
865 #if ENABLE(INSPECTOR)
866     if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
867         if (WebInspectorProxy* inspector = this->inspector())
868             inspector->didReceiveWebInspectorProxyMessage(connection, messageID, arguments);
869         return;
870     }
871 #endif
872
873     didReceiveWebPageProxyMessage(connection, messageID, arguments);
874 }
875
876 void WebPageProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply)
877 {
878     if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
879         m_drawingArea->didReceiveSyncMessage(connection, messageID, arguments, reply);
880         return;
881     }
882
883 #if ENABLE(INSPECTOR)
884     if (messageID.is<CoreIPC::MessageClassWebInspectorProxy>()) {
885         if (WebInspectorProxy* inspector = this->inspector())
886             inspector->didReceiveSyncWebInspectorProxyMessage(connection, messageID, arguments, reply);
887         return;
888     }
889 #endif
890
891     // FIXME: Do something with reply.
892     didReceiveSyncWebPageProxyMessage(connection, messageID, arguments, reply);
893 }
894
895 #if PLATFORM(MAC)
896 void WebPageProxy::interpretKeyEvent(uint32_t type, Vector<KeypressCommand>& commandsList, uint32_t selectionStart, uint32_t selectionEnd, Vector<CompositionUnderline>& underlines)
897 {
898     m_pageClient->interceptKeyEvent(m_keyEventQueue.first(), commandsList, selectionStart, selectionEnd, underlines);
899 }
900 #endif
901
902 void WebPageProxy::didCreateMainFrame(uint64_t frameID)
903 {
904     ASSERT(!m_mainFrame);
905
906     m_mainFrame = WebFrameProxy::create(this, frameID);
907     process()->frameCreated(frameID, m_mainFrame.get());
908 }
909
910 void WebPageProxy::didCreateSubFrame(uint64_t frameID)
911 {
912     ASSERT(m_mainFrame);
913     process()->frameCreated(frameID, WebFrameProxy::create(this, frameID).get());
914 }
915
916 void WebPageProxy::didStartProgress()
917 {
918     m_estimatedProgress = 0.0;
919     
920     m_loaderClient.didStartProgress(this);
921 }
922
923 void WebPageProxy::didChangeProgress(double value)
924 {
925     m_estimatedProgress = value;
926     
927     m_loaderClient.didChangeProgress(this);
928 }
929
930 void WebPageProxy::didFinishProgress()
931 {
932     m_estimatedProgress = 1.0;
933
934     m_loaderClient.didFinishProgress(this);
935 }
936
937 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder* arguments)
938 {
939     RefPtr<APIObject> userData;
940     WebContextUserMessageDecoder messageDecoder(userData, context());
941     if (!arguments->decode(messageDecoder))
942         return;
943
944     WebFrameProxy* frame = process()->webFrame(frameID);
945
946     if (!loadingSubstituteDataForUnreachableURL)
947         frame->setUnreachableURL(String());
948
949     frame->didStartProvisionalLoad(url);
950     m_loaderClient.didStartProvisionalLoadForFrame(this, frame, userData.get());
951 }
952
953 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
954 {
955     RefPtr<APIObject> userData;
956     WebContextUserMessageDecoder messageDecoder(userData, context());
957     if (!arguments->decode(messageDecoder))
958         return;
959
960     WebFrameProxy* frame = process()->webFrame(frameID);
961
962     frame->didReceiveServerRedirectForProvisionalLoad(url);
963     m_loaderClient.didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, userData.get());
964 }
965
966 void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
967 {
968     RefPtr<APIObject> userData;
969     WebContextUserMessageDecoder messageDecoder(userData, context());
970     if (!arguments->decode(messageDecoder))
971         return;
972
973     WebFrameProxy* frame = process()->webFrame(frameID);
974
975     frame->didFailProvisionalLoad();
976     m_loaderClient.didFailProvisionalLoadWithErrorForFrame(this, frame, error, userData.get());
977 }
978
979 void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
980 {
981     RefPtr<APIObject> userData;
982     WebContextUserMessageDecoder messageDecoder(userData, context());
983     if (!arguments->decode(messageDecoder))
984         return;
985
986     WebFrameProxy* frame = process()->webFrame(frameID);
987
988     frame->didCommitLoad(mimeType, certificateInfo);
989
990     if (frame->isMainFrame()) {
991         m_mainFrameHasCustomRepresentation = frameHasCustomRepresentation;
992         m_pageClient->didCommitLoadForMainFrame(frameHasCustomRepresentation);
993     }
994
995     m_loaderClient.didCommitLoadForFrame(this, frame, userData.get());
996 }
997
998 void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
999 {
1000     RefPtr<APIObject> userData;
1001     WebContextUserMessageDecoder messageDecoder(userData, context());
1002     if (!arguments->decode(messageDecoder))
1003         return;
1004
1005     WebFrameProxy* frame = process()->webFrame(frameID);
1006
1007     m_loaderClient.didFinishDocumentLoadForFrame(this, frame, userData.get());
1008 }
1009
1010 void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1011 {
1012     RefPtr<APIObject> userData;
1013     WebContextUserMessageDecoder messageDecoder(userData, context());
1014     if (!arguments->decode(messageDecoder))
1015         return;
1016
1017     WebFrameProxy* frame = process()->webFrame(frameID);
1018
1019     frame->didFinishLoad();
1020     m_loaderClient.didFinishLoadForFrame(this, frame, userData.get());
1021 }
1022
1023 void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
1024 {
1025     RefPtr<APIObject> userData;
1026     WebContextUserMessageDecoder messageDecoder(userData, context());
1027     if (!arguments->decode(messageDecoder))
1028         return;
1029
1030     WebFrameProxy* frame = process()->webFrame(frameID);
1031     frame->didFailLoad();
1032
1033     m_loaderClient.didFailLoadWithErrorForFrame(this, frame, error, userData.get());
1034 }
1035
1036 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
1037 {
1038     RefPtr<APIObject> userData;
1039     WebContextUserMessageDecoder messageDecoder(userData, context());
1040     if (!arguments->decode(messageDecoder))
1041         return;
1042
1043     WebFrameProxy* frame = process()->webFrame(frameID);
1044     frame->didSameDocumentNavigation(url);
1045
1046     m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
1047 }
1048
1049 void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments)
1050 {
1051     RefPtr<APIObject> userData;
1052     WebContextUserMessageDecoder messageDecoder(userData, context());
1053     if (!arguments->decode(messageDecoder))
1054         return;
1055
1056     WebFrameProxy* frame = process()->webFrame(frameID);
1057     frame->didChangeTitle(title);
1058     
1059     m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
1060 }
1061
1062 void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1063 {
1064     RefPtr<APIObject> userData;
1065     WebContextUserMessageDecoder messageDecoder(userData, context());
1066     if (!arguments->decode(messageDecoder))
1067         return;
1068
1069     WebFrameProxy* frame = process()->webFrame(frameID);
1070
1071     m_loaderClient.didFirstLayoutForFrame(this, frame, userData.get());
1072 }
1073
1074 void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1075 {
1076     RefPtr<APIObject> userData;
1077     WebContextUserMessageDecoder messageDecoder(userData, context());
1078     if (!arguments->decode(messageDecoder))
1079         return;
1080
1081     WebFrameProxy* frame = process()->webFrame(frameID);
1082
1083     m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get());
1084 }
1085
1086 void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1087 {
1088     RefPtr<APIObject> userData;
1089     WebContextUserMessageDecoder messageDecoder(userData, context());
1090     if (!arguments->decode(messageDecoder))
1091         return;
1092
1093     WebFrameProxy* frame = process()->webFrame(frameID);
1094
1095     m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get());
1096 }
1097
1098 void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1099 {
1100     RefPtr<APIObject> userData;
1101     WebContextUserMessageDecoder messageDecoder(userData, context());
1102     if (!arguments->decode(messageDecoder))
1103         return;
1104
1105     WebFrameProxy* frame = process()->webFrame(frameID);
1106
1107     m_loaderClient.didDisplayInsecureContentForFrame(this, frame, userData.get());
1108 }
1109
1110 void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
1111 {
1112     RefPtr<APIObject> userData;
1113     WebContextUserMessageDecoder messageDecoder(userData, context());
1114     if (!arguments->decode(messageDecoder))
1115         return;
1116
1117     WebFrameProxy* frame = process()->webFrame(frameID);
1118
1119     m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
1120 }
1121
1122 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
1123 {
1124     WebFrameProxy* frame = process()->webFrame(frameID);
1125
1126     frame->setIsFrameSet(value);
1127 }
1128
1129 // PolicyClient
1130
1131 void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const String& url, uint64_t listenerID)
1132 {
1133     WebFrameProxy* frame = process()->webFrame(frameID);
1134     NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
1135     WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
1136     WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
1137     
1138     RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
1139     if (!m_policyClient.decidePolicyForNavigationAction(this, navigationType, modifiers, mouseButton, url, frame, listener.get()))
1140         listener->use();
1141 }
1142
1143 void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const String& url, uint64_t listenerID)
1144 {
1145     WebFrameProxy* frame = process()->webFrame(frameID);
1146     NavigationType navigationType = static_cast<NavigationType>(opaqueNavigationType);
1147     WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
1148     WebMouseEvent::Button mouseButton = static_cast<WebMouseEvent::Button>(opaqueMouseButton);
1149
1150     RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
1151     if (!m_policyClient.decidePolicyForNewWindowAction(this, navigationType, modifiers, mouseButton, url, frame, listener.get()))
1152         listener->use();
1153 }
1154
1155 void WebPageProxy::decidePolicyForMIMEType(uint64_t frameID, const String& MIMEType, const String& url, uint64_t listenerID, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
1156 {
1157     WebFrameProxy* frame = process()->webFrame(frameID);
1158     RefPtr<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID);
1159
1160     ASSERT(!m_inDecidePolicyForMIMEType);
1161
1162     m_inDecidePolicyForMIMEType = true;
1163     m_syncMimeTypePolicyActionIsValid = false;
1164
1165     if (!m_policyClient.decidePolicyForMIMEType(this, MIMEType, url, frame, listener.get()))
1166         listener->use();
1167
1168     m_inDecidePolicyForMIMEType = false;
1169
1170     // Check if we received a policy decision already. If we did, we can just pass it back.
1171     if (m_syncMimeTypePolicyActionIsValid) {
1172         receivedPolicyAction = true;
1173         policyAction = m_syncMimeTypePolicyAction;
1174         downloadID = m_syncMimeTypePolicyDownloadID;
1175     }
1176 }
1177
1178 // FormClient
1179
1180 void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
1181 {
1182     RefPtr<APIObject> userData;
1183     WebContextUserMessageDecoder messageDecoder(userData, context());
1184     if (!arguments->decode(messageDecoder))
1185         return;
1186
1187     WebFrameProxy* frame = process()->webFrame(frameID);
1188     WebFrameProxy* sourceFrame = process()->webFrame(sourceFrameID);
1189
1190     RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
1191     if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues.stringPairVector(), userData.get(), listener.get()))
1192         listener->continueSubmission();
1193 }
1194
1195 // ResourceLoad Client
1196
1197 void WebPageProxy::didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request)
1198 {
1199     WebFrameProxy* frame = process()->webFrame(frameID);
1200
1201     m_resourceLoadClient.didInitiateLoadForResource(this, frame, resourceIdentifier, request);
1202 }
1203
1204 void WebPageProxy::didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceRequest& request, const ResourceResponse& redirectResponse)
1205 {
1206     WebFrameProxy* frame = process()->webFrame(frameID);
1207
1208     m_resourceLoadClient.didSendRequestForResource(this, frame, resourceIdentifier, request, redirectResponse);
1209 }
1210
1211 void WebPageProxy::didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceResponse& response)
1212 {
1213     WebFrameProxy* frame = process()->webFrame(frameID);
1214
1215     m_resourceLoadClient.didReceiveResponseForResource(this, frame, resourceIdentifier, response);
1216 }
1217
1218 void WebPageProxy::didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength)
1219 {
1220     WebFrameProxy* frame = process()->webFrame(frameID);
1221
1222     m_resourceLoadClient.didReceiveContentLengthForResource(this, frame, resourceIdentifier, contentLength);
1223 }
1224
1225 void WebPageProxy::didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier)
1226 {
1227     WebFrameProxy* frame = process()->webFrame(frameID);
1228
1229     m_resourceLoadClient.didFinishLoadForResource(this, frame, resourceIdentifier);
1230 }
1231
1232 void WebPageProxy::didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const ResourceError& error)
1233 {
1234     WebFrameProxy* frame = process()->webFrame(frameID);
1235
1236     m_resourceLoadClient.didFailLoadForResource(this, frame, resourceIdentifier, error);
1237 }
1238
1239
1240 // UIClient
1241
1242 void WebPageProxy::createNewPage(const WindowFeatures& windowFeatures, uint32_t opaqueModifiers, int32_t opaqueMouseButton, uint64_t& newPageID, WebPageCreationParameters& newPageParameters)
1243 {
1244     RefPtr<WebPageProxy> newPage = m_uiClient.createNewPage(this, windowFeatures, static_cast<WebEvent::Modifiers>(opaqueModifiers), static_cast<WebMouseEvent::Button>(opaqueMouseButton));
1245     if (newPage) {
1246         // FIXME: Pass the real size.
1247         newPageID = newPage->pageID();
1248         newPageParameters = newPage->creationParameters(IntSize(100, 100));
1249     } else
1250         newPageID = 0;
1251 }
1252     
1253 void WebPageProxy::showPage()
1254 {
1255     m_uiClient.showPage(this);
1256 }
1257
1258 void WebPageProxy::closePage()
1259 {
1260     m_uiClient.close(this);
1261 }
1262
1263 void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message)
1264 {
1265     m_uiClient.runJavaScriptAlert(this, message, process()->webFrame(frameID));
1266 }
1267
1268 void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message, bool& result)
1269 {
1270     result = m_uiClient.runJavaScriptConfirm(this, message, process()->webFrame(frameID));
1271 }
1272
1273 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message, const String& defaultValue, String& result)
1274 {
1275     result = m_uiClient.runJavaScriptPrompt(this, message, defaultValue, process()->webFrame(frameID));
1276 }
1277
1278 void WebPageProxy::setStatusText(const String& text)
1279 {
1280     m_uiClient.setStatusText(this, text);
1281 }
1282
1283 void WebPageProxy::mouseDidMoveOverElement(uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments)
1284 {
1285     RefPtr<APIObject> userData;
1286     WebContextUserMessageDecoder messageDecoder(userData, context());
1287     if (!arguments->decode(messageDecoder))
1288         return;
1289
1290     WebEvent::Modifiers modifiers = static_cast<WebEvent::Modifiers>(opaqueModifiers);
1291
1292     m_uiClient.mouseDidMoveOverElement(this, modifiers, userData.get());
1293 }
1294
1295 void WebPageProxy::missingPluginButtonClicked(const String& mimeType, const String& url)
1296 {
1297     m_uiClient.missingPluginButtonClicked(this, mimeType, url);
1298 }
1299
1300 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
1301 {
1302     m_uiClient.setToolbarsAreVisible(this, toolbarsAreVisible);
1303 }
1304
1305 void WebPageProxy::getToolbarsAreVisible(bool& toolbarsAreVisible)
1306 {
1307     toolbarsAreVisible = m_uiClient.toolbarsAreVisible(this);
1308 }
1309
1310 void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
1311 {
1312     m_uiClient.setMenuBarIsVisible(this, menuBarIsVisible);
1313 }
1314
1315 void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
1316 {
1317     menuBarIsVisible = m_uiClient.menuBarIsVisible(this);
1318 }
1319
1320 void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
1321 {
1322     m_uiClient.setStatusBarIsVisible(this, statusBarIsVisible);
1323 }
1324
1325 void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
1326 {
1327     statusBarIsVisible = m_uiClient.statusBarIsVisible(this);
1328 }
1329
1330 void WebPageProxy::setIsResizable(bool isResizable)
1331 {
1332     m_uiClient.setIsResizable(this, isResizable);
1333 }
1334
1335 void WebPageProxy::getIsResizable(bool& isResizable)
1336 {
1337     isResizable = m_uiClient.isResizable(this);
1338 }
1339
1340 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
1341 {
1342     m_uiClient.setWindowFrame(this, m_pageClient->convertToDeviceSpace(newWindowFrame));
1343 }
1344
1345 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
1346 {
1347     newWindowFrame = m_pageClient->convertToUserSpace(m_uiClient.windowFrame(this));
1348 }
1349
1350 void WebPageProxy::canRunBeforeUnloadConfirmPanel(bool& canRun)
1351 {
1352     canRun = m_uiClient.canRunBeforeUnloadConfirmPanel();
1353 }
1354
1355 void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose)
1356 {
1357     shouldClose = m_uiClient.runBeforeUnloadConfirmPanel(this, message, process()->webFrame(frameID));
1358 }
1359
1360 #if ENABLE(TILED_BACKING_STORE)
1361 void WebPageProxy::pageDidRequestScroll(const IntSize& delta)
1362 {
1363     m_pageClient->pageDidRequestScroll(delta);
1364 }
1365 #endif
1366
1367 void WebPageProxy::didChangeViewportData(const ViewportArguments& args)
1368 {
1369     m_pageClient->setViewportArguments(args);
1370 }
1371
1372 void WebPageProxy::pageDidScroll()
1373 {
1374     m_uiClient.pageDidScroll(this);
1375 }
1376
1377 void WebPageProxy::runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data& data)
1378 {
1379     if (m_openPanelResultListener) {
1380         m_openPanelResultListener->invalidate();
1381         m_openPanelResultListener = 0;
1382     }
1383
1384     m_openPanelResultListener = WebOpenPanelResultListenerProxy::create(this);
1385
1386     if (!m_uiClient.runOpenPanel(this, process()->webFrame(frameID), data, m_openPanelResultListener.get()))
1387         didCancelForOpenPanel();
1388 }
1389
1390 #if PLATFORM(QT)
1391 void WebPageProxy::didChangeContentsSize(const WebCore::IntSize& size)
1392 {
1393     m_pageClient->didChangeContentsSize(size);
1394 }
1395
1396 void WebPageProxy::didFindZoomableArea(const WebCore::IntRect& area)
1397 {
1398     m_pageClient->didFindZoomableArea(area);
1399 }
1400
1401 void WebPageProxy::findZoomableAreaForPoint(const WebCore::IntPoint& point)
1402 {
1403     if (!isValid())
1404         return;
1405
1406     process()->send(Messages::WebPage::FindZoomableAreaForPoint(point), m_pageID);
1407 }
1408 #endif
1409
1410 void WebPageProxy::didDraw()
1411 {
1412     m_uiClient.didDraw(this);
1413 }
1414
1415 // Inspector
1416
1417 #if ENABLE(INSPECTOR)
1418
1419 WebInspectorProxy* WebPageProxy::inspector()
1420 {
1421     if (isClosed() || !isValid())
1422         return 0;
1423     if (!m_inspector)
1424         m_inspector = WebInspectorProxy::create(this);
1425     return m_inspector.get();
1426 }
1427
1428 #endif
1429
1430 // BackForwardList
1431
1432 void WebPageProxy::backForwardAddItem(uint64_t itemID)
1433 {
1434     m_backForwardList->addItem(process()->webBackForwardItem(itemID));
1435 }
1436
1437 void WebPageProxy::backForwardGoToItem(uint64_t itemID)
1438 {
1439     m_backForwardList->goToItem(process()->webBackForwardItem(itemID));
1440 }
1441
1442 void WebPageProxy::backForwardItemAtIndex(int32_t index, uint64_t& itemID)
1443 {
1444     WebBackForwardListItem* item = m_backForwardList->itemAtIndex(index);
1445     itemID = item ? item->itemID() : 0;
1446 }
1447
1448 void WebPageProxy::backForwardBackListCount(int32_t& count)
1449 {
1450     count = m_backForwardList->backListCount();
1451 }
1452
1453 void WebPageProxy::backForwardForwardListCount(int32_t& count)
1454 {
1455     count = m_backForwardList->forwardListCount();
1456 }
1457
1458 #if PLATFORM(MAC)
1459 // Selection change support
1460 void WebPageProxy::didSelectionChange(bool isNone, bool isContentEditable, bool isPasswordField, bool hasComposition, uint64_t location, uint64_t length)
1461 {
1462     m_pageClient->selectionChanged(isNone, isContentEditable, isPasswordField, hasComposition, location, length);
1463 }
1464
1465 // Complex text input support for plug-ins.
1466 void WebPageProxy::sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput)
1467 {
1468     if (!isValid())
1469         return;
1470     
1471     process()->send(Messages::WebPage::SendComplexTextInputToPlugin(pluginComplexTextInputIdentifier, textInput), m_pageID);
1472 }
1473     
1474 #else    
1475 void WebPageProxy::didChangeSelection(bool isNone, bool isContentEditable, bool isPasswordField, bool hasComposition)
1476 {
1477     m_pageClient->selectionChanged(isNone, isContentEditable, isPasswordField, hasComposition);
1478 }
1479 #endif
1480
1481 #if PLATFORM(WIN)
1482 void WebPageProxy::didChangeCompositionSelection(bool hasComposition)
1483 {
1484     m_pageClient->compositionSelectionChanged(hasComposition);
1485 }
1486
1487 void WebPageProxy::confirmComposition(const String& compositionString)
1488 {
1489     process()->send(Messages::WebPage::ConfirmComposition(compositionString), m_pageID);
1490 }
1491
1492 void WebPageProxy::setComposition(const String& compositionString, Vector<WebCore::CompositionUnderline>& underlines, int cursorPosition)
1493 {
1494     process()->send(Messages::WebPage::SetComposition(compositionString, underlines, cursorPosition), m_pageID);
1495 }
1496 #endif
1497     
1498 // Undo management
1499
1500 void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction)
1501 {
1502     registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), Undo);
1503 }
1504
1505 void WebPageProxy::clearAllEditCommands()
1506 {
1507     m_pageClient->clearAllEditCommands();
1508 }
1509
1510 void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
1511 {
1512     m_findClient.didCountStringMatches(this, string, matchCount);
1513 }
1514
1515 void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
1516 {
1517     RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRect, textRects, contentImageHandle);
1518     m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
1519 }
1520
1521 void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
1522 {
1523     m_findClient.didFindString(this, string, matchCount);
1524 }
1525
1526 void WebPageProxy::didFailToFindString(const String& string)
1527 {
1528     m_findClient.didFailToFindString(this, string);
1529 }
1530
1531 void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
1532 {
1533     process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
1534 }
1535
1536 void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
1537 {
1538     process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
1539 }
1540
1541 void WebPageProxy::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
1542 {
1543     if (m_activePopupMenu)
1544         m_activePopupMenu->hidePopupMenu();
1545     else
1546         m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
1547
1548     m_activePopupMenu->showPopupMenu(rect, items, data, selectedIndex);
1549     m_activePopupMenu = 0;
1550 }
1551
1552 void WebPageProxy::hidePopupMenu()
1553 {
1554     if (!m_activePopupMenu)
1555         return;
1556
1557     m_activePopupMenu->hidePopupMenu();
1558     m_activePopupMenu = 0;
1559 }
1560
1561 void WebPageProxy::showContextMenu(const WebCore::IntPoint& menuLocation, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
1562 {
1563     RefPtr<APIObject> userData;
1564     WebContextUserMessageDecoder messageDecoder(userData, context());
1565     if (!arguments->decode(messageDecoder))
1566         return;
1567
1568     if (m_activeContextMenu)
1569         m_activeContextMenu->hideContextMenu();
1570     else
1571         m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
1572
1573     // Give the PageContextMenuClient one last swipe at changing the menu.
1574     Vector<WebContextMenuItemData> items;
1575         
1576     if (!m_contextMenuClient.getContextMenuFromProposedMenu(this, proposedItems, items, userData.get())) {
1577         m_activeContextMenu->showContextMenu(menuLocation, proposedItems);
1578         return;
1579     }
1580     
1581     if (items.size())
1582         m_activeContextMenu->showContextMenu(menuLocation, items);
1583 }
1584
1585 void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
1586 {
1587     // Application custom items don't need to round-trip through to WebCore in the WebProcess.
1588     if (item.action() >= ContextMenuItemBaseApplicationTag) {
1589         m_contextMenuClient.customContextMenuItemSelected(this, item);
1590         return;
1591     }
1592     
1593     process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
1594 }
1595
1596 void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs)
1597 {
1598     if (!isValid())
1599         return;
1600
1601     // FIXME: This also needs to send a sandbox extension for these paths.
1602     process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID);
1603
1604     m_openPanelResultListener->invalidate();
1605     m_openPanelResultListener = 0;
1606 }
1607
1608 void WebPageProxy::didCancelForOpenPanel()
1609 {
1610     if (!isValid())
1611         return;
1612
1613     process()->send(Messages::WebPage::DidCancelForOpenPanel(), m_pageID);
1614     
1615     m_openPanelResultListener->invalidate();
1616     m_openPanelResultListener = 0;
1617 }
1618
1619 void WebPageProxy::unmarkAllMisspellings()
1620 {
1621     process()->send(Messages::WebPage::UnmarkAllMisspellings(), m_pageID);
1622 }
1623
1624 void WebPageProxy::unmarkAllBadGrammar()
1625 {
1626     process()->send(Messages::WebPage::UnmarkAllBadGrammar(), m_pageID);
1627 }
1628
1629 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
1630 {
1631     m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
1632 }
1633
1634 void WebPageProxy::addEditCommand(WebEditCommandProxy* command)
1635 {
1636     m_editCommandSet.add(command);
1637 }
1638
1639 void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
1640 {
1641     m_editCommandSet.remove(command);
1642
1643     if (!isValid())
1644         return;
1645     process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
1646 }
1647
1648 // Other
1649
1650 void WebPageProxy::takeFocus(bool direction)
1651 {
1652     m_pageClient->takeFocus(direction);
1653 }
1654
1655 void WebPageProxy::setToolTip(const String& toolTip)
1656 {
1657     String oldToolTip = m_toolTip;
1658     m_toolTip = toolTip;
1659     m_pageClient->toolTipChanged(oldToolTip, m_toolTip);
1660 }
1661
1662 void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
1663 {
1664     m_pageClient->setCursor(cursor);
1665 }
1666
1667 void WebPageProxy::didValidateMenuItem(const String& commandName, bool isEnabled, int32_t state)
1668 {
1669     m_pageClient->setEditCommandState(commandName, isEnabled, state);
1670 }
1671
1672 void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
1673 {
1674     WebEvent::Type type = static_cast<WebEvent::Type>(opaqueType);
1675
1676     switch (type) {
1677     case WebEvent::MouseMove:
1678         break;
1679
1680     case WebEvent::MouseDown:
1681     case WebEvent::MouseUp:
1682     case WebEvent::Wheel:
1683     case WebEvent::KeyDown:
1684     case WebEvent::KeyUp:
1685     case WebEvent::RawKeyDown:
1686     case WebEvent::Char:
1687         process()->responsivenessTimer()->stop();
1688         break;
1689     }
1690
1691     switch (type) {
1692     case WebEvent::MouseMove:
1693     case WebEvent::MouseDown:
1694     case WebEvent::MouseUp:
1695         break;
1696
1697     case WebEvent::Wheel: {
1698         m_processingWheelEvent = false;
1699         if (m_nextWheelEvent) {
1700             handleWheelEvent(*m_nextWheelEvent);
1701             m_nextWheelEvent.clear();
1702         }
1703         break;
1704     }
1705
1706     case WebEvent::KeyDown:
1707     case WebEvent::KeyUp:
1708     case WebEvent::RawKeyDown:
1709     case WebEvent::Char: {
1710         NativeWebKeyboardEvent event = m_keyEventQueue.first();
1711         ASSERT(type == event.type());
1712         m_keyEventQueue.removeFirst();
1713
1714         if (handled)
1715             break;
1716
1717         m_pageClient->didNotHandleKeyEvent(event);
1718         m_uiClient.didNotHandleKeyEvent(this, event);
1719         break;
1720     }
1721     }
1722 }
1723
1724 void WebPageProxy::dataCallback(const CoreIPC::DataReference& dataReference, uint64_t callbackID)
1725 {
1726     RefPtr<DataCallback> callback = m_dataCallbacks.take(callbackID);
1727     if (!callback) {
1728         // FIXME: Log error or assert.
1729         return;
1730     }
1731
1732     RefPtr<WebData> data;
1733     if (size_t size = dataReference.size())
1734         data = WebData::create(dataReference.data(), size);
1735
1736     callback->performCallbackWithReturnValue(data.get());
1737 }
1738
1739 void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID)
1740 {
1741     RefPtr<StringCallback> callback = m_stringCallbacks.take(callbackID);
1742     if (!callback) {
1743         // FIXME: Log error or assert.
1744         return;
1745     }
1746
1747     callback->performCallbackWithReturnValue(resultString.impl());
1748 }
1749
1750 void WebPageProxy::focusedFrameChanged(uint64_t frameID)
1751 {
1752     m_focusedFrame = frameID ? process()->webFrame(frameID) : 0;
1753 }
1754
1755 #if USE(ACCELERATED_COMPOSITING)
1756 void WebPageProxy::didChangeAcceleratedCompositing(bool compositing, DrawingAreaInfo& drawingAreaInfo)
1757 {
1758     if (compositing)
1759         didEnterAcceleratedCompositing();
1760     else
1761         didLeaveAcceleratedCompositing();
1762
1763     drawingAreaInfo = drawingArea()->info();
1764 }
1765 #endif
1766
1767 void WebPageProxy::processDidBecomeUnresponsive()
1768 {
1769     m_loaderClient.processDidBecomeUnresponsive(this);
1770 }
1771
1772 void WebPageProxy::processDidBecomeResponsive()
1773 {
1774     m_loaderClient.processDidBecomeResponsive(this);
1775 }
1776
1777 void WebPageProxy::processDidCrash()
1778 {
1779     ASSERT(m_pageClient);
1780
1781     m_isValid = false;
1782
1783     if (m_mainFrame)
1784         m_urlAtProcessExit = m_mainFrame->url();
1785
1786     m_mainFrame = 0;
1787
1788 #if ENABLE(INSPECTOR)
1789     if (m_inspector) {
1790         m_inspector->invalidate();
1791         m_inspector = 0;
1792     }
1793 #endif
1794
1795     if (m_openPanelResultListener) {
1796         m_openPanelResultListener->invalidate();
1797         m_openPanelResultListener = 0;
1798     }
1799
1800     m_toolTip = String();
1801
1802     invalidateCallbackMap(m_dataCallbacks);
1803     invalidateCallbackMap(m_stringCallbacks);
1804
1805     Vector<WebEditCommandProxy*> editCommandVector;
1806     copyToVector(m_editCommandSet, editCommandVector);
1807     m_editCommandSet.clear();
1808     for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
1809         editCommandVector[i]->invalidate();
1810     m_pageClient->clearAllEditCommands();
1811
1812     m_activePopupMenu = 0;
1813
1814     m_estimatedProgress = 0.0;
1815
1816     m_pageClient->processDidCrash();
1817     m_loaderClient.processDidCrash(this);
1818 }
1819
1820 WebPageCreationParameters WebPageProxy::creationParameters(const IntSize& size) const
1821 {
1822     WebPageCreationParameters parameters;
1823     parameters.viewSize = size;
1824     parameters.drawingAreaInfo = m_drawingArea->info();
1825     parameters.store = m_pageGroup->preferences()->store();
1826     parameters.pageGroupData = m_pageGroup->data();
1827     parameters.drawsBackground = m_drawsBackground;
1828     parameters.drawsTransparentBackground = m_drawsTransparentBackground;
1829     parameters.userAgent = userAgent();
1830
1831 #if PLATFORM(WIN)
1832     parameters.nativeWindow = m_pageClient->nativeWindow();
1833 #endif
1834
1835     return parameters;
1836 }
1837
1838 #if USE(ACCELERATED_COMPOSITING)
1839 void WebPageProxy::didEnterAcceleratedCompositing()
1840 {
1841     m_pageClient->pageDidEnterAcceleratedCompositing();
1842 }
1843
1844 void WebPageProxy::didLeaveAcceleratedCompositing()
1845 {
1846     m_pageClient->pageDidLeaveAcceleratedCompositing();
1847 }
1848 #endif // USE(ACCELERATED_COMPOSITING)
1849
1850 void WebPageProxy::backForwardClear()
1851 {
1852     m_backForwardList->clear();
1853 }
1854
1855 void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
1856 {
1857     WebFrameProxy* frame = process()->webFrame(frameID);
1858     RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
1859     
1860     canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get());
1861 }
1862
1863 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge& coreChallenge, uint64_t challengeID)
1864 {
1865     WebFrameProxy* frame = process()->webFrame(frameID);
1866     RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, this);
1867     
1868     m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
1869 }
1870
1871 void WebPageProxy::exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota)
1872 {
1873     WebFrameProxy* frame = process()->webFrame(frameID);
1874     RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(originIdentifier);
1875
1876     newQuota = m_uiClient.exceededDatabaseQuota(this, frame, origin.get(), databaseName, displayName, currentQuota, currentUsage, expectedUsage);
1877 }
1878
1879 void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference)
1880 {
1881     m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference);
1882 }
1883
1884 #if PLATFORM(MAC)
1885 void WebPageProxy::setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled)
1886 {
1887     m_pageClient->setComplexTextInputEnabled(pluginComplexTextInputIdentifier, complexTextInputEnabled);
1888 }
1889 #endif
1890
1891 } // namespace WebKit