45818295a9bfc9f43d9a2b19757a0020dce89758
[WebKit.git] / WebKit2 / WebProcess / WebCoreSupport / WebFrameLoaderClient.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 "WebFrameLoaderClient.h"
27
28 #include "NotImplemented.h"
29 #include "WebCoreTypeArgumentMarshalling.h"
30 #include "WebErrors.h"
31 #include "WebFrame.h"
32 #include "WebNavigationDataStore.h"
33 #include "WebPage.h"
34 #include "WebPageProxyMessageKinds.h"
35 #include "WebProcess.h"
36 #include <JavaScriptCore/APICast.h>
37 #include <JavaScriptCore/JSObject.h>
38 #include <WebCore/Chrome.h>
39 #include <WebCore/DOMWrapperWorld.h>
40 #include <WebCore/DocumentLoader.h>
41 #include <WebCore/FormState.h>
42 #include <WebCore/Frame.h>
43 #include <WebCore/FrameLoadRequest.h>
44 #include <WebCore/FrameView.h>
45 #include <WebCore/HTMLFormElement.h>
46 #include <WebCore/Page.h>
47 #include <WebCore/ProgressTracker.h>
48 #include <WebCore/ResourceError.h>
49 #include <WebCore/Widget.h>
50 #include <WebCore/WindowFeatures.h>
51
52 using namespace WebCore;
53
54 namespace WebKit {
55
56 void WebFrameLoaderClient::frameLoaderDestroyed()
57 {
58     m_frame->invalidate();
59
60     // Balances explicit ref() in WebFrame::createMainFrame and WebFrame::createSubframe.
61     m_frame->deref();
62 }
63
64 bool WebFrameLoaderClient::hasHTMLView() const
65 {
66     return true;
67 }
68
69 bool WebFrameLoaderClient::hasWebView() const
70 {
71     return m_frame->page();
72 }
73
74 void WebFrameLoaderClient::makeRepresentation(DocumentLoader*)
75 {
76     notImplemented();
77 }
78
79 void WebFrameLoaderClient::forceLayout()
80 {
81     notImplemented();
82 }
83
84 void WebFrameLoaderClient::forceLayoutForNonHTML()
85 {
86     notImplemented();
87 }
88
89 void WebFrameLoaderClient::setCopiesOnScroll()
90 {
91     notImplemented();
92 }
93
94 void WebFrameLoaderClient::detachedFromParent2()
95 {
96     notImplemented();
97 }
98
99 void WebFrameLoaderClient::detachedFromParent3()
100 {
101     notImplemented();
102 }
103
104 void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&)
105 {
106     notImplemented();
107 }
108
109
110 void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse)
111 {
112     notImplemented();
113 }
114
115 bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier)
116 {
117     notImplemented();
118     return false;
119 }
120
121 void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)
122 {
123     notImplemented();
124 }
125
126 void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)    
127 {
128     notImplemented();
129 }
130
131 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
132 bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long identifier, const ProtectionSpace&)
133 {
134     notImplemented();
135     return false;
136 }
137 #endif
138
139 void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&)
140 {
141     notImplemented();
142 }
143
144 void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived)
145 {
146     notImplemented();
147 }
148
149 void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier)
150 {
151     notImplemented();
152 }
153
154 void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&)
155 {
156     notImplemented();
157 }
158
159 bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length)
160 {
161     notImplemented();
162     return false;
163 }
164
165 void WebFrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const ScriptString&)
166 {
167     notImplemented();
168 }
169
170 void WebFrameLoaderClient::dispatchDidHandleOnloadEvents()
171 {
172     notImplemented();
173 }
174
175 void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
176 {
177     WebPage* webPage = m_frame->page();
178     if (!webPage)
179         return;
180
181     WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveServerRedirectForProvisionalLoadForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID()));
182 }
183
184 void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
185 {
186     notImplemented();
187 }
188
189 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate)
190 {
191     notImplemented();
192 }
193
194 void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage()
195 {
196     notImplemented();
197 }
198
199 void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
200 {
201     notImplemented();
202 }
203
204 void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
205 {
206     notImplemented();
207 }
208
209 void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
210 {
211     notImplemented();
212 }
213
214 void WebFrameLoaderClient::dispatchWillClose()
215 {
216     notImplemented();
217 }
218
219 void WebFrameLoaderClient::dispatchDidReceiveIcon()
220 {
221     notImplemented();
222 }
223
224 void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()
225 {
226     WebPage* webPage = m_frame->page();
227     if (!webPage)
228         return;
229
230     DocumentLoader* provisionalLoader = m_frame->coreFrame()->loader()->provisionalDocumentLoader();
231     const String& url = provisionalLoader->url().string();
232
233     WebProcess::shared().connection()->send(WebPageProxyMessage::DidStartProvisionalLoadForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID(), url));
234 }
235
236 void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title)
237 {
238     WebPage* webPage = m_frame->page();
239     if (!webPage)
240         return;
241
242     WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveTitleForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID(), title));
243 }
244
245 void WebFrameLoaderClient::dispatchDidChangeIcons()
246 {
247     notImplemented();
248 }
249
250 void WebFrameLoaderClient::dispatchDidCommitLoad()
251 {
252     WebPage* webPage = m_frame->page();
253     if (!webPage)
254         return;
255
256     WebProcess::shared().connection()->send(WebPageProxyMessage::DidCommitLoadForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID()));
257 }
258
259 void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError&)
260 {
261     WebPage* webPage = m_frame->page();
262     if (!webPage)
263         return;
264
265     WebProcess::shared().connection()->send(WebPageProxyMessage::DidFailProvisionalLoadForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID()));
266 }
267
268 void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError&)
269 {
270     WebPage* webPage = m_frame->page();
271     if (!webPage)
272         return;
273
274     WebProcess::shared().connection()->send(WebPageProxyMessage::DidFailLoadForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID()));
275 }
276
277 void WebFrameLoaderClient::dispatchDidFinishDocumentLoad()
278 {
279     notImplemented();
280 }
281
282 void WebFrameLoaderClient::dispatchDidFinishLoad()
283 {
284     WebPage* webPage = m_frame->page();
285     if (!webPage)
286         return;
287
288     WebProcess::shared().connection()->send(WebPageProxyMessage::DidFinishLoadForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID()));
289 }
290
291 void WebFrameLoaderClient::dispatchDidFirstLayout()
292 {
293     WebPage* webPage = m_frame->page();
294     if (!webPage)
295         return;
296
297     WebProcess::shared().connection()->send(WebPageProxyMessage::DidFirstLayoutForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID()));
298 }
299
300 void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
301 {
302     WebPage* webPage = m_frame->page();
303     if (!webPage)
304         return;
305
306     WebProcess::shared().connection()->send(WebPageProxyMessage::DidFirstVisuallyNonEmptyLayoutForFrame, webPage->pageID(), CoreIPC::In(m_frame->frameID()));
307 }
308
309 Frame* WebFrameLoaderClient::dispatchCreatePage()
310 {
311     WebPage* webPage = m_frame->page();
312     if (!webPage)
313         return 0;
314
315     // Just call through to the chrome client.
316     Page* newPage = webPage->corePage()->chrome()->createWindow(m_frame->coreFrame(), FrameLoadRequest(), WindowFeatures());
317     if (!newPage)
318         return 0;
319     
320     return newPage->mainFrame();
321 }
322
323 void WebFrameLoaderClient::dispatchShow()
324 {
325     WebPage* webPage = m_frame->page();
326     if (!webPage)
327         return;
328
329     webPage->show();
330 }
331
332 void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& MIMEType, const ResourceRequest& request)
333 {
334     WebPage* webPage = m_frame->page();
335     if (!webPage)
336         return;
337
338     uint64_t listenerID = m_frame->setUpPolicyListener(function);
339     const String& url = request.url().string(); // FIXME: Pass entire request.
340
341     WebProcess::shared().connection()->send(WebPageProxyMessage::DecidePolicyForMIMEType, webPage->pageID(),
342                                             CoreIPC::In(m_frame->frameID(), MIMEType, url, listenerID));
343 }
344
345 void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState>, const String& frameName)
346 {
347     WebPage* webPage = m_frame->page();
348     if (!webPage)
349         return;
350
351     uint64_t listenerID = m_frame->setUpPolicyListener(function);
352
353     // FIXME: Pass more than just the navigation action type.
354     // FIXME: Pass the frame name.
355     const String& url = request.url().string(); // FIXME: Pass entire request.
356
357     WebProcess::shared().connection()->send(WebPageProxyMessage::DecidePolicyForNewWindowAction, webPage->pageID(),
358                                             CoreIPC::In(m_frame->frameID(), (uint32_t)navigationAction.type(), url, listenerID));
359 }
360
361 void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& navigationAction, const ResourceRequest& request, PassRefPtr<FormState>)
362 {
363     WebPage* webPage = m_frame->page();
364     if (!webPage)
365         return;
366
367     uint64_t listenerID = m_frame->setUpPolicyListener(function);
368
369     // FIXME: Pass more than just the navigation action type.
370     const String& url = request.url().string(); // FIXME: Pass entire request.
371
372     WebProcess::shared().connection()->send(WebPageProxyMessage::DecidePolicyForNavigationAction, webPage->pageID(),
373                                             CoreIPC::In(m_frame->frameID(), (uint32_t)navigationAction.type(), url, listenerID));
374 }
375
376 void WebFrameLoaderClient::cancelPolicyCheck()
377 {
378     m_frame->invalidatePolicyListener();
379 }
380
381 void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&)
382 {
383     notImplemented();
384 }
385
386 void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>)
387 {
388     notImplemented();
389
390     Frame* coreFrame = m_frame->coreFrame();
391     (coreFrame->loader()->policyChecker()->*function)(PolicyUse);
392 }
393
394 void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*)
395 {
396     notImplemented();
397 }
398
399 void WebFrameLoaderClient::revertToProvisionalState(DocumentLoader*)
400 {
401     notImplemented();
402 }
403
404 void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError&)
405 {
406     notImplemented();
407 }
408
409 void WebFrameLoaderClient::willChangeEstimatedProgress()
410 {
411     notImplemented();
412 }
413
414 void WebFrameLoaderClient::didChangeEstimatedProgress()
415 {
416     notImplemented();
417 }
418
419 void WebFrameLoaderClient::postProgressStartedNotification()
420 {
421     if (WebPage* webPage = m_frame->page())
422         WebProcess::shared().connection()->send(WebPageProxyMessage::DidStartProgress, webPage->pageID(), CoreIPC::In());
423 }
424
425 void WebFrameLoaderClient::postProgressEstimateChangedNotification()
426 {
427     if (WebPage* webPage = m_frame->page()) {
428         double progress = webPage->corePage()->progress()->estimatedProgress();
429         WebProcess::shared().connection()->send(WebPageProxyMessage::DidChangeProgress, webPage->pageID(), CoreIPC::In(progress));
430     }
431 }
432
433 void WebFrameLoaderClient::postProgressFinishedNotification()
434 {
435     if (WebPage* webPage = m_frame->page())
436         WebProcess::shared().connection()->send(WebPageProxyMessage::DidFinishProgress, webPage->pageID(), CoreIPC::In());
437 }
438
439 void WebFrameLoaderClient::setMainFrameDocumentReady(bool)
440 {
441     notImplemented();
442 }
443
444 void WebFrameLoaderClient::startDownload(const ResourceRequest&)
445 {
446     notImplemented();
447 }
448
449 void WebFrameLoaderClient::willChangeTitle(DocumentLoader*)
450 {
451     notImplemented();
452 }
453
454 void WebFrameLoaderClient::didChangeTitle(DocumentLoader*)
455 {
456     notImplemented();
457 }
458
459 void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length)
460 {
461     const String& textEncoding = loader->response().textEncodingName();
462     
463     receivedData(data, length, textEncoding);
464 }
465
466 void WebFrameLoaderClient::receivedData(const char* data, int length, const String& textEncoding)
467 {
468     Frame* coreFrame = m_frame->coreFrame();
469     if (!coreFrame)
470         return;
471     
472     // Set the encoding. This only needs to be done once, but it's harmless to do it again later.
473     String encoding = coreFrame->loader()->documentLoader()->overrideEncoding();
474     bool userChosen = !encoding.isNull();
475     if (encoding.isNull())
476         encoding = textEncoding;
477     coreFrame->loader()->writer()->setEncoding(encoding, userChosen);
478     
479     coreFrame->loader()->addData(data, length);
480 }
481
482 void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
483 {
484     committedLoad(loader, 0, 0);
485 }
486
487 void WebFrameLoaderClient::updateGlobalHistory()
488 {
489     WebPage* webPage = m_frame->page();
490     if (!webPage)
491         return;
492
493     DocumentLoader* loader = m_frame->coreFrame()->loader()->documentLoader();
494
495     WebNavigationDataStore data;
496     data.url = loader->urlForHistory().string();
497     data.title = loader->title();
498
499     WebProcess::shared().connection()->send(WebPageProxyMessage::DidNavigateWithNavigationData,
500                                             webPage->pageID(),
501                                             CoreIPC::In(data, m_frame->frameID()));
502 }
503
504 void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
505 {
506     WebPage* webPage = m_frame->page();
507     if (!webPage)
508         return;
509
510     DocumentLoader* loader = m_frame->coreFrame()->loader()->documentLoader();
511     ASSERT(loader->unreachableURL().isEmpty());
512
513     // Client redirect
514     if (!loader->clientRedirectSourceForHistory().isNull()) {
515         WebProcess::shared().connection()->send(WebPageProxyMessage::DidPerformClientRedirect,
516                                                 webPage->pageID(),
517                                                 CoreIPC::In(loader->clientRedirectSourceForHistory(), 
518                                                             loader->clientRedirectDestinationForHistory(),
519                                                             m_frame->frameID()));
520     }
521
522     // Server redirect
523     if (!loader->serverRedirectSourceForHistory().isNull()) {
524         WebProcess::shared().connection()->send(WebPageProxyMessage::DidPerformServerRedirect,
525                                                 webPage->pageID(),
526                                                 CoreIPC::In(loader->serverRedirectSourceForHistory(),
527                                                             loader->serverRedirectDestinationForHistory(),
528                                                             m_frame->frameID()));
529     }
530 }
531
532 bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const
533 {
534     notImplemented();
535     return true;
536 }
537
538 void WebFrameLoaderClient::dispatchDidAddBackForwardItem(HistoryItem*) const
539 {
540     if (WebPage* webPage = m_frame->page())
541         webPage->backForwardListDidChange();
542 }
543
544 void WebFrameLoaderClient::dispatchDidRemoveBackForwardItem(HistoryItem*) const
545 {
546     if (WebPage* webPage = m_frame->page())
547         webPage->backForwardListDidChange();
548 }
549
550 void WebFrameLoaderClient::dispatchDidChangeBackForwardIndex() const
551 {
552     if (WebPage* webPage = m_frame->page())
553         webPage->backForwardListDidChange();
554 }
555
556 void WebFrameLoaderClient::didDisplayInsecureContent()
557 {
558     notImplemented();
559 }
560
561 void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin*)
562 {
563     notImplemented();
564 }
565
566 ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request)
567 {
568     return WebKit::cancelledError(request);
569 }
570
571 ResourceError WebFrameLoaderClient::blockedError(const ResourceRequest& request)
572 {
573     return WebKit::blockedError(request);
574 }
575
576 ResourceError WebFrameLoaderClient::cannotShowURLError(const ResourceRequest& request)
577 {
578     return WebKit::cannotShowURLError(request);
579 }
580
581 ResourceError WebFrameLoaderClient::interruptForPolicyChangeError(const ResourceRequest& request)
582 {
583     return WebKit::interruptForPolicyChangeError(request);
584 }
585
586 ResourceError WebFrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse& response)
587 {
588     return WebKit::cannotShowMIMETypeError(response);
589 }
590
591 ResourceError WebFrameLoaderClient::fileDoesNotExistError(const ResourceResponse& response)
592 {
593     return WebKit::fileDoesNotExistError(response);
594 }
595
596 ResourceError WebFrameLoaderClient::pluginWillHandleLoadError(const ResourceResponse&)
597 {
598     notImplemented();
599     return ResourceError();
600 }
601
602 bool WebFrameLoaderClient::shouldFallBack(const ResourceError&)
603 {
604     notImplemented();
605     return false;
606 }
607
608 bool WebFrameLoaderClient::canHandleRequest(const ResourceRequest&) const
609 {
610     notImplemented();
611     return true;
612 }
613
614 bool WebFrameLoaderClient::canShowMIMEType(const String& MIMEType) const
615 {
616     notImplemented();
617     return true;
618 }
619
620 bool WebFrameLoaderClient::representationExistsForURLScheme(const String& URLScheme) const
621 {
622     notImplemented();
623     return false;
624 }
625
626 String WebFrameLoaderClient::generatedMIMETypeForURLScheme(const String& URLScheme) const
627 {
628     notImplemented();
629     return String();
630 }
631
632 void WebFrameLoaderClient::frameLoadCompleted()
633 {
634     notImplemented();
635 }
636
637 void WebFrameLoaderClient::saveViewStateToItem(HistoryItem*)
638 {
639     notImplemented();
640 }
641
642 void WebFrameLoaderClient::restoreViewState()
643 {
644     notImplemented();
645 }
646
647 void WebFrameLoaderClient::provisionalLoadStarted()
648 {
649     notImplemented();
650 }
651
652 void WebFrameLoaderClient::didFinishLoad()
653 {
654     notImplemented();
655 }
656
657 void WebFrameLoaderClient::prepareForDataSourceReplacement()
658 {
659     notImplemented();
660 }
661
662 PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& data)
663 {
664     return DocumentLoader::create(request, data);
665 }
666
667 void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
668 {
669     WebPage* webPage = m_frame->page();
670     if (!webPage)
671         return;
672
673     WebProcess::shared().connection()->send(WebPageProxyMessage::DidUpdateHistoryTitle, webPage->pageID(), CoreIPC::In(title, url.string(), m_frame->frameID()));
674 }
675
676 String WebFrameLoaderClient::userAgent(const KURL&)
677 {
678     notImplemented();
679     return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6; en-us) AppleWebKit/531.4 (KHTML, like Gecko) Version/4.0.3 Safari/531.4";
680 }
681
682 void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*)
683 {
684     notImplemented();
685 }
686
687 void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)
688 {
689     notImplemented();
690 }
691
692 void WebFrameLoaderClient::transitionToCommittedForNewPage()
693 {
694     m_frame->coreFrame()->createView(m_frame->page()->size(), Color::white, false, IntSize(), false);
695 }
696
697 bool WebFrameLoaderClient::canCachePage() const
698 {
699     notImplemented();
700     return false;
701 }
702
703 void WebFrameLoaderClient::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&)
704 {
705     notImplemented();
706 }
707
708 PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
709                                                     const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
710 {
711     WebPage* webPage = m_frame->page();
712
713     RefPtr<WebFrame> subframe = WebFrame::createSubframe(webPage, name, ownerElement);
714
715     // Notify the UI process that subframe has been added.
716     WebProcess::shared().connection()->send(WebPageProxyMessage::DidCreateSubFrame, webPage->pageID(), CoreIPC::In(subframe->frameID()));
717
718     Frame* coreSubframe = subframe->coreFrame();
719
720      // The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
721     m_frame->coreFrame()->loader()->loadURLIntoChildFrame(url, referrer, coreSubframe);
722
723     // The frame's onload handler may have removed it from the document.
724     if (!coreSubframe->tree()->parent())
725         return 0;
726
727     return coreSubframe;
728 }
729
730 void WebFrameLoaderClient::didTransferChildFrameToNewDocument()
731 {
732     notImplemented();
733 }    
734
735 PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually)
736 {
737     notImplemented();
738     return 0;
739 }
740
741 void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget)
742 {
743     notImplemented();
744 }
745
746 PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues)
747 {
748     notImplemented();
749     return 0;
750 }
751
752 ObjectContentType WebFrameLoaderClient::objectContentType(const KURL& url, const String& mimeType)
753 {
754     notImplemented();
755     return ObjectContentNone;
756 }
757
758 String WebFrameLoaderClient::overrideMediaType() const
759 {
760     notImplemented();
761     return String();
762 }
763
764 void WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
765 {
766     WebPage* webPage = m_frame->page();
767     if (!webPage)
768         return;
769
770     if (world != mainThreadNormalWorld())
771         return;
772
773     JSContextRef context = toRef(m_frame->coreFrame()->script()->globalObject(world)->globalExec());
774     JSObjectRef windowObject = toRef(m_frame->coreFrame()->script()->globalObject(world));
775
776     webPage->injectedBundleClient().didClearWindowObjectForFrame(webPage, m_frame, context, windowObject);
777 }
778
779 void WebFrameLoaderClient::documentElementAvailable()
780 {
781     notImplemented();
782 }
783
784 void WebFrameLoaderClient::didPerformFirstNavigation() const
785 {
786     notImplemented();
787 }
788
789 void WebFrameLoaderClient::registerForIconNotification(bool listen)
790 {
791     notImplemented();
792 }
793
794 #if PLATFORM(MAC)
795 #if ENABLE(MAC_JAVA_BRIDGE)
796 jobject WebFrameLoaderClient::javaApplet(NSView*) { return 0; }
797 #endif
798 NSCachedURLResponse* WebFrameLoaderClient::willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const
799 {
800     notImplemented();
801     return 0;
802 }
803
804 #endif
805 #if USE(CFNETWORK)
806 bool WebFrameLoaderClient::shouldCacheResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, const unsigned char* data, unsigned long long length)
807 {
808     notImplemented();
809     return false;
810 }
811
812 #endif
813
814 bool WebFrameLoaderClient::shouldUsePluginDocument(const String& /*mimeType*/) const
815 {
816     notImplemented();
817     return false;
818 }
819
820 } // namespace WebKit