WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 <JavaScriptCore/JavaScript.h>
       
    32 #include <JavaScriptCore/APICast.h>
       
    33 
       
    34 #include "DocumentLoader.h"
       
    35 #include "FormState.h"
       
    36 #include "Frame.h"
       
    37 #include "FrameLoaderTypes.h"
       
    38 #include "FrameView.h"
       
    39 #include "FrameTree.h"
       
    40 #include "PluginView.h"
       
    41 #include "HTMLFormElement.h"
       
    42 #include "HTMLFrameOwnerElement.h"
       
    43 #include "NotImplemented.h"
       
    44 #include "Page.h"
       
    45 #include "PlatformString.h"
       
    46 #include "PluginView.h"
       
    47 #include "ProgressTracker.h"
       
    48 #include "RenderPart.h"
       
    49 #include "ResourceError.h"
       
    50 #include "ResourceResponse.h"
       
    51 #include "ScriptController.h"
       
    52 #include "ScriptString.h"
       
    53 #include <wtf/PassRefPtr.h>
       
    54 #include <wtf/RefPtr.h>
       
    55 
       
    56 #include <stdio.h>
       
    57 
       
    58 #include "WebFrame.h"
       
    59 #include "WebFramePrivate.h"
       
    60 #include "WebView.h"
       
    61 #include "WebViewPrivate.h"
       
    62 
       
    63 namespace WebCore {
       
    64 
       
    65 inline int wxNavTypeFromWebNavType(NavigationType type){
       
    66     if (type == NavigationTypeLinkClicked)
       
    67         return wxWEBVIEW_NAV_LINK_CLICKED;
       
    68     
       
    69     if (type == NavigationTypeFormSubmitted)
       
    70         return wxWEBVIEW_NAV_FORM_SUBMITTED;
       
    71         
       
    72     if (type == NavigationTypeBackForward)
       
    73         return wxWEBVIEW_NAV_BACK_NEXT;
       
    74         
       
    75     if (type == NavigationTypeReload)
       
    76         return wxWEBVIEW_NAV_RELOAD;
       
    77         
       
    78     if (type == NavigationTypeFormResubmitted)
       
    79         return wxWEBVIEW_NAV_FORM_RESUBMITTED;
       
    80         
       
    81     return wxWEBVIEW_NAV_OTHER;
       
    82 }
       
    83 
       
    84 FrameLoaderClientWx::FrameLoaderClientWx()
       
    85     : m_frame(0)
       
    86     , m_pluginView(0)
       
    87     , m_hasSentResponseToPlugin(false)
       
    88     , m_webFrame(0)
       
    89 {
       
    90 }
       
    91 
       
    92 
       
    93 FrameLoaderClientWx::~FrameLoaderClientWx()
       
    94 {
       
    95 }
       
    96 
       
    97 void FrameLoaderClientWx::setFrame(wxWebFrame *frame)
       
    98 {
       
    99     m_webFrame = frame;
       
   100     m_frame = m_webFrame->m_impl->frame;
       
   101 }
       
   102 
       
   103 void FrameLoaderClientWx::setWebView(wxWebView *webview)
       
   104 {
       
   105     m_webView = webview;
       
   106 }
       
   107 
       
   108 bool FrameLoaderClientWx::hasWebView() const
       
   109 {
       
   110     return m_webView != NULL;
       
   111 }
       
   112 
       
   113 bool FrameLoaderClientWx::hasBackForwardList() const
       
   114 {
       
   115     notImplemented();
       
   116     return true;
       
   117 }
       
   118 
       
   119 
       
   120 void FrameLoaderClientWx::resetBackForwardList()
       
   121 {
       
   122     notImplemented();
       
   123 }
       
   124 
       
   125 
       
   126 bool FrameLoaderClientWx::provisionalItemIsTarget() const
       
   127 {
       
   128     notImplemented();
       
   129     return false;
       
   130 }
       
   131 
       
   132 void FrameLoaderClientWx::makeRepresentation(DocumentLoader*)
       
   133 {
       
   134     notImplemented();
       
   135 }
       
   136 
       
   137 
       
   138 void FrameLoaderClientWx::forceLayout()
       
   139 {
       
   140     notImplemented();
       
   141 }
       
   142 
       
   143 
       
   144 void FrameLoaderClientWx::forceLayoutForNonHTML()
       
   145 {
       
   146     notImplemented();
       
   147 }
       
   148 
       
   149 
       
   150 void FrameLoaderClientWx::updateHistoryForCommit()
       
   151 {
       
   152     notImplemented();
       
   153 }
       
   154 
       
   155 
       
   156 void FrameLoaderClientWx::updateHistoryForBackForwardNavigation()
       
   157 {
       
   158     notImplemented();
       
   159 }
       
   160 
       
   161 
       
   162 void FrameLoaderClientWx::updateHistoryForReload()
       
   163 {
       
   164     notImplemented();
       
   165 }
       
   166 
       
   167 
       
   168 void FrameLoaderClientWx::updateHistoryForStandardLoad()
       
   169 {
       
   170     notImplemented();
       
   171 }
       
   172 
       
   173 
       
   174 void FrameLoaderClientWx::updateHistoryForInternalLoad()
       
   175 {
       
   176     notImplemented();
       
   177 }
       
   178 
       
   179 
       
   180 void FrameLoaderClientWx::updateHistoryAfterClientRedirect()
       
   181 {
       
   182     notImplemented();
       
   183 }
       
   184 
       
   185 
       
   186 void FrameLoaderClientWx::setCopiesOnScroll()
       
   187 {
       
   188     // apparently mac specific
       
   189     notImplemented();
       
   190 }
       
   191 
       
   192 
       
   193 LoadErrorResetToken* FrameLoaderClientWx::tokenForLoadErrorReset()
       
   194 {
       
   195     notImplemented();
       
   196     return 0;
       
   197 }
       
   198 
       
   199 
       
   200 void FrameLoaderClientWx::resetAfterLoadError(LoadErrorResetToken*)
       
   201 {
       
   202     notImplemented();
       
   203 }
       
   204 
       
   205 
       
   206 void FrameLoaderClientWx::doNotResetAfterLoadError(LoadErrorResetToken*)
       
   207 {
       
   208     notImplemented();
       
   209 }
       
   210 
       
   211 
       
   212 void FrameLoaderClientWx::willCloseDocument()
       
   213 {
       
   214     notImplemented();
       
   215 }
       
   216 
       
   217 
       
   218 void FrameLoaderClientWx::detachedFromParent2()
       
   219 {
       
   220     notImplemented();
       
   221 }
       
   222 
       
   223 
       
   224 void FrameLoaderClientWx::detachedFromParent3()
       
   225 {
       
   226     notImplemented();
       
   227 }
       
   228 
       
   229 void FrameLoaderClientWx::dispatchDidHandleOnloadEvents()
       
   230 {
       
   231     if (m_webView) {
       
   232         wxWebViewLoadEvent wkEvent(m_webView);
       
   233         wkEvent.SetState(wxWEBVIEW_LOAD_ONLOAD_HANDLED);
       
   234         wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string());
       
   235         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   236     }
       
   237 }
       
   238 
       
   239 
       
   240 void FrameLoaderClientWx::dispatchDidReceiveServerRedirectForProvisionalLoad()
       
   241 {
       
   242     notImplemented();
       
   243 }
       
   244 
       
   245 
       
   246 void FrameLoaderClientWx::dispatchDidCancelClientRedirect()
       
   247 {
       
   248     notImplemented();
       
   249 }
       
   250 
       
   251 
       
   252 void FrameLoaderClientWx::dispatchWillPerformClientRedirect(const KURL&,
       
   253                                                             double interval,
       
   254                                                             double fireDate)
       
   255 {
       
   256     notImplemented();
       
   257 }
       
   258 
       
   259 
       
   260 void FrameLoaderClientWx::dispatchDidChangeLocationWithinPage()
       
   261 {
       
   262     notImplemented();
       
   263 }
       
   264 
       
   265 void FrameLoaderClientWx::dispatchDidPushStateWithinPage()
       
   266 {
       
   267     notImplemented();
       
   268 }
       
   269 
       
   270 void FrameLoaderClientWx::dispatchDidReplaceStateWithinPage()
       
   271 {
       
   272     notImplemented();
       
   273 }
       
   274 
       
   275 void FrameLoaderClientWx::dispatchDidPopStateWithinPage()
       
   276 {
       
   277     notImplemented();
       
   278 }
       
   279 
       
   280 void FrameLoaderClientWx::dispatchWillClose()
       
   281 {
       
   282     notImplemented();
       
   283 }
       
   284 
       
   285 
       
   286 void FrameLoaderClientWx::dispatchDidStartProvisionalLoad()
       
   287 {
       
   288     if (m_webView) {
       
   289         wxWebViewLoadEvent wkEvent(m_webView);
       
   290         wkEvent.SetState(wxWEBVIEW_LOAD_NEGOTIATING);
       
   291         wkEvent.SetURL(m_frame->loader()->provisionalDocumentLoader()->request().url().string());
       
   292         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   293     }
       
   294 }
       
   295 
       
   296 
       
   297 void FrameLoaderClientWx::dispatchDidReceiveTitle(const String& title)
       
   298 {
       
   299     if (m_webView) {
       
   300         m_webView->SetPageTitle(title);
       
   301         wxWebViewReceivedTitleEvent wkEvent(m_webView);
       
   302         wkEvent.SetTitle(title);
       
   303         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   304     }
       
   305 }
       
   306 
       
   307 
       
   308 void FrameLoaderClientWx::dispatchDidCommitLoad()
       
   309 {
       
   310     if (m_webView) {
       
   311         wxWebViewLoadEvent wkEvent(m_webView);
       
   312         wkEvent.SetState(wxWEBVIEW_LOAD_TRANSFERRING);
       
   313         wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string());
       
   314         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   315     }
       
   316 }
       
   317 
       
   318 void FrameLoaderClientWx::dispatchDidFinishDocumentLoad()
       
   319 {
       
   320     if (m_webView) {
       
   321         wxWebViewLoadEvent wkEvent(m_webView);
       
   322         wkEvent.SetState(wxWEBVIEW_LOAD_DOC_COMPLETED);
       
   323         wkEvent.SetURL(m_frame->loader()->url().string());
       
   324         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   325     }
       
   326 }
       
   327 
       
   328 void FrameLoaderClientWx::dispatchDidChangeIcons()
       
   329 {
       
   330     notImplemented();
       
   331 }
       
   332 
       
   333 void FrameLoaderClientWx::dispatchDidFinishLoad()
       
   334 {
       
   335     notImplemented();
       
   336 }
       
   337 
       
   338 
       
   339 void FrameLoaderClientWx::dispatchDidFirstLayout()
       
   340 {
       
   341     notImplemented();
       
   342 }
       
   343 
       
   344 void FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout()
       
   345 {
       
   346     notImplemented();
       
   347 }
       
   348 
       
   349 void FrameLoaderClientWx::dispatchShow()
       
   350 {
       
   351     notImplemented();
       
   352 }
       
   353 
       
   354 
       
   355 void FrameLoaderClientWx::cancelPolicyCheck()
       
   356 {
       
   357     notImplemented();
       
   358 }
       
   359 
       
   360 
       
   361 void FrameLoaderClientWx::dispatchWillSubmitForm(FramePolicyFunction function,
       
   362                                                  PassRefPtr<FormState>)
       
   363 {
       
   364     // FIXME: Send an event to allow for alerts and cancellation
       
   365     if (!m_webFrame)
       
   366         return;
       
   367     (m_frame->loader()->policyChecker()->*function)(PolicyUse);
       
   368 }
       
   369 
       
   370 
       
   371 void FrameLoaderClientWx::dispatchDidLoadMainResource(DocumentLoader*)
       
   372 {
       
   373     notImplemented();
       
   374 }
       
   375 
       
   376 
       
   377 void FrameLoaderClientWx::revertToProvisionalState(DocumentLoader*)
       
   378 {
       
   379     notImplemented();
       
   380 }
       
   381 
       
   382 void FrameLoaderClientWx::postProgressStartedNotification()
       
   383 {
       
   384     notImplemented();
       
   385 }
       
   386 
       
   387 void FrameLoaderClientWx::postProgressEstimateChangedNotification()
       
   388 {
       
   389     notImplemented();
       
   390 }
       
   391 
       
   392 void FrameLoaderClientWx::postProgressFinishedNotification()
       
   393 {
       
   394     if (m_webView) {
       
   395         wxWebViewLoadEvent wkEvent(m_webView);
       
   396         wkEvent.SetState(wxWEBVIEW_LOAD_DL_COMPLETED);
       
   397         wkEvent.SetURL(m_frame->loader()->url().string());
       
   398         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   399     }
       
   400 }
       
   401 
       
   402 void FrameLoaderClientWx::progressStarted()
       
   403 {
       
   404     notImplemented();
       
   405 }
       
   406 
       
   407 
       
   408 void FrameLoaderClientWx::progressCompleted()
       
   409 {
       
   410     notImplemented();
       
   411 }
       
   412 
       
   413 
       
   414 void FrameLoaderClientWx::setMainFrameDocumentReady(bool b)
       
   415 {
       
   416     notImplemented();
       
   417     // this is only interesting once we provide an external API for the DOM
       
   418 }
       
   419 
       
   420 
       
   421 void FrameLoaderClientWx::willChangeTitle(DocumentLoader*)
       
   422 {
       
   423     notImplemented();
       
   424 }
       
   425 
       
   426 
       
   427 void FrameLoaderClientWx::didChangeTitle(DocumentLoader *l)
       
   428 {
       
   429     setTitle(l->title(), l->url());
       
   430 }
       
   431 
       
   432 
       
   433 void FrameLoaderClientWx::finishedLoading(DocumentLoader*)
       
   434 {
       
   435     if (m_pluginView) {
       
   436         m_pluginView->didFinishLoading();
       
   437         m_pluginView = 0;
       
   438         m_hasSentResponseToPlugin = false;
       
   439     }
       
   440 }
       
   441 
       
   442 
       
   443 bool FrameLoaderClientWx::canShowMIMEType(const String& MIMEType) const
       
   444 {
       
   445     notImplemented();
       
   446     return true;
       
   447 }
       
   448 
       
   449 
       
   450 bool FrameLoaderClientWx::representationExistsForURLScheme(const String& URLScheme) const
       
   451 {
       
   452     notImplemented();
       
   453     return false;
       
   454 }
       
   455 
       
   456 
       
   457 String FrameLoaderClientWx::generatedMIMETypeForURLScheme(const String& URLScheme) const
       
   458 {
       
   459     notImplemented();
       
   460     return String();
       
   461 }
       
   462 
       
   463 
       
   464 void FrameLoaderClientWx::frameLoadCompleted()
       
   465 {
       
   466     notImplemented();
       
   467 }
       
   468 
       
   469 void FrameLoaderClientWx::saveViewStateToItem(HistoryItem*)
       
   470 {
       
   471     notImplemented();
       
   472 }
       
   473 
       
   474 void FrameLoaderClientWx::restoreViewState()
       
   475 {
       
   476     notImplemented();
       
   477 }
       
   478         
       
   479 void FrameLoaderClientWx::restoreScrollPositionAndViewState()
       
   480 {
       
   481     notImplemented();
       
   482 }
       
   483 
       
   484 
       
   485 void FrameLoaderClientWx::provisionalLoadStarted()
       
   486 {
       
   487     notImplemented();
       
   488 }
       
   489 
       
   490 
       
   491 bool FrameLoaderClientWx::shouldTreatURLAsSameAsCurrent(const KURL&) const
       
   492 {
       
   493     notImplemented();
       
   494     return false;
       
   495 }
       
   496 
       
   497 
       
   498 void FrameLoaderClientWx::addHistoryItemForFragmentScroll()
       
   499 {
       
   500     notImplemented();
       
   501 }
       
   502 
       
   503 
       
   504 void FrameLoaderClientWx::didFinishLoad()
       
   505 {
       
   506     notImplemented();
       
   507 }
       
   508 
       
   509 
       
   510 void FrameLoaderClientWx::prepareForDataSourceReplacement()
       
   511 {
       
   512     notImplemented();
       
   513 }
       
   514 
       
   515 
       
   516 void FrameLoaderClientWx::setTitle(const String& title, const KURL&)
       
   517 {
       
   518     notImplemented();
       
   519 }
       
   520 
       
   521 
       
   522 String FrameLoaderClientWx::userAgent(const KURL&)
       
   523 {
       
   524     // FIXME: Use the new APIs introduced by the GTK port to fill in these values.
       
   525     return String("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418.9.1 (KHTML, like Gecko) Safari/419.3");
       
   526 }
       
   527 
       
   528 void FrameLoaderClientWx::dispatchDidReceiveIcon()
       
   529 {
       
   530     notImplemented();
       
   531 }
       
   532 
       
   533 void FrameLoaderClientWx::frameLoaderDestroyed()
       
   534 {
       
   535     if (m_webFrame)
       
   536         delete m_webFrame;
       
   537     m_webFrame = 0;
       
   538     m_frame = 0;
       
   539     delete this;
       
   540 }
       
   541 
       
   542 bool FrameLoaderClientWx::canHandleRequest(const WebCore::ResourceRequest&) const
       
   543 {
       
   544     notImplemented();
       
   545     return true;
       
   546 }
       
   547 
       
   548 void FrameLoaderClientWx::partClearedInBegin()
       
   549 {
       
   550     notImplemented();
       
   551 }
       
   552 
       
   553 void FrameLoaderClientWx::updateGlobalHistory()
       
   554 {
       
   555     notImplemented();
       
   556 }
       
   557 
       
   558 void FrameLoaderClientWx::updateGlobalHistoryRedirectLinks()
       
   559 {
       
   560     notImplemented();
       
   561 }
       
   562 
       
   563 bool FrameLoaderClientWx::shouldGoToHistoryItem(WebCore::HistoryItem*) const
       
   564 {
       
   565     notImplemented();
       
   566     return true;
       
   567 }
       
   568 
       
   569 void FrameLoaderClientWx::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
       
   570 {
       
   571 }
       
   572 
       
   573 void FrameLoaderClientWx::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
       
   574 {
       
   575 }
       
   576 
       
   577 void FrameLoaderClientWx::dispatchDidChangeBackForwardIndex() const
       
   578 {
       
   579 }
       
   580 
       
   581 void FrameLoaderClientWx::didDisplayInsecureContent()
       
   582 {
       
   583     notImplemented();
       
   584 }
       
   585 
       
   586 void FrameLoaderClientWx::didRunInsecureContent(WebCore::SecurityOrigin*)
       
   587 {
       
   588     notImplemented();
       
   589 }
       
   590 
       
   591 void FrameLoaderClientWx::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*)
       
   592 {
       
   593     notImplemented();
       
   594 }
       
   595 
       
   596 bool FrameLoaderClientWx::canCachePage() const
       
   597 {
       
   598     return false;
       
   599 }
       
   600 
       
   601 void FrameLoaderClientWx::setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&)
       
   602 {
       
   603     notImplemented();
       
   604 }
       
   605 
       
   606 void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
       
   607 {
       
   608     if (!m_webFrame)
       
   609         return;
       
   610     if (!m_pluginView) {
       
   611         FrameLoader* fl = loader->frameLoader();
       
   612         fl->writer()->setEncoding(m_response.textEncodingName(), false);
       
   613         fl->addData(data, length);
       
   614     }
       
   615     
       
   616     // We re-check here as the plugin can have been created
       
   617     if (m_pluginView) {
       
   618         if (!m_hasSentResponseToPlugin) {
       
   619             m_pluginView->didReceiveResponse(loader->response());
       
   620             // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in
       
   621             // setting up this stream can cause the main document load to be cancelled, setting m_pluginView
       
   622             // to null
       
   623             if (!m_pluginView)
       
   624                 return;
       
   625             m_hasSentResponseToPlugin = true;
       
   626         }
       
   627         m_pluginView->didReceiveData(data, length);
       
   628     }
       
   629 }
       
   630 
       
   631 WebCore::ResourceError FrameLoaderClientWx::cancelledError(const WebCore::ResourceRequest& request)
       
   632 {
       
   633     notImplemented();
       
   634     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
       
   635 }
       
   636 
       
   637 WebCore::ResourceError FrameLoaderClientWx::blockedError(const ResourceRequest& request)
       
   638 {
       
   639     notImplemented();
       
   640     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
       
   641 }
       
   642 
       
   643 WebCore::ResourceError FrameLoaderClientWx::cannotShowURLError(const WebCore::ResourceRequest& request)
       
   644 {
       
   645     return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
       
   646 }
       
   647 
       
   648 WebCore::ResourceError FrameLoaderClientWx::interruptForPolicyChangeError(const WebCore::ResourceRequest& request)
       
   649 {
       
   650     notImplemented();
       
   651     return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String());
       
   652 }
       
   653 
       
   654 WebCore::ResourceError FrameLoaderClientWx::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
       
   655 {
       
   656     notImplemented();
       
   657     return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String());
       
   658 }
       
   659 
       
   660 WebCore::ResourceError FrameLoaderClientWx::fileDoesNotExistError(const WebCore::ResourceResponse& response)
       
   661 {
       
   662     notImplemented();
       
   663     return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String());
       
   664 }
       
   665 
       
   666 bool FrameLoaderClientWx::shouldFallBack(const WebCore::ResourceError& error)
       
   667 {
       
   668     notImplemented();
       
   669     return false;
       
   670 }
       
   671 
       
   672 WTF::PassRefPtr<DocumentLoader> FrameLoaderClientWx::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
       
   673 {
       
   674     return DocumentLoader::create(request, substituteData);
       
   675 }
       
   676 
       
   677 void FrameLoaderClientWx::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&)
       
   678 {
       
   679     notImplemented();
       
   680 }
       
   681 
       
   682 void FrameLoaderClientWx::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&)
       
   683 {
       
   684     notImplemented();   
       
   685 }
       
   686 
       
   687 void FrameLoaderClientWx::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest& request, const ResourceResponse& response)
       
   688 {
       
   689     notImplemented();
       
   690 }
       
   691 
       
   692 bool FrameLoaderClientWx::shouldUseCredentialStorage(DocumentLoader*, unsigned long)
       
   693 {
       
   694     notImplemented();
       
   695     return false;
       
   696 }
       
   697 
       
   698 void FrameLoaderClientWx::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&)
       
   699 {
       
   700     notImplemented();
       
   701 }
       
   702 
       
   703 void FrameLoaderClientWx::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&)
       
   704 {
       
   705     notImplemented();
       
   706 }
       
   707 
       
   708 void FrameLoaderClientWx::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long id, const ResourceResponse& response)
       
   709 {
       
   710     notImplemented();
       
   711     m_response = response;
       
   712     m_firstData = true;
       
   713 }
       
   714 
       
   715 void FrameLoaderClientWx::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long id, int length)
       
   716 {
       
   717     notImplemented();
       
   718 }
       
   719 
       
   720 void FrameLoaderClientWx::dispatchDidFinishLoading(DocumentLoader*, unsigned long)
       
   721 {
       
   722     notImplemented();
       
   723 }
       
   724 
       
   725 void FrameLoaderClientWx::dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&)
       
   726 {
       
   727     if (m_webView) {
       
   728         wxWebViewLoadEvent wkEvent(m_webView);
       
   729         wkEvent.SetState(wxWEBVIEW_LOAD_FAILED);
       
   730         wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string());
       
   731         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   732     }
       
   733 }
       
   734 
       
   735 bool FrameLoaderClientWx::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int)
       
   736 {
       
   737     notImplemented();
       
   738     return false;
       
   739 }
       
   740 
       
   741 void FrameLoaderClientWx::dispatchDidFailProvisionalLoad(const ResourceError&)
       
   742 {
       
   743     notImplemented();
       
   744 }
       
   745 
       
   746 void FrameLoaderClientWx::dispatchDidFailLoad(const ResourceError&)
       
   747 {
       
   748     notImplemented();
       
   749 }
       
   750 
       
   751 Frame* FrameLoaderClientWx::dispatchCreatePage()
       
   752 {
       
   753     notImplemented();
       
   754     return false;
       
   755 }
       
   756 
       
   757 void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimetype, const ResourceRequest& request)
       
   758 {
       
   759     if (!m_webFrame)
       
   760         return;
       
   761     
       
   762     notImplemented();
       
   763     (m_frame->loader()->policyChecker()->*function)(PolicyUse);
       
   764 }
       
   765 
       
   766 void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& targetName)
       
   767 {
       
   768     if (!m_webFrame)
       
   769         return;
       
   770 
       
   771     if (m_webView) {
       
   772         wxWebViewNewWindowEvent wkEvent(m_webView);
       
   773         wkEvent.SetURL(request.url().string());
       
   774         wkEvent.SetTargetName(targetName);
       
   775         if (m_webView->GetEventHandler()->ProcessEvent(wkEvent)) {
       
   776             // if the app handles and doesn't skip the event, 
       
   777             // from WebKit's perspective treat it as blocked / ignored
       
   778             (m_frame->loader()->policyChecker()->*function)(PolicyIgnore);
       
   779             return;
       
   780         }
       
   781     }
       
   782     
       
   783     (m_frame->loader()->policyChecker()->*function)(PolicyUse);
       
   784 }
       
   785 
       
   786 void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState>)
       
   787 {
       
   788     if (!m_webFrame)
       
   789         return;
       
   790         
       
   791     if (m_webView) {
       
   792         wxWebViewBeforeLoadEvent wkEvent(m_webView);
       
   793         wkEvent.SetNavigationType(wxNavTypeFromWebNavType(action.type()));
       
   794         wkEvent.SetURL(request.url().string());
       
   795         
       
   796         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   797         if (wkEvent.IsCancelled())
       
   798             (m_frame->loader()->policyChecker()->*function)(PolicyIgnore);
       
   799         else
       
   800             (m_frame->loader()->policyChecker()->*function)(PolicyUse);
       
   801         
       
   802     }
       
   803 }
       
   804 
       
   805 void FrameLoaderClientWx::dispatchUnableToImplementPolicy(const ResourceError&)
       
   806 {
       
   807     notImplemented();
       
   808 }
       
   809 
       
   810 void FrameLoaderClientWx::startDownload(const ResourceRequest&)
       
   811 {
       
   812     notImplemented();
       
   813 }
       
   814 
       
   815 PassRefPtr<Frame> FrameLoaderClientWx::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
       
   816                                    const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
       
   817 {
       
   818     WebViewFrameData* data = new WebViewFrameData();
       
   819     data->name = name;
       
   820     data->ownerElement = ownerElement;
       
   821     data->url = url;
       
   822     data->referrer = referrer;
       
   823     data->allowsScrolling = allowsScrolling;
       
   824     data->marginWidth = marginWidth;
       
   825     data->marginHeight = marginHeight;
       
   826 
       
   827     wxWebFrame* newFrame = new wxWebFrame(m_webView, m_webFrame, data);
       
   828 
       
   829     RefPtr<Frame> childFrame = adoptRef(newFrame->m_impl->frame);
       
   830 
       
   831     // The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
       
   832     if (!childFrame->page())
       
   833         return 0;
       
   834 
       
   835     childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get());
       
   836     
       
   837     // The frame's onload handler may have removed it from the document.
       
   838     if (!childFrame->tree()->parent())
       
   839         return 0;
       
   840     
       
   841     return childFrame.release();
       
   842 }
       
   843 
       
   844 void FrameLoaderClientWx::didTransferChildFrameToNewDocument()
       
   845 {
       
   846 }
       
   847 
       
   848 ObjectContentType FrameLoaderClientWx::objectContentType(const KURL& url, const String& mimeType)
       
   849 {
       
   850     notImplemented();
       
   851     return ObjectContentType();
       
   852 }
       
   853 
       
   854 PassRefPtr<Widget> FrameLoaderClientWx::createPlugin(const IntSize& size, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
       
   855 {
       
   856 #if __WXMSW__ || __WXMAC__
       
   857     RefPtr<PluginView> pv = PluginView::create(m_frame, size, element, url, paramNames, paramValues, mimeType, loadManually);
       
   858     if (pv->status() == PluginStatusLoadedSuccessfully)
       
   859         return pv;
       
   860 #endif
       
   861     return 0;
       
   862 }
       
   863 
       
   864 void FrameLoaderClientWx::redirectDataToPlugin(Widget* pluginWidget)
       
   865 {
       
   866     ASSERT(!m_pluginView);
       
   867     m_pluginView = static_cast<PluginView*>(pluginWidget);
       
   868     m_hasSentResponseToPlugin = false;
       
   869 }
       
   870 
       
   871 ResourceError FrameLoaderClientWx::pluginWillHandleLoadError(const ResourceResponse& response)
       
   872 {
       
   873     notImplemented();
       
   874     return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String());
       
   875 }
       
   876 
       
   877 PassRefPtr<Widget> FrameLoaderClientWx::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
       
   878                                                     const Vector<String>& paramNames, const Vector<String>& paramValues)
       
   879 {
       
   880     notImplemented();
       
   881     return 0;
       
   882 }
       
   883 
       
   884 String FrameLoaderClientWx::overrideMediaType() const
       
   885 {
       
   886     notImplemented();
       
   887     return String();
       
   888 }
       
   889 
       
   890 void FrameLoaderClientWx::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
       
   891 {
       
   892     if (world != mainThreadNormalWorld())
       
   893         return;
       
   894 
       
   895     if (m_webView) {
       
   896         wxWebViewWindowObjectClearedEvent wkEvent(m_webView);
       
   897         Frame* coreFrame = m_webView->GetMainFrame()->GetFrame();
       
   898         JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
       
   899         JSObjectRef windowObject = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld()));
       
   900         wkEvent.SetJSContext(context);
       
   901         wkEvent.SetWindowObject(windowObject);
       
   902         m_webView->GetEventHandler()->ProcessEvent(wkEvent);
       
   903     }
       
   904 }
       
   905 
       
   906 void FrameLoaderClientWx::documentElementAvailable()
       
   907 {
       
   908 }
       
   909 
       
   910 void FrameLoaderClientWx::didPerformFirstNavigation() const
       
   911 {
       
   912     notImplemented();
       
   913 }
       
   914 
       
   915 void FrameLoaderClientWx::registerForIconNotification(bool listen)
       
   916 {
       
   917     notImplemented();
       
   918 }
       
   919 
       
   920 void FrameLoaderClientWx::savePlatformDataToCachedFrame(CachedFrame*)
       
   921 { 
       
   922     notImplemented();
       
   923 }
       
   924 
       
   925 void FrameLoaderClientWx::transitionToCommittedFromCachedFrame(CachedFrame*)
       
   926 { 
       
   927     notImplemented();
       
   928 }
       
   929 
       
   930 void FrameLoaderClientWx::transitionToCommittedForNewPage()
       
   931 { 
       
   932     ASSERT(m_webFrame);
       
   933     ASSERT(m_frame);
       
   934     ASSERT(m_webView);
       
   935     
       
   936     IntSize size = IntRect(m_webView->GetRect()).size();
       
   937     // FIXME: This value should be gotten from m_webView->IsTransparent();
       
   938     // but transitionToCommittedForNewPage() can be called while m_webView is
       
   939     // still being initialized.
       
   940     bool transparent = false;
       
   941     Color backgroundColor = transparent ? WebCore::Color::transparent : WebCore::Color::white;
       
   942     
       
   943     if (m_frame)
       
   944         m_frame->createView(size, backgroundColor, transparent, IntSize(), false); 
       
   945 }
       
   946 
       
   947 bool FrameLoaderClientWx::shouldUsePluginDocument(const String &mimeType) const
       
   948 {
       
   949     // NOTE: Plugin Documents are used for viewing PDFs, etc. inline, and should
       
   950     // not be used for pages with plugins in them.
       
   951     return false;
       
   952 }
       
   953 
       
   954 }