• 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, 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 
54 namespace WebCore {
55 
FrameLoaderClientHaiku()56 FrameLoaderClientHaiku::FrameLoaderClientHaiku()
57     : m_frame(0)
58 {
59 }
60 
setFrame(Frame * frame)61 void FrameLoaderClientHaiku::setFrame(Frame* frame)
62 {
63     m_frame = frame;
64 }
65 
setWebView(WebView * webview)66 void FrameLoaderClientHaiku::setWebView(WebView* webview)
67 {
68     m_webView = webview;
69     m_messenger = new BMessenger(m_webView);
70     ASSERT(m_messenger->IsValid());
71 }
72 
detachFrameLoader()73 void FrameLoaderClientHaiku::detachFrameLoader()
74 {
75     m_frame = 0;
76 }
77 
hasWebView() const78 bool FrameLoaderClientHaiku::hasWebView() const
79 {
80     return m_webView;
81 }
82 
hasBackForwardList() const83 bool FrameLoaderClientHaiku::hasBackForwardList() const
84 {
85     notImplemented();
86     return true;
87 }
88 
resetBackForwardList()89 void FrameLoaderClientHaiku::resetBackForwardList()
90 {
91     notImplemented();
92 }
93 
provisionalItemIsTarget() const94 bool FrameLoaderClientHaiku::provisionalItemIsTarget() const
95 {
96     notImplemented();
97     return false;
98 }
99 
makeRepresentation(DocumentLoader *)100 void FrameLoaderClientHaiku::makeRepresentation(DocumentLoader*)
101 {
102     notImplemented();
103 }
104 
forceLayout()105 void FrameLoaderClientHaiku::forceLayout()
106 {
107     notImplemented();
108 }
109 
forceLayoutForNonHTML()110 void FrameLoaderClientHaiku::forceLayoutForNonHTML()
111 {
112     notImplemented();
113 }
114 
updateHistoryForCommit()115 void FrameLoaderClientHaiku::updateHistoryForCommit()
116 {
117     notImplemented();
118 }
119 
updateHistoryForBackForwardNavigation()120 void FrameLoaderClientHaiku::updateHistoryForBackForwardNavigation()
121 {
122     notImplemented();
123 }
124 
updateHistoryForReload()125 void FrameLoaderClientHaiku::updateHistoryForReload()
126 {
127     notImplemented();
128 }
129 
updateHistoryForStandardLoad()130 void FrameLoaderClientHaiku::updateHistoryForStandardLoad()
131 {
132     notImplemented();
133 }
134 
updateHistoryForInternalLoad()135 void FrameLoaderClientHaiku::updateHistoryForInternalLoad()
136 {
137     notImplemented();
138 }
139 
updateHistoryAfterClientRedirect()140 void FrameLoaderClientHaiku::updateHistoryAfterClientRedirect()
141 {
142     notImplemented();
143 }
144 
setCopiesOnScroll()145 void FrameLoaderClientHaiku::setCopiesOnScroll()
146 {
147     // apparently mac specific
148     notImplemented();
149 }
150 
tokenForLoadErrorReset()151 LoadErrorResetToken* FrameLoaderClientHaiku::tokenForLoadErrorReset()
152 {
153     notImplemented();
154     return 0;
155 }
156 
resetAfterLoadError(LoadErrorResetToken *)157 void FrameLoaderClientHaiku::resetAfterLoadError(LoadErrorResetToken*)
158 {
159     notImplemented();
160 }
161 
doNotResetAfterLoadError(LoadErrorResetToken *)162 void FrameLoaderClientHaiku::doNotResetAfterLoadError(LoadErrorResetToken*)
163 {
164     notImplemented();
165 }
166 
willCloseDocument()167 void FrameLoaderClientHaiku::willCloseDocument()
168 {
169     notImplemented();
170 }
171 
detachedFromParent2()172 void FrameLoaderClientHaiku::detachedFromParent2()
173 {
174     notImplemented();
175 }
176 
detachedFromParent3()177 void FrameLoaderClientHaiku::detachedFromParent3()
178 {
179     notImplemented();
180 }
181 
dispatchDidHandleOnloadEvents()182 void 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 
dispatchDidReceiveServerRedirectForProvisionalLoad()191 void FrameLoaderClientHaiku::dispatchDidReceiveServerRedirectForProvisionalLoad()
192 {
193     notImplemented();
194 }
195 
dispatchDidCancelClientRedirect()196 void FrameLoaderClientHaiku::dispatchDidCancelClientRedirect()
197 {
198     notImplemented();
199 }
200 
dispatchWillPerformClientRedirect(const KURL &,double interval,double fireDate)201 void FrameLoaderClientHaiku::dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate)
202 {
203     notImplemented();
204 }
205 
dispatchDidChangeLocationWithinPage()206 void FrameLoaderClientHaiku::dispatchDidChangeLocationWithinPage()
207 {
208     notImplemented();
209 }
210 
dispatchDidPushStateWithinPage()211 void FrameLoaderClientHaiku::dispatchDidPushStateWithinPage()
212 {
213     notImplemented();
214 }
215 
dispatchDidReplaceStateWithinPage()216 void FrameLoaderClientHaiku::dispatchDidReplaceStateWithinPage()
217 {
218     notImplemented();
219 }
220 
dispatchDidPopStateWithinPage()221 void FrameLoaderClientHaiku::dispatchDidPopStateWithinPage()
222 {
223     notImplemented();
224 }
225 
dispatchWillClose()226 void FrameLoaderClientHaiku::dispatchWillClose()
227 {
228     notImplemented();
229 }
230 
dispatchDidStartProvisionalLoad()231 void 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 
dispatchDidReceiveTitle(const StringWithTitle & title)240 void 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 
dispatchDidCommitLoad()251 void 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 
dispatchDidFinishDocumentLoad()260 void 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 
dispatchDidFinishLoad()269 void FrameLoaderClientHaiku::dispatchDidFinishLoad()
270 {
271     notImplemented();
272 }
273 
dispatchDidFirstLayout()274 void FrameLoaderClientHaiku::dispatchDidFirstLayout()
275 {
276     notImplemented();
277 }
278 
dispatchDidFirstVisuallyNonEmptyLayout()279 void FrameLoaderClientHaiku::dispatchDidFirstVisuallyNonEmptyLayout()
280 {
281     notImplemented();
282 }
283 
dispatchShow()284 void FrameLoaderClientHaiku::dispatchShow()
285 {
286     notImplemented();
287 }
288 
cancelPolicyCheck()289 void FrameLoaderClientHaiku::cancelPolicyCheck()
290 {
291     notImplemented();
292 }
293 
dispatchWillSubmitForm(FramePolicyFunction function,PassRefPtr<FormState>)294 void 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 
dispatchDidLoadMainResource(DocumentLoader *)302 void FrameLoaderClientHaiku::dispatchDidLoadMainResource(DocumentLoader*)
303 {
304     notImplemented();
305 }
306 
revertToProvisionalState(DocumentLoader *)307 void FrameLoaderClientHaiku::revertToProvisionalState(DocumentLoader*)
308 {
309     notImplemented();
310 }
311 
postProgressStartedNotification()312 void FrameLoaderClientHaiku::postProgressStartedNotification()
313 {
314     notImplemented();
315 }
316 
postProgressEstimateChangedNotification()317 void FrameLoaderClientHaiku::postProgressEstimateChangedNotification()
318 {
319     notImplemented();
320 }
321 
postProgressFinishedNotification()322 void 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 
progressStarted()331 void FrameLoaderClientHaiku::progressStarted()
332 {
333     notImplemented();
334 }
335 
336 
progressCompleted()337 void FrameLoaderClientHaiku::progressCompleted()
338 {
339     notImplemented();
340 }
341 
342 
setMainFrameDocumentReady(bool)343 void FrameLoaderClientHaiku::setMainFrameDocumentReady(bool)
344 {
345     notImplemented();
346     // this is only interesting once we provide an external API for the DOM
347 }
348 
willChangeTitle(DocumentLoader *)349 void FrameLoaderClientHaiku::willChangeTitle(DocumentLoader*)
350 {
351     notImplemented();
352 }
353 
didChangeTitle(DocumentLoader * docLoader)354 void FrameLoaderClientHaiku::didChangeTitle(DocumentLoader* docLoader)
355 {
356     setTitle(docLoader->title(), docLoader->url());
357 }
358 
finishedLoading(DocumentLoader *)359 void FrameLoaderClientHaiku::finishedLoading(DocumentLoader*)
360 {
361     notImplemented();
362 }
363 
canShowMIMETypeAsHTML(const String & MIMEType) const364 bool FrameLoaderClientHaiku::canShowMIMETypeAsHTML(const String& MIMEType) const
365 {
366     notImplemented();
367     return false;
368 }
369 
canShowMIMEType(const String & MIMEType) const370 bool FrameLoaderClientHaiku::canShowMIMEType(const String& MIMEType) const
371 {
372     notImplemented();
373     return true;
374 }
375 
representationExistsForURLScheme(const String & URLScheme) const376 bool FrameLoaderClientHaiku::representationExistsForURLScheme(const String& URLScheme) const
377 {
378     notImplemented();
379     return false;
380 }
381 
generatedMIMETypeForURLScheme(const String & URLScheme) const382 String FrameLoaderClientHaiku::generatedMIMETypeForURLScheme(const String& URLScheme) const
383 {
384     notImplemented();
385     return String();
386 }
387 
frameLoadCompleted()388 void FrameLoaderClientHaiku::frameLoadCompleted()
389 {
390     if (m_webView->LockLooper()) {
391         m_webView->Draw(m_webView->Bounds());
392         m_webView->UnlockLooper();
393     }
394 }
395 
saveViewStateToItem(HistoryItem *)396 void FrameLoaderClientHaiku::saveViewStateToItem(HistoryItem*)
397 {
398     notImplemented();
399 }
400 
restoreViewState()401 void FrameLoaderClientHaiku::restoreViewState()
402 {
403     notImplemented();
404 }
405 
restoreScrollPositionAndViewState()406 void FrameLoaderClientHaiku::restoreScrollPositionAndViewState()
407 {
408     notImplemented();
409 }
410 
provisionalLoadStarted()411 void FrameLoaderClientHaiku::provisionalLoadStarted()
412 {
413     notImplemented();
414 }
415 
shouldTreatURLAsSameAsCurrent(const KURL &) const416 bool FrameLoaderClientHaiku::shouldTreatURLAsSameAsCurrent(const KURL&) const
417 {
418     notImplemented();
419     return false;
420 }
421 
addHistoryItemForFragmentScroll()422 void FrameLoaderClientHaiku::addHistoryItemForFragmentScroll()
423 {
424     notImplemented();
425 }
426 
didFinishLoad()427 void FrameLoaderClientHaiku::didFinishLoad()
428 {
429     notImplemented();
430 }
431 
prepareForDataSourceReplacement()432 void FrameLoaderClientHaiku::prepareForDataSourceReplacement()
433 {
434     notImplemented();
435 }
436 
setTitle(const String & title,const KURL &)437 void FrameLoaderClientHaiku::setTitle(const String& title, const KURL&)
438 {
439     notImplemented();
440 }
441 
userAgent(const KURL &)442 String FrameLoaderClientHaiku::userAgent(const KURL&)
443 {
444     return String("Mozilla/5.0 (compatible; U; InfiNet 0.1; Haiku) AppleWebKit/420+ (KHTML, like Gecko)");
445 }
446 
dispatchDidReceiveIcon()447 void FrameLoaderClientHaiku::dispatchDidReceiveIcon()
448 {
449     notImplemented();
450 }
451 
frameLoaderDestroyed()452 void FrameLoaderClientHaiku::frameLoaderDestroyed()
453 {
454     m_frame = 0;
455     m_messenger = 0;
456     delete this;
457 }
458 
canHandleRequest(const WebCore::ResourceRequest &) const459 bool FrameLoaderClientHaiku::canHandleRequest(const WebCore::ResourceRequest&) const
460 {
461     notImplemented();
462     return true;
463 }
464 
partClearedInBegin()465 void FrameLoaderClientHaiku::partClearedInBegin()
466 {
467     notImplemented();
468 }
469 
updateGlobalHistory()470 void FrameLoaderClientHaiku::updateGlobalHistory()
471 {
472     notImplemented();
473 }
474 
updateGlobalHistoryRedirectLinks()475 void FrameLoaderClientHaiku::updateGlobalHistoryRedirectLinks()
476 {
477     notImplemented();
478 }
479 
shouldGoToHistoryItem(WebCore::HistoryItem *) const480 bool FrameLoaderClientHaiku::shouldGoToHistoryItem(WebCore::HistoryItem*) const
481 {
482     notImplemented();
483     return true;
484 }
485 
shouldStopLoadingForHistoryItem(WebCore::HistoryItem *) const486 bool FrameLoaderClientHaiku::shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const
487 {
488     return true;
489 }
490 
dispatchDidAddBackForwardItem(WebCore::HistoryItem *) const491 void FrameLoaderClientHaiku::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
492 {
493 }
494 
dispatchDidRemoveBackForwardItem(WebCore::HistoryItem *) const495 void FrameLoaderClientHaiku::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
496 {
497 }
498 
dispatchDidChangeBackForwardIndex() const499 void FrameLoaderClientHaiku::dispatchDidChangeBackForwardIndex() const
500 {
501 }
502 
saveScrollPositionAndViewStateToItem(WebCore::HistoryItem *)503 void FrameLoaderClientHaiku::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*)
504 {
505     notImplemented();
506 }
507 
canCachePage() const508 bool FrameLoaderClientHaiku::canCachePage() const
509 {
510     return false;
511 }
512 
setMainDocumentError(WebCore::DocumentLoader *,const WebCore::ResourceError &)513 void FrameLoaderClientHaiku::setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&)
514 {
515     notImplemented();
516 }
517 
committedLoad(WebCore::DocumentLoader * loader,const char * data,int length)518 void FrameLoaderClientHaiku::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
519 {
520     loader->commitData(data, length);
521 }
522 
cancelledError(const WebCore::ResourceRequest & request)523 WebCore::ResourceError FrameLoaderClientHaiku::cancelledError(const WebCore::ResourceRequest& request)
524 {
525     notImplemented();
526     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
527 }
528 
blockedError(const ResourceRequest & request)529 WebCore::ResourceError FrameLoaderClientHaiku::blockedError(const ResourceRequest& request)
530 {
531     notImplemented();
532     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
533 }
534 
cannotShowURLError(const WebCore::ResourceRequest & request)535 WebCore::ResourceError FrameLoaderClientHaiku::cannotShowURLError(const WebCore::ResourceRequest& request)
536 {
537     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
538 }
539 
interruptForPolicyChangeError(const WebCore::ResourceRequest & request)540 WebCore::ResourceError FrameLoaderClientHaiku::interruptForPolicyChangeError(const WebCore::ResourceRequest& request)
541 {
542     notImplemented();
543     return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String());
544 }
545 
cannotShowMIMETypeError(const WebCore::ResourceResponse & response)546 WebCore::ResourceError FrameLoaderClientHaiku::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
547 {
548     notImplemented();
549     return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String());
550 }
551 
fileDoesNotExistError(const WebCore::ResourceResponse & response)552 WebCore::ResourceError FrameLoaderClientHaiku::fileDoesNotExistError(const WebCore::ResourceResponse& response)
553 {
554     notImplemented();
555     return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String());
556 }
557 
shouldFallBack(const WebCore::ResourceError & error)558 bool FrameLoaderClientHaiku::shouldFallBack(const WebCore::ResourceError& error)
559 {
560     notImplemented();
561     return false;
562 }
563 
createDocumentLoader(const ResourceRequest & request,const SubstituteData & substituteData)564 WTF::PassRefPtr<DocumentLoader> FrameLoaderClientHaiku::createDocumentLoader(const ResourceRequest& request,
565                                                                              const SubstituteData& substituteData)
566 {
567     return DocumentLoader::create(request, substituteData);
568 }
569 
download(ResourceHandle *,const ResourceRequest &,const ResourceRequest &,const ResourceResponse &)570 void FrameLoaderClientHaiku::download(ResourceHandle*, const ResourceRequest&,
571                                       const ResourceRequest&, const ResourceResponse&)
572 {
573     notImplemented();
574 }
575 
assignIdentifierToInitialRequest(unsigned long identifier,DocumentLoader *,const ResourceRequest &)576 void FrameLoaderClientHaiku::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*,
577                                                               const ResourceRequest&)
578 {
579     notImplemented();
580 }
581 
dispatchWillSendRequest(DocumentLoader *,unsigned long,ResourceRequest & request,const ResourceResponse & response)582 void FrameLoaderClientHaiku::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest& request,
583                                                      const ResourceResponse& response)
584 {
585     notImplemented();
586 }
587 
shouldUseCredentialStorage(DocumentLoader *,unsigned long)588 bool FrameLoaderClientHaiku::shouldUseCredentialStorage(DocumentLoader*, unsigned long)
589 {
590     notImplemented();
591     return false;
592 }
593 
dispatchDidReceiveAuthenticationChallenge(DocumentLoader *,unsigned long,const AuthenticationChallenge &)594 void FrameLoaderClientHaiku::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*,
595                                                                        unsigned long, const AuthenticationChallenge&)
596 {
597     notImplemented();
598 }
599 
dispatchDidCancelAuthenticationChallenge(DocumentLoader *,unsigned long,const AuthenticationChallenge &)600 void FrameLoaderClientHaiku::dispatchDidCancelAuthenticationChallenge(DocumentLoader*,
601                                                                       unsigned long, const AuthenticationChallenge&)
602 {
603     notImplemented();
604 }
605 
dispatchDidReceiveResponse(DocumentLoader * loader,unsigned long id,const ResourceResponse & response)606 void FrameLoaderClientHaiku::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long id,
607                                                         const ResourceResponse& response)
608 {
609     notImplemented();
610     m_response = response;
611     m_firstData = true;
612 }
613 
dispatchDidReceiveContentLength(DocumentLoader * loader,unsigned long id,int length)614 void FrameLoaderClientHaiku::dispatchDidReceiveContentLength(DocumentLoader* loader,
615                                                              unsigned long id, int length)
616 {
617     notImplemented();
618 }
619 
dispatchDidFinishLoading(DocumentLoader *,unsigned long)620 void FrameLoaderClientHaiku::dispatchDidFinishLoading(DocumentLoader*, unsigned long)
621 {
622     notImplemented();
623 }
624 
dispatchDidFailLoading(DocumentLoader * loader,unsigned long,const ResourceError &)625 void 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 
dispatchDidLoadResourceFromMemoryCache(DocumentLoader *,const ResourceRequest &,const ResourceResponse &,int)635 bool FrameLoaderClientHaiku::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*,
636                                                                     const ResourceRequest&,
637                                                                     const ResourceResponse&, int)
638 {
639     notImplemented();
640     return false;
641 }
642 
dispatchDidFailProvisionalLoad(const ResourceError &)643 void FrameLoaderClientHaiku::dispatchDidFailProvisionalLoad(const ResourceError&)
644 {
645     notImplemented();
646 }
647 
dispatchDidFailLoad(const ResourceError &)648 void FrameLoaderClientHaiku::dispatchDidFailLoad(const ResourceError&)
649 {
650     notImplemented();
651 }
652 
dispatchCreatePage(const WebCore::NavigationAction &)653 Frame* FrameLoaderClientHaiku::dispatchCreatePage(const WebCore::NavigationAction&)
654 {
655     notImplemented();
656     return false;
657 }
658 
dispatchDecidePolicyForResponse(FramePolicyFunction function,const ResourceResponse & response,const ResourceRequest & request)659 void 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 
dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function,const NavigationAction &,const ResourceRequest & request,PassRefPtr<FormState>,const String & targetName)670 void 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 
dispatchDecidePolicyForNavigationAction(FramePolicyFunction function,const NavigationAction & action,const ResourceRequest & request,PassRefPtr<FormState>)690 void 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 
dispatchUnableToImplementPolicy(const ResourceError &)707 void FrameLoaderClientHaiku::dispatchUnableToImplementPolicy(const ResourceError&)
708 {
709     notImplemented();
710 }
711 
startDownload(const ResourceRequest &)712 void FrameLoaderClientHaiku::startDownload(const ResourceRequest&)
713 {
714     notImplemented();
715 }
716 
createFrame(const KURL & url,const String & name,HTMLFrameOwnerElement * ownerElement,const String & referrer,bool allowsScrolling,int marginWidth,int marginHeight)717 PassRefPtr<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 
didTransferChildFrameToNewDocument(Page *)749 void FrameLoaderClientHaiku::didTransferChildFrameToNewDocument(Page*)
750 {
751 }
752 
transferLoadingResourceFromPage(unsigned long,DocumentLoader *,const ResourceRequest &,Page *)753 void FrameLoaderClientHaiku::transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*)
754 {
755 }
756 
objectContentType(const KURL & url,const String & mimeType,bool shouldPreferPlugInsForImages)757 ObjectContentType FrameLoaderClientHaiku::objectContentType(const KURL& url, const String& mimeType, bool shouldPreferPlugInsForImages)
758 {
759     notImplemented();
760     return ObjectContentType();
761 }
762 
createPlugin(const IntSize &,HTMLPlugInElement *,const KURL &,const Vector<String> &,const Vector<String> &,const String &,bool loadManually)763 PassRefPtr<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 
redirectDataToPlugin(Widget * pluginWidget)772 void FrameLoaderClientHaiku::redirectDataToPlugin(Widget* pluginWidget)
773 {
774     notImplemented();
775     return;
776 }
777 
pluginWillHandleLoadError(const ResourceResponse & response)778 ResourceError FrameLoaderClientHaiku::pluginWillHandleLoadError(const ResourceResponse& response)
779 {
780     notImplemented();
781     return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String());
782 }
783 
createJavaAppletWidget(const IntSize &,HTMLAppletElement *,const KURL & baseURL,const Vector<String> & paramNames,const Vector<String> & paramValues)784 PassRefPtr<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 
overrideMediaType() const793 String FrameLoaderClientHaiku::overrideMediaType() const
794 {
795     notImplemented();
796     return String();
797 }
798 
dispatchDidClearWindowObjectInWorld(DOMWrapperWorld * world)799 void 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 
documentElementAvailable()810 void FrameLoaderClientHaiku::documentElementAvailable()
811 {
812 }
813 
didPerformFirstNavigation() const814 void FrameLoaderClientHaiku::didPerformFirstNavigation() const
815 {
816     notImplemented();
817 }
818 
registerForIconNotification(bool listen)819 void FrameLoaderClientHaiku::registerForIconNotification(bool listen)
820 {
821     notImplemented();
822 }
823 
savePlatformDataToCachedFrame(CachedFrame *)824 void FrameLoaderClientHaiku::savePlatformDataToCachedFrame(CachedFrame*)
825 {
826     notImplemented();
827 }
828 
transitionToCommittedFromCachedFrame(CachedFrame *)829 void FrameLoaderClientHaiku::transitionToCommittedFromCachedFrame(CachedFrame*)
830 {
831     notImplemented();
832 }
833 
transitionToCommittedForNewPage()834 void 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 
didSaveToPageCache()865 void FrameLoaderClientHaiku::didSaveToPageCache()
866 {
867 }
868 
didRestoreFromPageCache()869 void FrameLoaderClientHaiku::didRestoreFromPageCache()
870 {
871 }
872 
dispatchDidBecomeFrameset(bool)873 void FrameLoaderClientHaiku::dispatchDidBecomeFrameset(bool)
874 {
875 }
876 
877 } // namespace WebCore
878