• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 Don Gibson <dgibson77@gmail.com>
3  * Copyright (C) 2006 Zack Rusin <zack@kde.org>
4  * Copyright (C) 2006 Apple Computer, 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 "WebView.h"
46 
47 #include <Message.h>
48 #include <String.h>
49 
50 #include <app/Messenger.h>
51 
52 
53 namespace WebCore {
54 
FrameLoaderClientHaiku()55 FrameLoaderClientHaiku::FrameLoaderClientHaiku()
56     : m_frame(0)
57 {
58 }
59 
setFrame(Frame * frame)60 void FrameLoaderClientHaiku::setFrame(Frame* frame)
61 {
62     m_frame = frame;
63 }
64 
setWebView(WebView * webview)65 void FrameLoaderClientHaiku::setWebView(WebView* webview)
66 {
67     m_webView = webview;
68     m_messenger = new BMessenger(m_webView);
69     ASSERT(m_messenger->IsValid());
70 }
71 
detachFrameLoader()72 void FrameLoaderClientHaiku::detachFrameLoader()
73 {
74     m_frame = 0;
75 }
76 
hasWebView() const77 bool FrameLoaderClientHaiku::hasWebView() const
78 {
79     return m_webView;
80 }
81 
hasBackForwardList() const82 bool FrameLoaderClientHaiku::hasBackForwardList() const
83 {
84     notImplemented();
85     return true;
86 }
87 
resetBackForwardList()88 void FrameLoaderClientHaiku::resetBackForwardList()
89 {
90     notImplemented();
91 }
92 
provisionalItemIsTarget() const93 bool FrameLoaderClientHaiku::provisionalItemIsTarget() const
94 {
95     notImplemented();
96     return false;
97 }
98 
makeRepresentation(DocumentLoader *)99 void FrameLoaderClientHaiku::makeRepresentation(DocumentLoader*)
100 {
101     notImplemented();
102 }
103 
forceLayout()104 void FrameLoaderClientHaiku::forceLayout()
105 {
106     notImplemented();
107 }
108 
forceLayoutForNonHTML()109 void FrameLoaderClientHaiku::forceLayoutForNonHTML()
110 {
111     notImplemented();
112 }
113 
updateHistoryForCommit()114 void FrameLoaderClientHaiku::updateHistoryForCommit()
115 {
116     notImplemented();
117 }
118 
updateHistoryForBackForwardNavigation()119 void FrameLoaderClientHaiku::updateHistoryForBackForwardNavigation()
120 {
121     notImplemented();
122 }
123 
updateHistoryForReload()124 void FrameLoaderClientHaiku::updateHistoryForReload()
125 {
126     notImplemented();
127 }
128 
updateHistoryForStandardLoad()129 void FrameLoaderClientHaiku::updateHistoryForStandardLoad()
130 {
131     notImplemented();
132 }
133 
updateHistoryForInternalLoad()134 void FrameLoaderClientHaiku::updateHistoryForInternalLoad()
135 {
136     notImplemented();
137 }
138 
updateHistoryAfterClientRedirect()139 void FrameLoaderClientHaiku::updateHistoryAfterClientRedirect()
140 {
141     notImplemented();
142 }
143 
setCopiesOnScroll()144 void FrameLoaderClientHaiku::setCopiesOnScroll()
145 {
146     // apparently mac specific
147     notImplemented();
148 }
149 
tokenForLoadErrorReset()150 LoadErrorResetToken* FrameLoaderClientHaiku::tokenForLoadErrorReset()
151 {
152     notImplemented();
153     return 0;
154 }
155 
resetAfterLoadError(LoadErrorResetToken *)156 void FrameLoaderClientHaiku::resetAfterLoadError(LoadErrorResetToken*)
157 {
158     notImplemented();
159 }
160 
doNotResetAfterLoadError(LoadErrorResetToken *)161 void FrameLoaderClientHaiku::doNotResetAfterLoadError(LoadErrorResetToken*)
162 {
163     notImplemented();
164 }
165 
willCloseDocument()166 void FrameLoaderClientHaiku::willCloseDocument()
167 {
168     notImplemented();
169 }
170 
detachedFromParent2()171 void FrameLoaderClientHaiku::detachedFromParent2()
172 {
173     notImplemented();
174 }
175 
detachedFromParent3()176 void FrameLoaderClientHaiku::detachedFromParent3()
177 {
178     notImplemented();
179 }
180 
dispatchDidHandleOnloadEvents()181 void FrameLoaderClientHaiku::dispatchDidHandleOnloadEvents()
182 {
183     if (m_webView) {
184         BMessage message(LOAD_ONLOAD_HANDLE);
185         message.AddString("url", m_frame->loader()->documentLoader()->request().url().string());
186         m_messenger->SendMessage(&message);
187     }
188 }
189 
dispatchDidReceiveServerRedirectForProvisionalLoad()190 void FrameLoaderClientHaiku::dispatchDidReceiveServerRedirectForProvisionalLoad()
191 {
192     notImplemented();
193 }
194 
dispatchDidCancelClientRedirect()195 void FrameLoaderClientHaiku::dispatchDidCancelClientRedirect()
196 {
197     notImplemented();
198 }
199 
dispatchWillPerformClientRedirect(const KURL &,double interval,double fireDate)200 void FrameLoaderClientHaiku::dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate)
201 {
202     notImplemented();
203 }
204 
dispatchDidChangeLocationWithinPage()205 void FrameLoaderClientHaiku::dispatchDidChangeLocationWithinPage()
206 {
207     notImplemented();
208 }
209 
dispatchWillClose()210 void FrameLoaderClientHaiku::dispatchWillClose()
211 {
212     notImplemented();
213 }
214 
dispatchDidStartProvisionalLoad()215 void FrameLoaderClientHaiku::dispatchDidStartProvisionalLoad()
216 {
217     if (m_webView) {
218         BMessage message(LOAD_NEGOCIATING);
219         message.AddString("url", m_frame->loader()->provisionalDocumentLoader()->request().url().string());
220         m_messenger->SendMessage(&message);
221     }
222 }
223 
dispatchDidReceiveTitle(const String & title)224 void FrameLoaderClientHaiku::dispatchDidReceiveTitle(const String& title)
225 {
226     if (m_webView) {
227         m_webView->SetPageTitle(title);
228 
229         BMessage message(TITLE_CHANGED);
230         message.AddString("title", title);
231         m_messenger->SendMessage(&message);
232     }
233 }
234 
dispatchDidCommitLoad()235 void FrameLoaderClientHaiku::dispatchDidCommitLoad()
236 {
237     if (m_webView) {
238         BMessage message(LOAD_TRANSFERRING);
239         message.AddString("url", m_frame->loader()->documentLoader()->request().url().string());
240         m_messenger->SendMessage(&message);
241     }
242 }
243 
dispatchDidFinishDocumentLoad()244 void FrameLoaderClientHaiku::dispatchDidFinishDocumentLoad()
245 {
246     if (m_webView) {
247         BMessage message(LOAD_DOC_COMPLETED);
248         message.AddString("url", m_frame->loader()->url().string());
249         m_messenger->SendMessage(&message);
250     }
251 }
252 
dispatchDidFinishLoad()253 void FrameLoaderClientHaiku::dispatchDidFinishLoad()
254 {
255     notImplemented();
256 }
257 
dispatchDidFirstLayout()258 void FrameLoaderClientHaiku::dispatchDidFirstLayout()
259 {
260     notImplemented();
261 }
262 
dispatchDidFirstVisuallyNonEmptyLayout()263 void FrameLoaderClientHaiku::dispatchDidFirstVisuallyNonEmptyLayout()
264 {
265     notImplemented();
266 }
267 
dispatchShow()268 void FrameLoaderClientHaiku::dispatchShow()
269 {
270     notImplemented();
271 }
272 
cancelPolicyCheck()273 void FrameLoaderClientHaiku::cancelPolicyCheck()
274 {
275     notImplemented();
276 }
277 
dispatchWillSubmitForm(FramePolicyFunction function,PassRefPtr<FormState>)278 void FrameLoaderClientHaiku::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>)
279 {
280     // FIXME: Send an event to allow for alerts and cancellation.
281     if (!m_frame)
282         return;
283     (m_frame->loader()->*function)(PolicyUse);
284 }
285 
dispatchDidLoadMainResource(DocumentLoader *)286 void FrameLoaderClientHaiku::dispatchDidLoadMainResource(DocumentLoader*)
287 {
288     notImplemented();
289 }
290 
revertToProvisionalState(DocumentLoader *)291 void FrameLoaderClientHaiku::revertToProvisionalState(DocumentLoader*)
292 {
293     notImplemented();
294 }
295 
postProgressStartedNotification()296 void FrameLoaderClientHaiku::postProgressStartedNotification()
297 {
298     notImplemented();
299 }
300 
postProgressEstimateChangedNotification()301 void FrameLoaderClientHaiku::postProgressEstimateChangedNotification()
302 {
303     notImplemented();
304 }
305 
postProgressFinishedNotification()306 void FrameLoaderClientHaiku::postProgressFinishedNotification()
307 {
308     if (m_webView) {
309         BMessage message(LOAD_DL_COMPLETED);
310         message.AddString("url", m_frame->loader()->url().string());
311         m_messenger->SendMessage(&message);
312     }
313 }
314 
progressStarted()315 void FrameLoaderClientHaiku::progressStarted()
316 {
317     notImplemented();
318 }
319 
320 
progressCompleted()321 void FrameLoaderClientHaiku::progressCompleted()
322 {
323     notImplemented();
324 }
325 
326 
setMainFrameDocumentReady(bool)327 void FrameLoaderClientHaiku::setMainFrameDocumentReady(bool)
328 {
329     notImplemented();
330     // this is only interesting once we provide an external API for the DOM
331 }
332 
willChangeTitle(DocumentLoader *)333 void FrameLoaderClientHaiku::willChangeTitle(DocumentLoader*)
334 {
335     notImplemented();
336 }
337 
didChangeTitle(DocumentLoader * docLoader)338 void FrameLoaderClientHaiku::didChangeTitle(DocumentLoader* docLoader)
339 {
340     setTitle(docLoader->title(), docLoader->url());
341 }
342 
finishedLoading(DocumentLoader *)343 void FrameLoaderClientHaiku::finishedLoading(DocumentLoader*)
344 {
345     notImplemented();
346 }
347 
canShowMIMEType(const String & MIMEType) const348 bool FrameLoaderClientHaiku::canShowMIMEType(const String& MIMEType) const
349 {
350     notImplemented();
351     return true;
352 }
353 
representationExistsForURLScheme(const String & URLScheme) const354 bool FrameLoaderClientHaiku::representationExistsForURLScheme(const String& URLScheme) const
355 {
356     notImplemented();
357     return false;
358 }
359 
generatedMIMETypeForURLScheme(const String & URLScheme) const360 String FrameLoaderClientHaiku::generatedMIMETypeForURLScheme(const String& URLScheme) const
361 {
362     notImplemented();
363     return String();
364 }
365 
frameLoadCompleted()366 void FrameLoaderClientHaiku::frameLoadCompleted()
367 {
368     if (m_webView->LockLooper()) {
369         m_webView->Draw(m_webView->Bounds());
370         m_webView->UnlockLooper();
371     }
372 }
373 
saveViewStateToItem(HistoryItem *)374 void FrameLoaderClientHaiku::saveViewStateToItem(HistoryItem*)
375 {
376     notImplemented();
377 }
378 
restoreViewState()379 void FrameLoaderClientHaiku::restoreViewState()
380 {
381     notImplemented();
382 }
383 
restoreScrollPositionAndViewState()384 void FrameLoaderClientHaiku::restoreScrollPositionAndViewState()
385 {
386     notImplemented();
387 }
388 
provisionalLoadStarted()389 void FrameLoaderClientHaiku::provisionalLoadStarted()
390 {
391     notImplemented();
392 }
393 
shouldTreatURLAsSameAsCurrent(const KURL &) const394 bool FrameLoaderClientHaiku::shouldTreatURLAsSameAsCurrent(const KURL&) const
395 {
396     notImplemented();
397     return false;
398 }
399 
addHistoryItemForFragmentScroll()400 void FrameLoaderClientHaiku::addHistoryItemForFragmentScroll()
401 {
402     notImplemented();
403 }
404 
didFinishLoad()405 void FrameLoaderClientHaiku::didFinishLoad()
406 {
407     notImplemented();
408 }
409 
prepareForDataSourceReplacement()410 void FrameLoaderClientHaiku::prepareForDataSourceReplacement()
411 {
412     notImplemented();
413 }
414 
setTitle(const String & title,const KURL &)415 void FrameLoaderClientHaiku::setTitle(const String& title, const KURL&)
416 {
417     notImplemented();
418 }
419 
userAgent(const KURL &)420 String FrameLoaderClientHaiku::userAgent(const KURL&)
421 {
422     return String("Mozilla/5.0 (compatible; U; InfiNet 0.1; Haiku) AppleWebKit/420+ (KHTML, like Gecko)");
423 }
424 
dispatchDidReceiveIcon()425 void FrameLoaderClientHaiku::dispatchDidReceiveIcon()
426 {
427     notImplemented();
428 }
429 
frameLoaderDestroyed()430 void FrameLoaderClientHaiku::frameLoaderDestroyed()
431 {
432     m_frame = 0;
433     m_messenger = 0;
434     delete this;
435 }
436 
canHandleRequest(const WebCore::ResourceRequest &) const437 bool FrameLoaderClientHaiku::canHandleRequest(const WebCore::ResourceRequest&) const
438 {
439     notImplemented();
440     return true;
441 }
442 
partClearedInBegin()443 void FrameLoaderClientHaiku::partClearedInBegin()
444 {
445     notImplemented();
446 }
447 
updateGlobalHistory()448 void FrameLoaderClientHaiku::updateGlobalHistory()
449 {
450     notImplemented();
451 }
452 
updateGlobalHistoryRedirectLinks()453 void FrameLoaderClientHaiku::updateGlobalHistoryRedirectLinks()
454 {
455     notImplemented();
456 }
457 
shouldGoToHistoryItem(WebCore::HistoryItem *) const458 bool FrameLoaderClientHaiku::shouldGoToHistoryItem(WebCore::HistoryItem*) const
459 {
460     notImplemented();
461     return true;
462 }
463 
saveScrollPositionAndViewStateToItem(WebCore::HistoryItem *)464 void FrameLoaderClientHaiku::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*)
465 {
466     notImplemented();
467 }
468 
canCachePage() const469 bool FrameLoaderClientHaiku::canCachePage() const
470 {
471     return false;
472 }
473 
setMainDocumentError(WebCore::DocumentLoader *,const WebCore::ResourceError &)474 void FrameLoaderClientHaiku::setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&)
475 {
476     notImplemented();
477 }
478 
committedLoad(WebCore::DocumentLoader * loader,const char * data,int length)479 void FrameLoaderClientHaiku::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
480 {
481     if (!m_frame)
482         return;
483 
484     FrameLoader* frameLoader = loader->frameLoader();
485     frameLoader->setEncoding(m_response.textEncodingName(), false);
486     frameLoader->addData(data, length);
487 }
488 
cancelledError(const WebCore::ResourceRequest & request)489 WebCore::ResourceError FrameLoaderClientHaiku::cancelledError(const WebCore::ResourceRequest& request)
490 {
491     notImplemented();
492     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
493 }
494 
blockedError(const ResourceRequest & request)495 WebCore::ResourceError FrameLoaderClientHaiku::blockedError(const ResourceRequest& request)
496 {
497     notImplemented();
498     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
499 }
500 
cannotShowURLError(const WebCore::ResourceRequest & request)501 WebCore::ResourceError FrameLoaderClientHaiku::cannotShowURLError(const WebCore::ResourceRequest& request)
502 {
503     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
504 }
505 
interruptForPolicyChangeError(const WebCore::ResourceRequest & request)506 WebCore::ResourceError FrameLoaderClientHaiku::interruptForPolicyChangeError(const WebCore::ResourceRequest& request)
507 {
508     notImplemented();
509     return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String());
510 }
511 
cannotShowMIMETypeError(const WebCore::ResourceResponse & response)512 WebCore::ResourceError FrameLoaderClientHaiku::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
513 {
514     notImplemented();
515     return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String());
516 }
517 
fileDoesNotExistError(const WebCore::ResourceResponse & response)518 WebCore::ResourceError FrameLoaderClientHaiku::fileDoesNotExistError(const WebCore::ResourceResponse& response)
519 {
520     notImplemented();
521     return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String());
522 }
523 
shouldFallBack(const WebCore::ResourceError & error)524 bool FrameLoaderClientHaiku::shouldFallBack(const WebCore::ResourceError& error)
525 {
526     notImplemented();
527     return false;
528 }
529 
createDocumentLoader(const ResourceRequest & request,const SubstituteData & substituteData)530 WTF::PassRefPtr<DocumentLoader> FrameLoaderClientHaiku::createDocumentLoader(const ResourceRequest& request,
531                                                                              const SubstituteData& substituteData)
532 {
533     return DocumentLoader::create(request, substituteData);
534 }
535 
download(ResourceHandle *,const ResourceRequest &,const ResourceRequest &,const ResourceResponse &)536 void FrameLoaderClientHaiku::download(ResourceHandle*, const ResourceRequest&,
537                                       const ResourceRequest&, const ResourceResponse&)
538 {
539     notImplemented();
540 }
541 
assignIdentifierToInitialRequest(unsigned long identifier,DocumentLoader *,const ResourceRequest &)542 void FrameLoaderClientHaiku::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*,
543                                                               const ResourceRequest&)
544 {
545     notImplemented();
546 }
547 
dispatchWillSendRequest(DocumentLoader *,unsigned long,ResourceRequest & request,const ResourceResponse & response)548 void FrameLoaderClientHaiku::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest& request,
549                                                      const ResourceResponse& response)
550 {
551     notImplemented();
552 }
553 
shouldUseCredentialStorage(DocumentLoader *,unsigned long)554 bool FrameLoaderClientHaiku::shouldUseCredentialStorage(DocumentLoader*, unsigned long)
555 {
556     notImplemented();
557     return false;
558 }
559 
dispatchDidReceiveAuthenticationChallenge(DocumentLoader *,unsigned long,const AuthenticationChallenge &)560 void FrameLoaderClientHaiku::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*,
561                                                                        unsigned long, const AuthenticationChallenge&)
562 {
563     notImplemented();
564 }
565 
dispatchDidCancelAuthenticationChallenge(DocumentLoader *,unsigned long,const AuthenticationChallenge &)566 void FrameLoaderClientHaiku::dispatchDidCancelAuthenticationChallenge(DocumentLoader*,
567                                                                       unsigned long, const AuthenticationChallenge&)
568 {
569     notImplemented();
570 }
571 
dispatchDidReceiveResponse(DocumentLoader * loader,unsigned long id,const ResourceResponse & response)572 void FrameLoaderClientHaiku::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long id,
573                                                         const ResourceResponse& response)
574 {
575     notImplemented();
576     m_response = response;
577     m_firstData = true;
578 }
579 
dispatchDidReceiveContentLength(DocumentLoader * loader,unsigned long id,int length)580 void FrameLoaderClientHaiku::dispatchDidReceiveContentLength(DocumentLoader* loader,
581                                                              unsigned long id, int length)
582 {
583     notImplemented();
584 }
585 
dispatchDidFinishLoading(DocumentLoader *,unsigned long)586 void FrameLoaderClientHaiku::dispatchDidFinishLoading(DocumentLoader*, unsigned long)
587 {
588     notImplemented();
589 }
590 
dispatchDidFailLoading(DocumentLoader * loader,unsigned long,const ResourceError &)591 void FrameLoaderClientHaiku::dispatchDidFailLoading(DocumentLoader* loader,
592                                                     unsigned long, const ResourceError&)
593 {
594     if (m_webView) {
595         BMessage message(LOAD_FAILED);
596         message.AddString("url", m_frame->loader()->documentLoader()->request().url().string());
597         m_messenger->SendMessage(&message);
598     }
599 }
600 
dispatchDidLoadResourceFromMemoryCache(DocumentLoader *,const ResourceRequest &,const ResourceResponse &,int)601 bool FrameLoaderClientHaiku::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*,
602                                                                     const ResourceRequest&,
603                                                                     const ResourceResponse&, int)
604 {
605     notImplemented();
606     return false;
607 }
608 
dispatchDidLoadResourceByXMLHttpRequest(unsigned long,const ScriptString &)609 void FrameLoaderClientHaiku::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&)
610 {
611     notImplemented();
612 }
613 
dispatchDidFailProvisionalLoad(const ResourceError &)614 void FrameLoaderClientHaiku::dispatchDidFailProvisionalLoad(const ResourceError&)
615 {
616     notImplemented();
617 }
618 
dispatchDidFailLoad(const ResourceError &)619 void FrameLoaderClientHaiku::dispatchDidFailLoad(const ResourceError&)
620 {
621     notImplemented();
622 }
623 
dispatchCreatePage()624 Frame* FrameLoaderClientHaiku::dispatchCreatePage()
625 {
626     notImplemented();
627     return false;
628 }
629 
dispatchDecidePolicyForMIMEType(FramePolicyFunction function,const String & mimetype,const ResourceRequest & request)630 void FrameLoaderClientHaiku::dispatchDecidePolicyForMIMEType(FramePolicyFunction function,
631                                                              const String& mimetype,
632                                                              const ResourceRequest& request)
633 {
634     if (!m_frame)
635         return;
636 
637     notImplemented();
638     (m_frame->loader()->*function)(PolicyUse);
639 }
640 
dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function,const NavigationAction &,const ResourceRequest & request,PassRefPtr<FormState>,const String & targetName)641 void FrameLoaderClientHaiku::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function,
642                                                                     const NavigationAction&,
643                                                                     const ResourceRequest& request,
644                                                                     PassRefPtr<FormState>, const String& targetName)
645 {
646     if (!m_frame)
647         return;
648 
649     if (m_webView) {
650         BMessage message(NEW_WINDOW_REQUESTED);
651         message.AddString("url", request.url().string());
652         if (m_messenger->SendMessage(&message)) {
653             (m_frame->loader()->*function)(PolicyIgnore);
654             return;
655         }
656     }
657 
658     (m_frame->loader()->*function)(PolicyUse);
659 }
660 
dispatchDecidePolicyForNavigationAction(FramePolicyFunction function,const NavigationAction & action,const ResourceRequest & request,PassRefPtr<FormState>)661 void FrameLoaderClientHaiku::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function,
662                                                                      const NavigationAction& action,
663                                                                      const ResourceRequest& request,
664                                                                      PassRefPtr<FormState>)
665 {
666     if (!m_frame || !function)
667         return;
668 
669     if (m_webView) {
670         BMessage message(NAVIGATION_REQUESTED);
671         message.AddString("url", request.url().string());
672         m_messenger->SendMessage(&message);
673 
674         (m_frame->loader()->*function)(PolicyUse);
675     }
676 }
677 
dispatchUnableToImplementPolicy(const ResourceError &)678 void FrameLoaderClientHaiku::dispatchUnableToImplementPolicy(const ResourceError&)
679 {
680     notImplemented();
681 }
682 
startDownload(const ResourceRequest &)683 void FrameLoaderClientHaiku::startDownload(const ResourceRequest&)
684 {
685     notImplemented();
686 }
687 
createFrame(const KURL & url,const String & name,HTMLFrameOwnerElement * ownerElement,const String & referrer,bool allowsScrolling,int marginWidth,int marginHeight)688 PassRefPtr<Frame> FrameLoaderClientHaiku::createFrame(const KURL& url, const String& name,
689                                                       HTMLFrameOwnerElement* ownerElement,
690                                                       const String& referrer, bool allowsScrolling,
691                                                       int marginWidth, int marginHeight)
692 {
693     // FIXME: We should apply the right property to the frameView. (scrollbar,margins)
694 
695     RefPtr<Frame> childFrame = Frame::create(m_frame->page(), ownerElement, this);
696     setFrame(childFrame.get());
697 
698     RefPtr<FrameView> frameView = FrameView::create(childFrame.get());
699 
700     frameView->setAllowsScrolling(allowsScrolling);
701     frameView->deref();
702     childFrame->setView(frameView.get());
703     childFrame->init();
704 
705     childFrame->tree()->setName(name);
706     m_frame->tree()->appendChild(childFrame);
707 
708     childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
709 
710     // The frame's onload handler may have removed it from the document.
711     if (!childFrame->tree()->parent())
712         return 0;
713 
714     return childFrame.release();
715 
716     notImplemented();
717     return 0;
718 }
719 
objectContentType(const KURL & url,const String & mimeType)720 ObjectContentType FrameLoaderClientHaiku::objectContentType(const KURL& url, const String& mimeType)
721 {
722     notImplemented();
723     return ObjectContentType();
724 }
725 
createPlugin(const IntSize &,HTMLPlugInElement *,const KURL &,const Vector<String> &,const Vector<String> &,const String &,bool loadManually)726 PassRefPtr<Widget> FrameLoaderClientHaiku::createPlugin(const IntSize&, HTMLPlugInElement*,
727                                                         const KURL&, const Vector<String>&,
728                                                         const Vector<String>&, const String&,
729                                                         bool loadManually)
730 {
731     notImplemented();
732     return 0;
733 }
734 
redirectDataToPlugin(Widget * pluginWidget)735 void FrameLoaderClientHaiku::redirectDataToPlugin(Widget* pluginWidget)
736 {
737     notImplemented();
738     return;
739 }
740 
pluginWillHandleLoadError(const ResourceResponse & response)741 ResourceError FrameLoaderClientHaiku::pluginWillHandleLoadError(const ResourceResponse& response)
742 {
743     notImplemented();
744     return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String());
745 }
746 
createJavaAppletWidget(const IntSize &,HTMLAppletElement *,const KURL & baseURL,const Vector<String> & paramNames,const Vector<String> & paramValues)747 PassRefPtr<Widget> FrameLoaderClientHaiku::createJavaAppletWidget(const IntSize&, HTMLAppletElement*,
748                                                        const KURL& baseURL,
749                                                        const Vector<String>& paramNames,
750                                                        const Vector<String>& paramValues)
751 {
752     notImplemented();
753     return 0;
754 }
755 
overrideMediaType() const756 String FrameLoaderClientHaiku::overrideMediaType() const
757 {
758     notImplemented();
759     return String();
760 }
761 
windowObjectCleared()762 void FrameLoaderClientHaiku::windowObjectCleared()
763 {
764     if (m_webView) {
765         BMessage message(JAVASCRIPT_WINDOW_OBJECT_CLEARED);
766         m_messenger->SendMessage(&message);
767     }
768 }
769 
documentElementAvailable()770 void FrameLoaderClientHaiku::documentElementAvailable()
771 {
772 }
773 
didPerformFirstNavigation() const774 void FrameLoaderClientHaiku::didPerformFirstNavigation() const
775 {
776     notImplemented();
777 }
778 
registerForIconNotification(bool listen)779 void FrameLoaderClientHaiku::registerForIconNotification(bool listen)
780 {
781     notImplemented();
782 }
783 
savePlatformDataToCachedFrame(CachedFrame *)784 void FrameLoaderClientHaiku::savePlatformDataToCachedFrame(CachedFrame*)
785 {
786     notImplemented();
787 }
788 
transitionToCommittedFromCachedFrame(CachedFrame *)789 void FrameLoaderClientHaiku::transitionToCommittedFromCachedFrame(CachedFrame*)
790 {
791     notImplemented();
792 }
793 
transitionToCommittedForNewPage()794 void FrameLoaderClientHaiku::transitionToCommittedForNewPage()
795 {
796     ASSERT(m_frame);
797     ASSERT(m_webView);
798 
799     Page* page = m_frame->page();
800     ASSERT(page);
801 
802     bool isMainFrame = m_frame == page->mainFrame();
803 
804     m_frame->setView(0);
805 
806     RefPtr<FrameView> frameView;
807     if (isMainFrame) {
808         if (m_webView->LockLooper()) {
809             // We lock the looper in order to get the bounds of the WebView.
810             frameView = FrameView::create(m_frame, IntRect(m_webView->Bounds()).size());
811             m_webView->UnlockLooper();
812         }
813     } else
814         frameView = FrameView::create(m_frame);
815 
816     ASSERT(frameView);
817     m_frame->setView(frameView);
818 
819     frameView->setPlatformWidget(m_webView);
820 
821     if (HTMLFrameOwnerElement* owner = m_frame->ownerElement())
822         m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode());
823 }
824 
825 } // namespace WebCore
826 
827