dd0a356caeacd0a9c7e9ae97561d2b4ebfad2564
[WebKit-https.git] / Source / WebKit2 / WebProcess / WebCoreSupport / WebChromeClient.cpp
1 /*
2  * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24  * THE POSSIBILITY OF SUCH DAMAGE.
25  */
26
27 #include "config.h"
28 #include "WebChromeClient.h"
29
30 #include "DrawingArea.h"
31 #include "InjectedBundleNavigationAction.h"
32 #include "InjectedBundleUserMessageCoders.h"
33 #include "WebContextMenu.h"
34 #include "WebCoreArgumentCoders.h"
35 #include "WebFrame.h"
36 #include "WebFrameLoaderClient.h"
37 #include "WebOpenPanelParameters.h"
38 #include "WebOpenPanelResultListener.h"
39 #include "WebPage.h"
40 #include "WebPageCreationParameters.h"
41 #include "WebPageProxyMessages.h"
42 #include "WebPopupMenu.h"
43 #include "WebPreferencesStore.h"
44 #include "WebProcess.h"
45 #include "WebProcessProxyMessageKinds.h"
46 #include "WebSearchPopupMenu.h"
47 #include <WebCore/DatabaseTracker.h>
48 #include <WebCore/FileChooser.h>
49 #include <WebCore/Frame.h>
50 #include <WebCore/FrameLoader.h>
51 #include <WebCore/FrameView.h>
52 #include <WebCore/HTMLNames.h>
53 #include <WebCore/HTMLPlugInImageElement.h>
54 #include <WebCore/NotImplemented.h>
55 #include <WebCore/Page.h>
56 #include <WebCore/SecurityOrigin.h>
57
58 using namespace WebCore;
59 using namespace HTMLNames;
60
61 namespace WebKit {
62
63 static double area(WebFrame* frame)
64 {
65     IntSize size = frame->visibleContentBoundsExcludingScrollbars().size();
66     return static_cast<double>(size.height()) * size.width();
67 }
68
69
70 static WebFrame* findLargestFrameInFrameSet(WebPage* page)
71 {
72     // Approximate what a user could consider a default target frame for application menu operations.
73
74     WebFrame* mainFrame = page->mainFrame();
75     if (!mainFrame->isFrameSet())
76         return 0;
77
78     WebFrame* largestSoFar = 0;
79
80     RefPtr<ImmutableArray> frameChildren = mainFrame->childFrames();
81     size_t count = frameChildren->size();
82     for (size_t i = 0; i < count; ++i) {
83         WebFrame* childFrame = frameChildren->at<WebFrame>(i);
84         if (!largestSoFar || area(childFrame) > area(largestSoFar))
85             largestSoFar = childFrame;
86     }
87
88     return largestSoFar;
89 }
90
91 void WebChromeClient::chromeDestroyed()
92 {
93     delete this;
94 }
95
96 void WebChromeClient::setWindowRect(const FloatRect& windowFrame)
97 {
98     m_page->send(Messages::WebPageProxy::SetWindowFrame(windowFrame));
99 }
100
101 FloatRect WebChromeClient::windowRect()
102 {
103     FloatRect newWindowFrame;
104
105     if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetWindowFrame(), Messages::WebPageProxy::GetWindowFrame::Reply(newWindowFrame), m_page->pageID()))
106         return FloatRect();
107
108     return newWindowFrame;
109 }
110
111 FloatRect WebChromeClient::pageRect()
112 {
113     return FloatRect(FloatPoint(), m_page->size());
114 }
115
116 float WebChromeClient::scaleFactor()
117 {
118     notImplemented();
119     return 1.0;
120 }
121
122 void WebChromeClient::focus()
123 {
124     notImplemented();
125 }
126
127 void WebChromeClient::unfocus()
128 {
129     notImplemented();
130 }
131
132 bool WebChromeClient::canTakeFocus(FocusDirection)
133 {
134     notImplemented();
135     return true;
136 }
137
138 void WebChromeClient::takeFocus(FocusDirection direction)
139 {
140     m_page->send(Messages::WebPageProxy::TakeFocus(direction == FocusDirectionForward ? true : false));
141 }
142
143 void WebChromeClient::focusedNodeChanged(Node*)
144 {
145     notImplemented();
146 }
147
148 void WebChromeClient::focusedFrameChanged(Frame* frame)
149 {
150     WebFrame* webFrame = frame ? static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame() : 0;
151
152     WebProcess::shared().connection()->send(Messages::WebPageProxy::FocusedFrameChanged(webFrame ? webFrame->frameID() : 0), m_page->pageID());
153 }
154
155 Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& windowFeatures, const NavigationAction& navigationAction)
156 {
157     uint32_t modifiers = static_cast<uint32_t>(InjectedBundleNavigationAction::modifiersForNavigationAction(navigationAction));
158     int32_t mouseButton = static_cast<int32_t>(InjectedBundleNavigationAction::mouseButtonForNavigationAction(navigationAction));
159
160     uint64_t newPageID = 0;
161     WebPageCreationParameters parameters;
162     if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::CreateNewPage(windowFeatures, modifiers, mouseButton), Messages::WebPageProxy::CreateNewPage::Reply(newPageID, parameters), m_page->pageID()))
163         return 0;
164
165     if (!newPageID)
166         return 0;
167
168     WebProcess::shared().createWebPage(newPageID, parameters);
169     return WebProcess::shared().webPage(newPageID)->corePage();
170 }
171
172 void WebChromeClient::show()
173 {
174     m_page->show();
175 }
176
177 bool WebChromeClient::canRunModal()
178 {
179     return m_page->canRunModal();
180 }
181
182 void WebChromeClient::runModal()
183 {
184     m_page->runModal();
185 }
186
187 void WebChromeClient::setToolbarsVisible(bool toolbarsAreVisible)
188 {
189     m_page->send(Messages::WebPageProxy::SetToolbarsAreVisible(toolbarsAreVisible));
190 }
191
192 bool WebChromeClient::toolbarsVisible()
193 {
194     bool toolbarsAreVisible = true;
195     if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetToolbarsAreVisible(), Messages::WebPageProxy::GetToolbarsAreVisible::Reply(toolbarsAreVisible), m_page->pageID()))
196         return true;
197
198     return toolbarsAreVisible;
199 }
200
201 void WebChromeClient::setStatusbarVisible(bool statusBarIsVisible)
202 {
203     m_page->send(Messages::WebPageProxy::SetStatusBarIsVisible(statusBarIsVisible));
204 }
205
206 bool WebChromeClient::statusbarVisible()
207 {
208     bool statusBarIsVisible = true;
209     if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetStatusBarIsVisible(), Messages::WebPageProxy::GetStatusBarIsVisible::Reply(statusBarIsVisible), m_page->pageID()))
210         return true;
211
212     return statusBarIsVisible;
213 }
214
215 void WebChromeClient::setScrollbarsVisible(bool)
216 {
217     notImplemented();
218 }
219
220 bool WebChromeClient::scrollbarsVisible()
221 {
222     notImplemented();
223     return true;
224 }
225
226 void WebChromeClient::setMenubarVisible(bool menuBarVisible)
227 {
228     m_page->send(Messages::WebPageProxy::SetMenuBarIsVisible(menuBarVisible));
229 }
230
231 bool WebChromeClient::menubarVisible()
232 {
233     bool menuBarIsVisible = true;
234     if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::GetMenuBarIsVisible(), Messages::WebPageProxy::GetMenuBarIsVisible::Reply(menuBarIsVisible), m_page->pageID()))
235         return true;
236
237     return menuBarIsVisible;
238 }
239
240 void WebChromeClient::setResizable(bool resizable)
241 {
242     m_page->send(Messages::WebPageProxy::SetIsResizable(resizable));
243 }
244
245 void WebChromeClient::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID)
246 {
247     // Notify the bundle client.
248     m_page->injectedBundleUIClient().willAddMessageToConsole(m_page, message, lineNumber);
249
250     notImplemented();
251 }
252
253 bool WebChromeClient::canRunBeforeUnloadConfirmPanel()
254 {
255     return m_page->canRunBeforeUnloadConfirmPanel();
256 }
257
258 bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
259 {
260     WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
261
262     bool shouldClose = false;
263     if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunBeforeUnloadConfirmPanel(message, webFrame->frameID()), Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::Reply(shouldClose), m_page->pageID()))
264         return false;
265
266     return shouldClose;
267 }
268
269 void WebChromeClient::closeWindowSoon()
270 {
271     // FIXME: This code assumes that the client will respond to a close page
272     // message by actually closing the page. Safari does this, but there is
273     // no guarantee that other applications will, which will leave this page
274     // half detached. This approach is an inherent limitation making parts of
275     // a close execute synchronously as part of window.close, but other parts
276     // later on.
277
278     m_page->corePage()->setGroupName(String());
279
280     if (WebFrame* frame = m_page->mainFrame()) {
281         if (Frame* coreFrame = frame->coreFrame())
282             coreFrame->loader()->stopForUserCancel();
283     }
284
285     m_page->sendClose();
286 }
287
288 void WebChromeClient::runJavaScriptAlert(Frame* frame, const String& alertText)
289 {
290     WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
291
292     // Notify the bundle client.
293     m_page->injectedBundleUIClient().willRunJavaScriptAlert(m_page, alertText, webFrame);
294
295     WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page->pageID());
296 }
297
298 bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
299 {
300     WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
301
302     // Notify the bundle client.
303     m_page->injectedBundleUIClient().willRunJavaScriptConfirm(m_page, message, webFrame);
304
305     bool result = false;
306     if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page->pageID()))
307         return false;
308
309     return result;
310 }
311
312 bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
313 {
314     WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
315
316     // Notify the bundle client.
317     m_page->injectedBundleUIClient().willRunJavaScriptPrompt(m_page, message, defaultValue, webFrame);
318
319     if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page->pageID()))
320         return false;
321
322     return !result.isNull();
323 }
324
325 void WebChromeClient::setStatusbarText(const String& statusbarText)
326 {
327     // Notify the bundle client.
328     m_page->injectedBundleUIClient().willSetStatusbarText(m_page, statusbarText);
329
330     m_page->send(Messages::WebPageProxy::SetStatusText(statusbarText));
331 }
332
333 bool WebChromeClient::shouldInterruptJavaScript()
334 {
335     notImplemented();
336     return false;
337 }
338
339 KeyboardUIMode WebChromeClient::keyboardUIMode()
340 {
341     return m_page->keyboardUIMode();
342 }
343
344 IntRect WebChromeClient::windowResizerRect() const
345 {
346     return m_page->windowResizerRect();
347 }
348
349 void WebChromeClient::invalidateWindow(const IntRect&, bool)
350 {
351     // Do nothing here, there's no concept of invalidating the window in the web process.
352 }
353
354 void WebChromeClient::invalidateContentsAndWindow(const IntRect& rect, bool)
355 {
356     if (m_page->corePage()->mainFrame()->document()->printing())
357         return;
358     m_page->drawingArea()->setNeedsDisplay(rect);
359 }
360
361 void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect, bool)
362 {
363     if (m_page->corePage()->mainFrame()->document()->printing())
364         return;
365     m_page->pageDidScroll();
366     m_page->drawingArea()->setNeedsDisplay(rect);
367 }
368
369 void WebChromeClient::scroll(const IntSize& scrollOffset, const IntRect& scrollRect, const IntRect& clipRect)
370 {
371     m_page->pageDidScroll();
372     m_page->drawingArea()->scroll(intersection(scrollRect, clipRect), scrollOffset);
373 }
374
375 #if ENABLE(TILED_BACKING_STORE)
376 void WebChromeClient::delegatedScrollRequested(const IntSize& scrollOffset)
377 {
378     m_page->pageDidRequestScroll(scrollOffset);
379 }
380 #endif
381
382 IntPoint WebChromeClient::screenToWindow(const IntPoint&) const
383 {
384     notImplemented();
385     return IntPoint();
386 }
387
388 IntRect WebChromeClient::windowToScreen(const IntRect& rect) const
389 {
390     return m_page->windowToScreen(rect);
391 }
392
393 PlatformPageClient WebChromeClient::platformPageClient() const
394 {
395     notImplemented();
396     return 0;
397 }
398
399 void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
400 {
401 #if PLATFORM(QT)
402 #if ENABLE(TILED_BACKING_STORE)
403     if (frame->page()->mainFrame() == frame)
404         m_page->resizeToContentsIfNeeded();
405 #endif
406
407     WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
408
409     if (!m_page->mainFrame() || m_page->mainFrame() != webFrame)
410         return;
411
412     m_page->send(Messages::WebPageProxy::DidChangeContentsSize(size));
413 #endif
414
415     WebFrame* largestFrame = findLargestFrameInFrameSet(m_page);
416     if (largestFrame != m_cachedFrameSetLargestFrame.get()) {
417         m_cachedFrameSetLargestFrame = largestFrame;
418         m_page->send(Messages::WebPageProxy::FrameSetLargestFrameChanged(largestFrame ? largestFrame->frameID() : 0));
419     }
420
421     if (frame->page()->mainFrame() != frame)
422         return;
423     FrameView* frameView = frame->view();
424     if (!frameView)
425         return;
426
427     bool hasHorizontalScrollbar = frameView->horizontalScrollbar();
428     bool hasVerticalScrollbar = frameView->verticalScrollbar();
429
430     if (hasHorizontalScrollbar != m_cachedMainFrameHasHorizontalScrollbar || hasVerticalScrollbar != m_cachedMainFrameHasVerticalScrollbar) {
431         m_page->send(Messages::WebPageProxy::DidChangeScrollbarsForMainFrame(hasHorizontalScrollbar, hasVerticalScrollbar));
432         
433         m_cachedMainFrameHasHorizontalScrollbar = hasHorizontalScrollbar;
434         m_cachedMainFrameHasVerticalScrollbar = hasVerticalScrollbar;
435     }
436 }
437
438 void WebChromeClient::scrollRectIntoView(const IntRect&, const ScrollView*) const
439 {
440     notImplemented();
441 }
442
443 bool WebChromeClient::shouldMissingPluginMessageBeButton() const
444 {
445     // FIXME: <rdar://problem/8794397> We should only return true when there is a 
446     // missingPluginButtonClicked callback defined on the Page UI client.
447     return true;
448 }
449     
450 void WebChromeClient::missingPluginButtonClicked(Element* element) const
451 {
452     ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag));
453
454     HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element);
455
456     m_page->send(Messages::WebPageProxy::MissingPluginButtonClicked(pluginElement->serviceType(), pluginElement->url(), pluginElement->getAttribute(pluginspageAttr)));
457 }
458
459 void WebChromeClient::scrollbarsModeDidChange() const
460 {
461     notImplemented();
462 }
463
464 void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& hitTestResult, unsigned modifierFlags)
465 {
466     RefPtr<APIObject> userData;
467
468     // Notify the bundle client.
469     m_page->injectedBundleUIClient().mouseDidMoveOverElement(m_page, hitTestResult, static_cast<WebEvent::Modifiers>(modifierFlags), userData);
470
471     // Notify the UIProcess.
472     m_page->send(Messages::WebPageProxy::MouseDidMoveOverElement(modifierFlags, InjectedBundleUserMessageEncoder(userData.get())));
473 }
474
475 void WebChromeClient::setToolTip(const String& toolTip, TextDirection)
476 {
477     // Only send a tool tip to the WebProcess if it has changed since the last time this function was called.
478
479     if (toolTip == m_cachedToolTip)
480         return;
481     m_cachedToolTip = toolTip;
482
483     m_page->send(Messages::WebPageProxy::SetToolTip(m_cachedToolTip));
484 }
485
486 void WebChromeClient::print(Frame* frame)
487 {
488     WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
489     m_page->sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID()), Messages::WebPageProxy::PrintFrame::Reply());
490 }
491
492 #if ENABLE(DATABASE)
493 void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
494 {
495     WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
496     SecurityOrigin* origin = frame->document()->securityOrigin();
497
498     DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(databaseName, origin);
499     uint64_t currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin);
500     uint64_t newQuota = 0;
501     WebProcess::shared().connection()->sendSync(
502         Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, details.currentUsage(), details.expectedUsage()),
503         Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID());
504
505     DatabaseTracker::tracker().setQuota(origin, newQuota);
506 }
507 #endif
508
509
510 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
511 void WebChromeClient::reachedMaxAppCacheSize(int64_t)
512 {
513     notImplemented();
514 }
515
516 void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*)
517 {
518     notImplemented();
519 }
520 #endif
521
522 #if ENABLE(DASHBOARD_SUPPORT)
523 void WebChromeClient::dashboardRegionsChanged()
524 {
525     notImplemented();
526 }
527 #endif
528
529 void WebChromeClient::populateVisitedLinks()
530 {
531 }
532
533 FloatRect WebChromeClient::customHighlightRect(Node*, const AtomicString& type, const FloatRect& lineRect)
534 {
535     notImplemented();
536     return FloatRect();
537 }
538
539 void WebChromeClient::paintCustomHighlight(Node*, const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect,
540                                   bool behindText, bool entireLine)
541 {
542     notImplemented();
543 }
544
545 bool WebChromeClient::shouldReplaceWithGeneratedFileForUpload(const String& path, String& generatedFilename)
546 {
547     notImplemented();
548     return false;
549 }
550
551 String WebChromeClient::generateReplacementFile(const String& path)
552 {
553     notImplemented();
554     return String();
555 }
556
557 bool WebChromeClient::paintCustomScrollbar(GraphicsContext*, const FloatRect&, ScrollbarControlSize, 
558                                            ScrollbarControlState, ScrollbarPart pressedPart, bool vertical,
559                                            float value, float proportion, ScrollbarControlPartMask)
560 {
561     notImplemented();
562     return false;
563 }
564
565 bool WebChromeClient::paintCustomScrollCorner(GraphicsContext*, const FloatRect&)
566 {
567     notImplemented();
568     return false;
569 }
570
571 bool WebChromeClient::paintCustomOverhangArea(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect)
572 {
573     if (!m_page->injectedBundleUIClient().shouldPaintCustomOverhangArea())
574         return false;
575
576     m_page->injectedBundleUIClient().paintCustomOverhangArea(m_page, context, horizontalOverhangArea, verticalOverhangArea, dirtyRect);
577     return true;
578 }
579
580 void WebChromeClient::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
581 {
582     notImplemented();
583 }
584
585 void WebChromeClient::cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*)
586 {
587     notImplemented();
588 }
589
590 void WebChromeClient::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser)
591 {
592     if (m_page->activeOpenPanelResultListener())
593         return;
594
595     RefPtr<FileChooser> fileChooser = prpFileChooser;
596
597     m_page->setActiveOpenPanelResultListener(WebOpenPanelResultListener::create(m_page, fileChooser.get()));
598     
599     WebOpenPanelParameters::Data parameters;
600     parameters.allowMultipleFiles = fileChooser->allowsMultipleFiles();
601 #if ENABLE(DIRECTORY_UPLOAD)
602     parameters.allowsDirectoryUpload = fileChooser->allowsDirectoryUpload();
603 #else
604     parameters.allowsDirectoryUpload = false;
605 #endif
606     parameters.acceptTypes = fileChooser->acceptTypes();
607     parameters.filenames = fileChooser->filenames();
608
609     m_page->send(Messages::WebPageProxy::RunOpenPanel(static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->frameID(), parameters));
610 }
611
612 void WebChromeClient::chooseIconForFiles(const Vector<String>&, FileChooser*)
613 {
614     notImplemented();
615 }
616
617 void WebChromeClient::setCursor(const WebCore::Cursor& cursor)
618 {
619 #if USE(LAZY_NATIVE_CURSOR)
620     m_page->send(Messages::WebPageProxy::SetCursor(cursor));
621 #endif
622 }
623
624 void WebChromeClient::formStateDidChange(const Node*)
625 {
626     notImplemented();
627 }
628
629 void WebChromeClient::formDidFocus(const Node*)
630
631     notImplemented();
632 }
633
634 void WebChromeClient::formDidBlur(const Node*)
635 {
636     notImplemented();
637 }
638
639 bool WebChromeClient::selectItemWritingDirectionIsNatural()
640 {
641     return false;
642 }
643
644 bool WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection()
645 {
646     return true;
647 }
648
649 PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
650 {
651     return WebPopupMenu::create(m_page, client);
652 }
653
654 PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const
655 {
656     return WebSearchPopupMenu::create(m_page, client);
657 }
658
659 #if ENABLE(CONTEXT_MENUS)
660 void WebChromeClient::showContextMenu()
661 {
662     m_page->contextMenu()->show();
663 }
664 #endif
665
666 #if USE(ACCELERATED_COMPOSITING)
667 void WebChromeClient::attachRootGraphicsLayer(Frame*, GraphicsLayer* layer)
668 {
669     if (layer)
670         m_page->enterAcceleratedCompositingMode(layer);
671     else
672         m_page->exitAcceleratedCompositingMode();
673 }
674
675 void WebChromeClient::setNeedsOneShotDrawingSynchronization()
676 {
677     notImplemented();
678 }
679
680 void WebChromeClient::scheduleCompositingLayerSync()
681 {
682     if (m_page->drawingArea())
683         m_page->drawingArea()->scheduleCompositingLayerSync();
684 }
685
686 #endif
687
688 #if ENABLE(NOTIFICATIONS)
689 WebCore::NotificationPresenter* WebChromeClient::notificationPresenter() const
690 {
691     return 0;
692 }
693 #endif
694
695 #if ENABLE(TOUCH_EVENTS)
696 void WebChromeClient::needTouchEvents(bool)
697 {
698 }
699 #endif
700
701 #if PLATFORM(WIN)
702 void WebChromeClient::setLastSetCursorToCurrentCursor()
703 {
704 }
705 #endif
706
707 void WebChromeClient::dispatchViewportDataDidChange(const ViewportArguments& args) const
708 {
709     m_page->send(Messages::WebPageProxy::DidChangeViewportData(args));
710 }
711
712 void WebChromeClient::didCompleteRubberBandForMainFrame(const IntSize& initialOverhang) const
713 {
714     m_page->send(Messages::WebPageProxy::DidCompleteRubberBandForMainFrame(initialOverhang));
715 }
716
717 } // namespace WebKit