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