• 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 "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 String & title)240 void FrameLoaderClientHaiku::dispatchDidReceiveTitle(const String& title)
241 {
242     if (m_webView) {
243         m_webView->SetPageTitle(title);
244 
245         BMessage message(TITLE_CHANGED);
246         message.AddString("title", title);
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->loader()->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->loader()->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 
canShowMIMEType(const String & MIMEType) const364 bool FrameLoaderClientHaiku::canShowMIMEType(const String& MIMEType) const
365 {
366     notImplemented();
367     return true;
368 }
369 
representationExistsForURLScheme(const String & URLScheme) const370 bool FrameLoaderClientHaiku::representationExistsForURLScheme(const String& URLScheme) const
371 {
372     notImplemented();
373     return false;
374 }
375 
generatedMIMETypeForURLScheme(const String & URLScheme) const376 String FrameLoaderClientHaiku::generatedMIMETypeForURLScheme(const String& URLScheme) const
377 {
378     notImplemented();
379     return String();
380 }
381 
frameLoadCompleted()382 void FrameLoaderClientHaiku::frameLoadCompleted()
383 {
384     if (m_webView->LockLooper()) {
385         m_webView->Draw(m_webView->Bounds());
386         m_webView->UnlockLooper();
387     }
388 }
389 
saveViewStateToItem(HistoryItem *)390 void FrameLoaderClientHaiku::saveViewStateToItem(HistoryItem*)
391 {
392     notImplemented();
393 }
394 
restoreViewState()395 void FrameLoaderClientHaiku::restoreViewState()
396 {
397     notImplemented();
398 }
399 
restoreScrollPositionAndViewState()400 void FrameLoaderClientHaiku::restoreScrollPositionAndViewState()
401 {
402     notImplemented();
403 }
404 
provisionalLoadStarted()405 void FrameLoaderClientHaiku::provisionalLoadStarted()
406 {
407     notImplemented();
408 }
409 
shouldTreatURLAsSameAsCurrent(const KURL &) const410 bool FrameLoaderClientHaiku::shouldTreatURLAsSameAsCurrent(const KURL&) const
411 {
412     notImplemented();
413     return false;
414 }
415 
addHistoryItemForFragmentScroll()416 void FrameLoaderClientHaiku::addHistoryItemForFragmentScroll()
417 {
418     notImplemented();
419 }
420 
didFinishLoad()421 void FrameLoaderClientHaiku::didFinishLoad()
422 {
423     notImplemented();
424 }
425 
prepareForDataSourceReplacement()426 void FrameLoaderClientHaiku::prepareForDataSourceReplacement()
427 {
428     notImplemented();
429 }
430 
setTitle(const String & title,const KURL &)431 void FrameLoaderClientHaiku::setTitle(const String& title, const KURL&)
432 {
433     notImplemented();
434 }
435 
userAgent(const KURL &)436 String FrameLoaderClientHaiku::userAgent(const KURL&)
437 {
438     return String("Mozilla/5.0 (compatible; U; InfiNet 0.1; Haiku) AppleWebKit/420+ (KHTML, like Gecko)");
439 }
440 
dispatchDidReceiveIcon()441 void FrameLoaderClientHaiku::dispatchDidReceiveIcon()
442 {
443     notImplemented();
444 }
445 
frameLoaderDestroyed()446 void FrameLoaderClientHaiku::frameLoaderDestroyed()
447 {
448     m_frame = 0;
449     m_messenger = 0;
450     delete this;
451 }
452 
canHandleRequest(const WebCore::ResourceRequest &) const453 bool FrameLoaderClientHaiku::canHandleRequest(const WebCore::ResourceRequest&) const
454 {
455     notImplemented();
456     return true;
457 }
458 
partClearedInBegin()459 void FrameLoaderClientHaiku::partClearedInBegin()
460 {
461     notImplemented();
462 }
463 
updateGlobalHistory()464 void FrameLoaderClientHaiku::updateGlobalHistory()
465 {
466     notImplemented();
467 }
468 
updateGlobalHistoryRedirectLinks()469 void FrameLoaderClientHaiku::updateGlobalHistoryRedirectLinks()
470 {
471     notImplemented();
472 }
473 
shouldGoToHistoryItem(WebCore::HistoryItem *) const474 bool FrameLoaderClientHaiku::shouldGoToHistoryItem(WebCore::HistoryItem*) const
475 {
476     notImplemented();
477     return true;
478 }
479 
dispatchDidAddBackForwardItem(WebCore::HistoryItem *) const480 void FrameLoaderClientHaiku::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
481 {
482 }
483 
dispatchDidRemoveBackForwardItem(WebCore::HistoryItem *) const484 void FrameLoaderClientHaiku::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
485 {
486 }
487 
dispatchDidChangeBackForwardIndex() const488 void FrameLoaderClientHaiku::dispatchDidChangeBackForwardIndex() const
489 {
490 }
491 
saveScrollPositionAndViewStateToItem(WebCore::HistoryItem *)492 void FrameLoaderClientHaiku::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*)
493 {
494     notImplemented();
495 }
496 
canCachePage() const497 bool FrameLoaderClientHaiku::canCachePage() const
498 {
499     return false;
500 }
501 
setMainDocumentError(WebCore::DocumentLoader *,const WebCore::ResourceError &)502 void FrameLoaderClientHaiku::setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&)
503 {
504     notImplemented();
505 }
506 
committedLoad(WebCore::DocumentLoader * loader,const char * data,int length)507 void FrameLoaderClientHaiku::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
508 {
509     if (!m_frame)
510         return;
511 
512     FrameLoader* frameLoader = loader->frameLoader();
513     frameLoader->setEncoding(m_response.textEncodingName(), false);
514     frameLoader->addData(data, length);
515 }
516 
cancelledError(const WebCore::ResourceRequest & request)517 WebCore::ResourceError FrameLoaderClientHaiku::cancelledError(const WebCore::ResourceRequest& request)
518 {
519     notImplemented();
520     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
521 }
522 
blockedError(const ResourceRequest & request)523 WebCore::ResourceError FrameLoaderClientHaiku::blockedError(const ResourceRequest& request)
524 {
525     notImplemented();
526     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
527 }
528 
cannotShowURLError(const WebCore::ResourceRequest & request)529 WebCore::ResourceError FrameLoaderClientHaiku::cannotShowURLError(const WebCore::ResourceRequest& request)
530 {
531     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
532 }
533 
interruptForPolicyChangeError(const WebCore::ResourceRequest & request)534 WebCore::ResourceError FrameLoaderClientHaiku::interruptForPolicyChangeError(const WebCore::ResourceRequest& request)
535 {
536     notImplemented();
537     return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String());
538 }
539 
cannotShowMIMETypeError(const WebCore::ResourceResponse & response)540 WebCore::ResourceError FrameLoaderClientHaiku::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
541 {
542     notImplemented();
543     return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String());
544 }
545 
fileDoesNotExistError(const WebCore::ResourceResponse & response)546 WebCore::ResourceError FrameLoaderClientHaiku::fileDoesNotExistError(const WebCore::ResourceResponse& response)
547 {
548     notImplemented();
549     return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String());
550 }
551 
shouldFallBack(const WebCore::ResourceError & error)552 bool FrameLoaderClientHaiku::shouldFallBack(const WebCore::ResourceError& error)
553 {
554     notImplemented();
555     return false;
556 }
557 
createDocumentLoader(const ResourceRequest & request,const SubstituteData & substituteData)558 WTF::PassRefPtr<DocumentLoader> FrameLoaderClientHaiku::createDocumentLoader(const ResourceRequest& request,
559                                                                              const SubstituteData& substituteData)
560 {
561     return DocumentLoader::create(request, substituteData);
562 }
563 
download(ResourceHandle *,const ResourceRequest &,const ResourceRequest &,const ResourceResponse &)564 void FrameLoaderClientHaiku::download(ResourceHandle*, const ResourceRequest&,
565                                       const ResourceRequest&, const ResourceResponse&)
566 {
567     notImplemented();
568 }
569 
assignIdentifierToInitialRequest(unsigned long identifier,DocumentLoader *,const ResourceRequest &)570 void FrameLoaderClientHaiku::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*,
571                                                               const ResourceRequest&)
572 {
573     notImplemented();
574 }
575 
dispatchWillSendRequest(DocumentLoader *,unsigned long,ResourceRequest & request,const ResourceResponse & response)576 void FrameLoaderClientHaiku::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest& request,
577                                                      const ResourceResponse& response)
578 {
579     notImplemented();
580 }
581 
shouldUseCredentialStorage(DocumentLoader *,unsigned long)582 bool FrameLoaderClientHaiku::shouldUseCredentialStorage(DocumentLoader*, unsigned long)
583 {
584     notImplemented();
585     return false;
586 }
587 
dispatchDidReceiveAuthenticationChallenge(DocumentLoader *,unsigned long,const AuthenticationChallenge &)588 void FrameLoaderClientHaiku::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*,
589                                                                        unsigned long, const AuthenticationChallenge&)
590 {
591     notImplemented();
592 }
593 
dispatchDidCancelAuthenticationChallenge(DocumentLoader *,unsigned long,const AuthenticationChallenge &)594 void FrameLoaderClientHaiku::dispatchDidCancelAuthenticationChallenge(DocumentLoader*,
595                                                                       unsigned long, const AuthenticationChallenge&)
596 {
597     notImplemented();
598 }
599 
dispatchDidReceiveResponse(DocumentLoader * loader,unsigned long id,const ResourceResponse & response)600 void FrameLoaderClientHaiku::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long id,
601                                                         const ResourceResponse& response)
602 {
603     notImplemented();
604     m_response = response;
605     m_firstData = true;
606 }
607 
dispatchDidReceiveContentLength(DocumentLoader * loader,unsigned long id,int length)608 void FrameLoaderClientHaiku::dispatchDidReceiveContentLength(DocumentLoader* loader,
609                                                              unsigned long id, int length)
610 {
611     notImplemented();
612 }
613 
dispatchDidFinishLoading(DocumentLoader *,unsigned long)614 void FrameLoaderClientHaiku::dispatchDidFinishLoading(DocumentLoader*, unsigned long)
615 {
616     notImplemented();
617 }
618 
dispatchDidFailLoading(DocumentLoader * loader,unsigned long,const ResourceError &)619 void FrameLoaderClientHaiku::dispatchDidFailLoading(DocumentLoader* loader,
620                                                     unsigned long, const ResourceError&)
621 {
622     if (m_webView) {
623         BMessage message(LOAD_FAILED);
624         message.AddString("url", m_frame->loader()->documentLoader()->request().url().string());
625         m_messenger->SendMessage(&message);
626     }
627 }
628 
dispatchDidLoadResourceFromMemoryCache(DocumentLoader *,const ResourceRequest &,const ResourceResponse &,int)629 bool FrameLoaderClientHaiku::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*,
630                                                                     const ResourceRequest&,
631                                                                     const ResourceResponse&, int)
632 {
633     notImplemented();
634     return false;
635 }
636 
dispatchDidLoadResourceByXMLHttpRequest(unsigned long,const ScriptString &)637 void FrameLoaderClientHaiku::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&)
638 {
639     notImplemented();
640 }
641 
dispatchDidFailProvisionalLoad(const ResourceError &)642 void FrameLoaderClientHaiku::dispatchDidFailProvisionalLoad(const ResourceError&)
643 {
644     notImplemented();
645 }
646 
dispatchDidFailLoad(const ResourceError &)647 void FrameLoaderClientHaiku::dispatchDidFailLoad(const ResourceError&)
648 {
649     notImplemented();
650 }
651 
dispatchCreatePage()652 Frame* FrameLoaderClientHaiku::dispatchCreatePage()
653 {
654     notImplemented();
655     return false;
656 }
657 
dispatchDecidePolicyForMIMEType(FramePolicyFunction function,const String & mimetype,const ResourceRequest & request)658 void FrameLoaderClientHaiku::dispatchDecidePolicyForMIMEType(FramePolicyFunction function,
659                                                              const String& mimetype,
660                                                              const ResourceRequest& request)
661 {
662     if (!m_frame)
663         return;
664 
665     notImplemented();
666     (m_frame->loader()->policyChecker()->*function)(PolicyUse);
667 }
668 
dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function,const NavigationAction &,const ResourceRequest & request,PassRefPtr<FormState>,const String & targetName)669 void FrameLoaderClientHaiku::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function,
670                                                                     const NavigationAction&,
671                                                                     const ResourceRequest& request,
672                                                                     PassRefPtr<FormState>, const String& targetName)
673 {
674     if (!m_frame)
675         return;
676 
677     if (m_webView) {
678         BMessage message(NEW_WINDOW_REQUESTED);
679         message.AddString("url", request.url().string());
680         if (m_messenger->SendMessage(&message)) {
681             (m_frame->loader()->policyChecker()->*function)(PolicyIgnore);
682             return;
683         }
684     }
685 
686     (m_frame->loader()->policyChecker()->*function)(PolicyUse);
687 }
688 
dispatchDecidePolicyForNavigationAction(FramePolicyFunction function,const NavigationAction & action,const ResourceRequest & request,PassRefPtr<FormState>)689 void FrameLoaderClientHaiku::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function,
690                                                                      const NavigationAction& action,
691                                                                      const ResourceRequest& request,
692                                                                      PassRefPtr<FormState>)
693 {
694     if (!m_frame || !function)
695         return;
696 
697     if (m_webView) {
698         BMessage message(NAVIGATION_REQUESTED);
699         message.AddString("url", request.url().string());
700         m_messenger->SendMessage(&message);
701 
702         (m_frame->loader()->policyChecker()->*function)(PolicyUse);
703     }
704 }
705 
dispatchUnableToImplementPolicy(const ResourceError &)706 void FrameLoaderClientHaiku::dispatchUnableToImplementPolicy(const ResourceError&)
707 {
708     notImplemented();
709 }
710 
startDownload(const ResourceRequest &)711 void FrameLoaderClientHaiku::startDownload(const ResourceRequest&)
712 {
713     notImplemented();
714 }
715 
createFrame(const KURL & url,const String & name,HTMLFrameOwnerElement * ownerElement,const String & referrer,bool allowsScrolling,int marginWidth,int marginHeight)716 PassRefPtr<Frame> FrameLoaderClientHaiku::createFrame(const KURL& url, const String& name,
717                                                       HTMLFrameOwnerElement* ownerElement,
718                                                       const String& referrer, bool allowsScrolling,
719                                                       int marginWidth, int marginHeight)
720 {
721     // FIXME: We should apply the right property to the frameView. (scrollbar,margins)
722 
723     RefPtr<Frame> childFrame = Frame::create(m_frame->page(), ownerElement, this);
724     setFrame(childFrame.get());
725 
726     RefPtr<FrameView> frameView = FrameView::create(childFrame.get());
727 
728     frameView->setAllowsScrolling(allowsScrolling);
729     frameView->deref();
730     childFrame->setView(frameView.get());
731     childFrame->init();
732 
733     childFrame->tree()->setName(name);
734     m_frame->tree()->appendChild(childFrame);
735 
736     childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
737 
738     // The frame's onload handler may have removed it from the document.
739     if (!childFrame->tree()->parent())
740         return 0;
741 
742     return childFrame.release();
743 
744     notImplemented();
745     return 0;
746 }
747 
objectContentType(const KURL & url,const String & mimeType)748 ObjectContentType FrameLoaderClientHaiku::objectContentType(const KURL& url, const String& mimeType)
749 {
750     notImplemented();
751     return ObjectContentType();
752 }
753 
createPlugin(const IntSize &,HTMLPlugInElement *,const KURL &,const Vector<String> &,const Vector<String> &,const String &,bool loadManually)754 PassRefPtr<Widget> FrameLoaderClientHaiku::createPlugin(const IntSize&, HTMLPlugInElement*,
755                                                         const KURL&, const Vector<String>&,
756                                                         const Vector<String>&, const String&,
757                                                         bool loadManually)
758 {
759     notImplemented();
760     return 0;
761 }
762 
redirectDataToPlugin(Widget * pluginWidget)763 void FrameLoaderClientHaiku::redirectDataToPlugin(Widget* pluginWidget)
764 {
765     notImplemented();
766     return;
767 }
768 
pluginWillHandleLoadError(const ResourceResponse & response)769 ResourceError FrameLoaderClientHaiku::pluginWillHandleLoadError(const ResourceResponse& response)
770 {
771     notImplemented();
772     return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String());
773 }
774 
createJavaAppletWidget(const IntSize &,HTMLAppletElement *,const KURL & baseURL,const Vector<String> & paramNames,const Vector<String> & paramValues)775 PassRefPtr<Widget> FrameLoaderClientHaiku::createJavaAppletWidget(const IntSize&, HTMLAppletElement*,
776                                                        const KURL& baseURL,
777                                                        const Vector<String>& paramNames,
778                                                        const Vector<String>& paramValues)
779 {
780     notImplemented();
781     return 0;
782 }
783 
overrideMediaType() const784 String FrameLoaderClientHaiku::overrideMediaType() const
785 {
786     notImplemented();
787     return String();
788 }
789 
dispatchDidClearWindowObjectInWorld(DOMWrapperWorld * world)790 void FrameLoaderClientHaiku::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
791 {
792     if (world != mainThreadNormalWorld())
793         return;
794 
795     if (m_webView) {
796         BMessage message(JAVASCRIPT_WINDOW_OBJECT_CLEARED);
797         m_messenger->SendMessage(&message);
798     }
799 }
800 
documentElementAvailable()801 void FrameLoaderClientHaiku::documentElementAvailable()
802 {
803 }
804 
didPerformFirstNavigation() const805 void FrameLoaderClientHaiku::didPerformFirstNavigation() const
806 {
807     notImplemented();
808 }
809 
registerForIconNotification(bool listen)810 void FrameLoaderClientHaiku::registerForIconNotification(bool listen)
811 {
812     notImplemented();
813 }
814 
savePlatformDataToCachedFrame(CachedFrame *)815 void FrameLoaderClientHaiku::savePlatformDataToCachedFrame(CachedFrame*)
816 {
817     notImplemented();
818 }
819 
transitionToCommittedFromCachedFrame(CachedFrame *)820 void FrameLoaderClientHaiku::transitionToCommittedFromCachedFrame(CachedFrame*)
821 {
822     notImplemented();
823 }
824 
transitionToCommittedForNewPage()825 void FrameLoaderClientHaiku::transitionToCommittedForNewPage()
826 {
827     ASSERT(m_frame);
828     ASSERT(m_webView);
829 
830     Page* page = m_frame->page();
831     ASSERT(page);
832 
833     bool isMainFrame = m_frame == page->mainFrame();
834 
835     m_frame->setView(0);
836 
837     RefPtr<FrameView> frameView;
838     if (isMainFrame) {
839         if (m_webView->LockLooper()) {
840             // We lock the looper in order to get the bounds of the WebView.
841             frameView = FrameView::create(m_frame, IntRect(m_webView->Bounds()).size());
842             m_webView->UnlockLooper();
843         }
844     } else
845         frameView = FrameView::create(m_frame);
846 
847     ASSERT(frameView);
848     m_frame->setView(frameView);
849 
850     frameView->setPlatformWidget(m_webView);
851 
852     if (HTMLFrameOwnerElement* owner = m_frame->ownerElement())
853         m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode());
854 }
855 
856 } // namespace WebCore
857 
858