1/*
2 * Copyright (C) 2006 Don Gibson <dgibson77@gmail.com>
3 * Copyright (C) 2006 Zack Rusin <zack@kde.org>
4 * Copyright (C) 2006, 2011 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Trolltech ASA
6 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> All rights reserved.
7 * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> All rights reserved.
8 *
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include "config.h"
33#include "FrameLoaderClientHaiku.h"
34
35#include "DocumentLoader.h"
36#include "Frame.h"
37#include "FrameLoader.h"
38#include "FrameTree.h"
39#include "FrameView.h"
40#include "HTMLFrameOwnerElement.h"
41#include "NotImplemented.h"
42#include "Page.h"
43#include "PlatformString.h"
44#include "ResourceRequest.h"
45#include "ScriptController.h"
46#include "WebView.h"
47
48#include <Message.h>
49#include <String.h>
50
51#include <app/Messenger.h>
52
53
54namespace WebCore {
55
56FrameLoaderClientHaiku::FrameLoaderClientHaiku()
57    : m_frame(0)
58{
59}
60
61void FrameLoaderClientHaiku::setFrame(Frame* frame)
62{
63    m_frame = frame;
64}
65
66void FrameLoaderClientHaiku::setWebView(WebView* webview)
67{
68    m_webView = webview;
69    m_messenger = new BMessenger(m_webView);
70    ASSERT(m_messenger->IsValid());
71}
72
73void FrameLoaderClientHaiku::detachFrameLoader()
74{
75    m_frame = 0;
76}
77
78bool FrameLoaderClientHaiku::hasWebView() const
79{
80    return m_webView;
81}
82
83bool FrameLoaderClientHaiku::hasBackForwardList() const
84{
85    notImplemented();
86    return true;
87}
88
89void FrameLoaderClientHaiku::resetBackForwardList()
90{
91    notImplemented();
92}
93
94bool FrameLoaderClientHaiku::provisionalItemIsTarget() const
95{
96    notImplemented();
97    return false;
98}
99
100void FrameLoaderClientHaiku::makeRepresentation(DocumentLoader*)
101{
102    notImplemented();
103}
104
105void FrameLoaderClientHaiku::forceLayout()
106{
107    notImplemented();
108}
109
110void FrameLoaderClientHaiku::forceLayoutForNonHTML()
111{
112    notImplemented();
113}
114
115void FrameLoaderClientHaiku::updateHistoryForCommit()
116{
117    notImplemented();
118}
119
120void FrameLoaderClientHaiku::updateHistoryForBackForwardNavigation()
121{
122    notImplemented();
123}
124
125void FrameLoaderClientHaiku::updateHistoryForReload()
126{
127    notImplemented();
128}
129
130void FrameLoaderClientHaiku::updateHistoryForStandardLoad()
131{
132    notImplemented();
133}
134
135void FrameLoaderClientHaiku::updateHistoryForInternalLoad()
136{
137    notImplemented();
138}
139
140void FrameLoaderClientHaiku::updateHistoryAfterClientRedirect()
141{
142    notImplemented();
143}
144
145void FrameLoaderClientHaiku::setCopiesOnScroll()
146{
147    // apparently mac specific
148    notImplemented();
149}
150
151LoadErrorResetToken* FrameLoaderClientHaiku::tokenForLoadErrorReset()
152{
153    notImplemented();
154    return 0;
155}
156
157void FrameLoaderClientHaiku::resetAfterLoadError(LoadErrorResetToken*)
158{
159    notImplemented();
160}
161
162void FrameLoaderClientHaiku::doNotResetAfterLoadError(LoadErrorResetToken*)
163{
164    notImplemented();
165}
166
167void FrameLoaderClientHaiku::willCloseDocument()
168{
169    notImplemented();
170}
171
172void FrameLoaderClientHaiku::detachedFromParent2()
173{
174    notImplemented();
175}
176
177void FrameLoaderClientHaiku::detachedFromParent3()
178{
179    notImplemented();
180}
181
182void FrameLoaderClientHaiku::dispatchDidHandleOnloadEvents()
183{
184    if (m_webView) {
185        BMessage message(LOAD_ONLOAD_HANDLE);
186        message.AddString("url", m_frame->loader()->documentLoader()->request().url().string());
187        m_messenger->SendMessage(&message);
188    }
189}
190
191void FrameLoaderClientHaiku::dispatchDidReceiveServerRedirectForProvisionalLoad()
192{
193    notImplemented();
194}
195
196void FrameLoaderClientHaiku::dispatchDidCancelClientRedirect()
197{
198    notImplemented();
199}
200
201void FrameLoaderClientHaiku::dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate)
202{
203    notImplemented();
204}
205
206void FrameLoaderClientHaiku::dispatchDidChangeLocationWithinPage()
207{
208    notImplemented();
209}
210
211void FrameLoaderClientHaiku::dispatchDidPushStateWithinPage()
212{
213    notImplemented();
214}
215
216void FrameLoaderClientHaiku::dispatchDidReplaceStateWithinPage()
217{
218    notImplemented();
219}
220
221void FrameLoaderClientHaiku::dispatchDidPopStateWithinPage()
222{
223    notImplemented();
224}
225
226void FrameLoaderClientHaiku::dispatchWillClose()
227{
228    notImplemented();
229}
230
231void FrameLoaderClientHaiku::dispatchDidStartProvisionalLoad()
232{
233    if (m_webView) {
234        BMessage message(LOAD_NEGOCIATING);
235        message.AddString("url", m_frame->loader()->provisionalDocumentLoader()->request().url().string());
236        m_messenger->SendMessage(&message);
237    }
238}
239
240void FrameLoaderClientHaiku::dispatchDidReceiveTitle(const StringWithTitle& title)
241{
242    if (m_webView) {
243        // FIXME: use direction of title.
244        m_webView->SetPageTitle(title.m_string());
245        BMessage message(TITLE_CHANGED);
246        message.AddString("title", title.string());
247        m_messenger->SendMessage(&message);
248    }
249}
250
251void FrameLoaderClientHaiku::dispatchDidCommitLoad()
252{
253    if (m_webView) {
254        BMessage message(LOAD_TRANSFERRING);
255        message.AddString("url", m_frame->loader()->documentLoader()->request().url().string());
256        m_messenger->SendMessage(&message);
257    }
258}
259
260void FrameLoaderClientHaiku::dispatchDidFinishDocumentLoad()
261{
262    if (m_webView) {
263        BMessage message(LOAD_DOC_COMPLETED);
264        message.AddString("url", m_frame->document()->url().string());
265        m_messenger->SendMessage(&message);
266    }
267}
268
269void FrameLoaderClientHaiku::dispatchDidFinishLoad()
270{
271    notImplemented();
272}
273
274void FrameLoaderClientHaiku::dispatchDidFirstLayout()
275{
276    notImplemented();
277}
278
279void FrameLoaderClientHaiku::dispatchDidFirstVisuallyNonEmptyLayout()
280{
281    notImplemented();
282}
283
284void FrameLoaderClientHaiku::dispatchShow()
285{
286    notImplemented();
287}
288
289void FrameLoaderClientHaiku::cancelPolicyCheck()
290{
291    notImplemented();
292}
293
294void FrameLoaderClientHaiku::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>)
295{
296    // FIXME: Send an event to allow for alerts and cancellation.
297    if (!m_frame)
298        return;
299    (m_frame->loader()->policyChecker()->*function)(PolicyUse);
300}
301
302void FrameLoaderClientHaiku::dispatchDidLoadMainResource(DocumentLoader*)
303{
304    notImplemented();
305}
306
307void FrameLoaderClientHaiku::revertToProvisionalState(DocumentLoader*)
308{
309    notImplemented();
310}
311
312void FrameLoaderClientHaiku::postProgressStartedNotification()
313{
314    notImplemented();
315}
316
317void FrameLoaderClientHaiku::postProgressEstimateChangedNotification()
318{
319    notImplemented();
320}
321
322void FrameLoaderClientHaiku::postProgressFinishedNotification()
323{
324    if (m_webView) {
325        BMessage message(LOAD_DL_COMPLETED);
326        message.AddString("url", m_frame->document()->url().string());
327        m_messenger->SendMessage(&message);
328    }
329}
330
331void FrameLoaderClientHaiku::progressStarted()
332{
333    notImplemented();
334}
335
336
337void FrameLoaderClientHaiku::progressCompleted()
338{
339    notImplemented();
340}
341
342
343void FrameLoaderClientHaiku::setMainFrameDocumentReady(bool)
344{
345    notImplemented();
346    // this is only interesting once we provide an external API for the DOM
347}
348
349void FrameLoaderClientHaiku::willChangeTitle(DocumentLoader*)
350{
351    notImplemented();
352}
353
354void FrameLoaderClientHaiku::didChangeTitle(DocumentLoader* docLoader)
355{
356    setTitle(docLoader->title(), docLoader->url());
357}
358
359void FrameLoaderClientHaiku::finishedLoading(DocumentLoader*)
360{
361    notImplemented();
362}
363
364bool FrameLoaderClientHaiku::canShowMIMETypeAsHTML(const String& MIMEType) const
365{
366    notImplemented();
367    return false;
368}
369
370bool FrameLoaderClientHaiku::canShowMIMEType(const String& MIMEType) const
371{
372    notImplemented();
373    return true;
374}
375
376bool FrameLoaderClientHaiku::representationExistsForURLScheme(const String& URLScheme) const
377{
378    notImplemented();
379    return false;
380}
381
382String FrameLoaderClientHaiku::generatedMIMETypeForURLScheme(const String& URLScheme) const
383{
384    notImplemented();
385    return String();
386}
387
388void FrameLoaderClientHaiku::frameLoadCompleted()
389{
390    if (m_webView->LockLooper()) {
391        m_webView->Draw(m_webView->Bounds());
392        m_webView->UnlockLooper();
393    }
394}
395
396void FrameLoaderClientHaiku::saveViewStateToItem(HistoryItem*)
397{
398    notImplemented();
399}
400
401void FrameLoaderClientHaiku::restoreViewState()
402{
403    notImplemented();
404}
405
406void FrameLoaderClientHaiku::restoreScrollPositionAndViewState()
407{
408    notImplemented();
409}
410
411void FrameLoaderClientHaiku::provisionalLoadStarted()
412{
413    notImplemented();
414}
415
416bool FrameLoaderClientHaiku::shouldTreatURLAsSameAsCurrent(const KURL&) const
417{
418    notImplemented();
419    return false;
420}
421
422void FrameLoaderClientHaiku::addHistoryItemForFragmentScroll()
423{
424    notImplemented();
425}
426
427void FrameLoaderClientHaiku::didFinishLoad()
428{
429    notImplemented();
430}
431
432void FrameLoaderClientHaiku::prepareForDataSourceReplacement()
433{
434    notImplemented();
435}
436
437void FrameLoaderClientHaiku::setTitle(const String& title, const KURL&)
438{
439    notImplemented();
440}
441
442String FrameLoaderClientHaiku::userAgent(const KURL&)
443{
444    return String("Mozilla/5.0 (compatible; U; InfiNet 0.1; Haiku) AppleWebKit/420+ (KHTML, like Gecko)");
445}
446
447void FrameLoaderClientHaiku::dispatchDidReceiveIcon()
448{
449    notImplemented();
450}
451
452void FrameLoaderClientHaiku::frameLoaderDestroyed()
453{
454    m_frame = 0;
455    m_messenger = 0;
456    delete this;
457}
458
459bool FrameLoaderClientHaiku::canHandleRequest(const WebCore::ResourceRequest&) const
460{
461    notImplemented();
462    return true;
463}
464
465void FrameLoaderClientHaiku::partClearedInBegin()
466{
467    notImplemented();
468}
469
470void FrameLoaderClientHaiku::updateGlobalHistory()
471{
472    notImplemented();
473}
474
475void FrameLoaderClientHaiku::updateGlobalHistoryRedirectLinks()
476{
477    notImplemented();
478}
479
480bool FrameLoaderClientHaiku::shouldGoToHistoryItem(WebCore::HistoryItem*) const
481{
482    notImplemented();
483    return true;
484}
485
486bool FrameLoaderClientHaiku::shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const
487{
488    return true;
489}
490
491void FrameLoaderClientHaiku::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
492{
493}
494
495void FrameLoaderClientHaiku::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
496{
497}
498
499void FrameLoaderClientHaiku::dispatchDidChangeBackForwardIndex() const
500{
501}
502
503void FrameLoaderClientHaiku::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*)
504{
505    notImplemented();
506}
507
508bool FrameLoaderClientHaiku::canCachePage() const
509{
510    return false;
511}
512
513void FrameLoaderClientHaiku::setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&)
514{
515    notImplemented();
516}
517
518void FrameLoaderClientHaiku::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
519{
520    loader->commitData(data, length);
521}
522
523WebCore::ResourceError FrameLoaderClientHaiku::cancelledError(const WebCore::ResourceRequest& request)
524{
525    notImplemented();
526    return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
527}
528
529WebCore::ResourceError FrameLoaderClientHaiku::blockedError(const ResourceRequest& request)
530{
531    notImplemented();
532    return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
533}
534
535WebCore::ResourceError FrameLoaderClientHaiku::cannotShowURLError(const WebCore::ResourceRequest& request)
536{
537    return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
538}
539
540WebCore::ResourceError FrameLoaderClientHaiku::interruptForPolicyChangeError(const WebCore::ResourceRequest& request)
541{
542    notImplemented();
543    return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String());
544}
545
546WebCore::ResourceError FrameLoaderClientHaiku::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
547{
548    notImplemented();
549    return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String());
550}
551
552WebCore::ResourceError FrameLoaderClientHaiku::fileDoesNotExistError(const WebCore::ResourceResponse& response)
553{
554    notImplemented();
555    return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String());
556}
557
558bool FrameLoaderClientHaiku::shouldFallBack(const WebCore::ResourceError& error)
559{
560    notImplemented();
561    return false;
562}
563
564WTF::PassRefPtr<DocumentLoader> FrameLoaderClientHaiku::createDocumentLoader(const ResourceRequest& request,
565                                                                             const SubstituteData& substituteData)
566{
567    return DocumentLoader::create(request, substituteData);
568}
569
570void FrameLoaderClientHaiku::download(ResourceHandle*, const ResourceRequest&,
571                                      const ResourceRequest&, const ResourceResponse&)
572{
573    notImplemented();
574}
575
576void FrameLoaderClientHaiku::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*,
577                                                              const ResourceRequest&)
578{
579    notImplemented();
580}
581
582void FrameLoaderClientHaiku::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest& request,
583                                                     const ResourceResponse& response)
584{
585    notImplemented();
586}
587
588bool FrameLoaderClientHaiku::shouldUseCredentialStorage(DocumentLoader*, unsigned long)
589{
590    notImplemented();
591    return false;
592}
593
594void FrameLoaderClientHaiku::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*,
595                                                                       unsigned long, const AuthenticationChallenge&)
596{
597    notImplemented();
598}
599
600void FrameLoaderClientHaiku::dispatchDidCancelAuthenticationChallenge(DocumentLoader*,
601                                                                      unsigned long, const AuthenticationChallenge&)
602{
603    notImplemented();
604}
605
606void FrameLoaderClientHaiku::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long id,
607                                                        const ResourceResponse& response)
608{
609    notImplemented();
610    m_response = response;
611    m_firstData = true;
612}
613
614void FrameLoaderClientHaiku::dispatchDidReceiveContentLength(DocumentLoader* loader,
615                                                             unsigned long id, int length)
616{
617    notImplemented();
618}
619
620void FrameLoaderClientHaiku::dispatchDidFinishLoading(DocumentLoader*, unsigned long)
621{
622    notImplemented();
623}
624
625void FrameLoaderClientHaiku::dispatchDidFailLoading(DocumentLoader* loader,
626                                                    unsigned long, const ResourceError&)
627{
628    if (m_webView) {
629        BMessage message(LOAD_FAILED);
630        message.AddString("url", m_frame->loader()->documentLoader()->request().url().string());
631        m_messenger->SendMessage(&message);
632    }
633}
634
635bool FrameLoaderClientHaiku::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*,
636                                                                    const ResourceRequest&,
637                                                                    const ResourceResponse&, int)
638{
639    notImplemented();
640    return false;
641}
642
643void FrameLoaderClientHaiku::dispatchDidFailProvisionalLoad(const ResourceError&)
644{
645    notImplemented();
646}
647
648void FrameLoaderClientHaiku::dispatchDidFailLoad(const ResourceError&)
649{
650    notImplemented();
651}
652
653Frame* FrameLoaderClientHaiku::dispatchCreatePage(const WebCore::NavigationAction&)
654{
655    notImplemented();
656    return false;
657}
658
659void FrameLoaderClientHaiku::dispatchDecidePolicyForResponse(FramePolicyFunction function,
660                                                             const ResourceResponse& response,
661                                                             const ResourceRequest& request)
662{
663    if (!m_frame)
664        return;
665
666    notImplemented();
667    (m_frame->loader()->policyChecker()->*function)(PolicyUse);
668}
669
670void FrameLoaderClientHaiku::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function,
671                                                                    const NavigationAction&,
672                                                                    const ResourceRequest& request,
673                                                                    PassRefPtr<FormState>, const String& targetName)
674{
675    if (!m_frame)
676        return;
677
678    if (m_webView) {
679        BMessage message(NEW_WINDOW_REQUESTED);
680        message.AddString("url", request.url().string());
681        if (m_messenger->SendMessage(&message)) {
682            (m_frame->loader()->policyChecker()->*function)(PolicyIgnore);
683            return;
684        }
685    }
686
687    (m_frame->loader()->policyChecker()->*function)(PolicyUse);
688}
689
690void FrameLoaderClientHaiku::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function,
691                                                                     const NavigationAction& action,
692                                                                     const ResourceRequest& request,
693                                                                     PassRefPtr<FormState>)
694{
695    if (!m_frame || !function)
696        return;
697
698    if (m_webView) {
699        BMessage message(NAVIGATION_REQUESTED);
700        message.AddString("url", request.url().string());
701        m_messenger->SendMessage(&message);
702
703        (m_frame->loader()->policyChecker()->*function)(PolicyUse);
704    }
705}
706
707void FrameLoaderClientHaiku::dispatchUnableToImplementPolicy(const ResourceError&)
708{
709    notImplemented();
710}
711
712void FrameLoaderClientHaiku::startDownload(const ResourceRequest&)
713{
714    notImplemented();
715}
716
717PassRefPtr<Frame> FrameLoaderClientHaiku::createFrame(const KURL& url, const String& name,
718                                                      HTMLFrameOwnerElement* ownerElement,
719                                                      const String& referrer, bool allowsScrolling,
720                                                      int marginWidth, int marginHeight)
721{
722    // FIXME: We should apply the right property to the frameView. (scrollbar,margins)
723
724    RefPtr<Frame> childFrame = Frame::create(m_frame->page(), ownerElement, this);
725    setFrame(childFrame.get());
726
727    RefPtr<FrameView> frameView = FrameView::create(childFrame.get());
728
729    frameView->setAllowsScrolling(allowsScrolling);
730    frameView->deref();
731    childFrame->setView(frameView.get());
732    childFrame->init();
733
734    childFrame->tree()->setName(name);
735    m_frame->tree()->appendChild(childFrame);
736
737    m_frame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
738
739    // The frame's onload handler may have removed it from the document.
740    if (!childFrame->tree()->parent())
741        return 0;
742
743    return childFrame.release();
744
745    notImplemented();
746    return 0;
747}
748
749void FrameLoaderClientHaiku::didTransferChildFrameToNewDocument(Page*)
750{
751}
752
753void FrameLoaderClientHaiku::transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*)
754{
755}
756
757ObjectContentType FrameLoaderClientHaiku::objectContentType(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages)
758{
759    notImplemented();
760    return ObjectContentType();
761}
762
763PassRefPtr<Widget> FrameLoaderClientHaiku::createPlugin(const IntSize&, HTMLPlugInElement*,
764                                                        const KURL&, const Vector<String>&,
765                                                        const Vector<String>&, const String&,
766                                                        bool loadManually)
767{
768    notImplemented();
769    return 0;
770}
771
772void FrameLoaderClientHaiku::redirectDataToPlugin(Widget* pluginWidget)
773{
774    notImplemented();
775    return;
776}
777
778ResourceError FrameLoaderClientHaiku::pluginWillHandleLoadError(const ResourceResponse& response)
779{
780    notImplemented();
781    return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String());
782}
783
784PassRefPtr<Widget> FrameLoaderClientHaiku::createJavaAppletWidget(const IntSize&, HTMLAppletElement*,
785                                                       const KURL& baseURL,
786                                                       const Vector<String>& paramNames,
787                                                       const Vector<String>& paramValues)
788{
789    notImplemented();
790    return 0;
791}
792
793String FrameLoaderClientHaiku::overrideMediaType() const
794{
795    notImplemented();
796    return String();
797}
798
799void FrameLoaderClientHaiku::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
800{
801    if (world != mainThreadNormalWorld())
802        return;
803
804    if (m_webView) {
805        BMessage message(JAVASCRIPT_WINDOW_OBJECT_CLEARED);
806        m_messenger->SendMessage(&message);
807    }
808}
809
810void FrameLoaderClientHaiku::documentElementAvailable()
811{
812}
813
814void FrameLoaderClientHaiku::didPerformFirstNavigation() const
815{
816    notImplemented();
817}
818
819void FrameLoaderClientHaiku::registerForIconNotification(bool listen)
820{
821    notImplemented();
822}
823
824void FrameLoaderClientHaiku::savePlatformDataToCachedFrame(CachedFrame*)
825{
826    notImplemented();
827}
828
829void FrameLoaderClientHaiku::transitionToCommittedFromCachedFrame(CachedFrame*)
830{
831    notImplemented();
832}
833
834void FrameLoaderClientHaiku::transitionToCommittedForNewPage()
835{
836    ASSERT(m_frame);
837    ASSERT(m_webView);
838
839    Page* page = m_frame->page();
840    ASSERT(page);
841
842    bool isMainFrame = m_frame == page->mainFrame();
843
844    m_frame->setView(0);
845
846    RefPtr<FrameView> frameView;
847    if (isMainFrame) {
848        if (m_webView->LockLooper()) {
849            // We lock the looper in order to get the bounds of the WebView.
850            frameView = FrameView::create(m_frame, IntRect(m_webView->Bounds()).size());
851            m_webView->UnlockLooper();
852        }
853    } else
854        frameView = FrameView::create(m_frame);
855
856    ASSERT(frameView);
857    m_frame->setView(frameView);
858
859    frameView->setPlatformWidget(m_webView);
860
861    if (HTMLFrameOwnerElement* owner = m_frame->ownerElement())
862        m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode());
863}
864
865void FrameLoaderClientHaiku::didSaveToPageCache()
866{
867}
868
869void FrameLoaderClientHaiku::didRestoreFromPageCache()
870{
871}
872
873void FrameLoaderClientHaiku::dispatchDidBecomeFrameset(bool)
874{
875}
876
877} // namespace WebCore
878