webengine/osswebengine/WebKit/s60/webcoresupport/WebFrameLoaderClient.cpp
branchRCL_3
changeset 94 919f36ff910f
parent 93 79859ed3eea9
child 95 d96eed154187
equal deleted inserted replaced
93:79859ed3eea9 94:919f36ff910f
    13 *
    13 *
    14 * Description:   Implementation of WebFrameLoaderClient
    14 * Description:   Implementation of WebFrameLoaderClient
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <Browser_platform_variant.hrh>
    18 #include <browser_platform_variant.hrh>
    19 #include "config.h"
    19 #include "config.h"
    20 #include <../bidi.h>
    20 #include <../bidi.h>
    21 #include "WebFrameLoaderClient.h"
    21 #include "WebFrameLoaderClient.h"
    22 #include "ResourceError.h"
    22 #include "ResourceError.h"
    23 #include "DebugStream.h"
    23 #include "DebugStream.h"
    24 #include "DocumentLoader.h"
    24 #include "DocumentLoader.h"
    25 #include "Frame.h"
    25 #include "Frame.h"
    26 #include "FrameLoader.h"
    26 #include "FrameLoader.h"
    27 #include "HTMLFrameOwnerElement.h"
    27 #include "HTMLFrameOwnerElement.h"
    28 #include "HTMLNames.h"
    28 #include "HtmlNames.h"
    29 #include "HTMLFrameElement.h"
    29 #include "HTMLFrameElement.h"
    30 #include "WebCoreFrameBridge.h"
    30 #include "WebCoreFrameBridge.h"
    31 #include "HTMLFormElement.h"
    31 #include "HTMLFormElement.h"
    32 #include "HTMLObjectElement.h"
    32 #include "HTMLObjectElement.h"
    33 #include "FrameView.h"
    33 #include "FrameView.h"
    36 #include "WebFrame.h"
    36 #include "WebFrame.h"
    37 #include "WebView.h"
    37 #include "WebView.h"
    38 #include "WebFrameView.h"
    38 #include "WebFrameView.h"
    39 #include "WebFrameBridge.h"
    39 #include "WebFrameBridge.h"
    40 #include "WebDocumentLoader.h"
    40 #include "WebDocumentLoader.h"
    41 #include "BrCtl.h"
    41 #include "brctl.h"
    42 #include "Page.h"
    42 #include "page.h"
    43 #include "ProgressTracker.h"
    43 #include "ProgressTracker.h"
    44 #include "WebPolicyManager.h"
    44 #include "WebPolicyManager.h"
    45 #include "StaticObjectsContainer.h"
    45 #include "StaticObjectsContainer.h"
    46 #include "ResourceLoaderDelegate.h"
    46 #include "ResourceLoaderDelegate.h"
    47 #include "BrCtlWindowObserver.h"
    47 #include <brctlwindowobserver.h>
    48 #include "WmlDispatcher.h"
    48 #include "WmlDispatcher.h"
    49 #include "WebUtil.h"
    49 #include "WebUtil.h"
    50 #include "ErrorDefs.h"
    50 #include "errordefs.h"
    51 #include "WebFepTextEditor.h"
    51 #include "WebFepTextEditor.h"
    52 #include "SettingsContainer.h"
    52 #include "SettingsContainer.h"
    53 #include "WebTabbedNavigation.h"
    53 #include "WebTabbedNavigation.h"
    54 #include "StaticObjectsContainer.h"
    54 #include "StaticObjectsContainer.h"
    55 #include "WebCursor.h"
    55 #include "WebCursor.h"
    56 #include "WebCharsetData.h"
    56 #include "WebCharsetData.h"
    57 #include "WebKitLogger.h"
    57 #include "WebKitLogger.h"
    58 #include "PluginHandler.h"
    58 #include "PluginHandler.h"
    59 #include "MimeTypeRegistry.h"
    59 #include "MIMETypeRegistry.h"
    60 #include "WidgetExtension.h"
    60 #include "WidgetExtension.h"
    61 
    61 
    62 using namespace WebCore;
    62 using namespace WebCore;
    63 using namespace HTMLNames;
    63 using namespace HTMLNames;
    64 
    64 
   113     //WebDataSource *ds = [m_webFrame.get() _dataSource];
   113     //WebDataSource *ds = [m_webFrame.get() _dataSource];
   114 
   114 
   115     //NSView <WebDocumentView> *documentView = [v _makeDocumentViewForDataSource:ds];
   115     //NSView <WebDocumentView> *documentView = [v _makeDocumentViewForDataSource:ds];
   116     //if (!documentView)
   116     //if (!documentView)
   117     //    return;
   117     //    return;
   118 
   118     if(m_webFrame) {
   119     if (m_webFrame && 
   119         if (m_webFrame->frameView() && 
   120         m_webFrame->frameView() && 
   120             m_webFrame->frameView()->topView()&&
   121         m_webFrame->frameView()->topView()&&
   121            !m_webFrame->parentFrame()) {
   122         !m_webFrame->parentFrame()) {
   122             m_webFrame->frameView()->topView()->setEditable(false);
   123 
   123         }
   124         m_webFrame->frameView()->topView()->setEditable(false);
   124         
   125     }
       
   126     WebFrameBridge *bridge = m_webFrame->bridge();
   125     WebFrameBridge *bridge = m_webFrame->bridge();
   127 
   126 
   128     // FIXME: We could save work and not do this for a top-level view that is not a WebHTMLView.
   127     // FIXME: We could save work and not do this for a top-level view that is not a WebHTMLView.
   129     //(MWebCoreWidget* view, int marginWidth, int marginHeight)    
   128     //(MWebCoreWidget* view, int marginWidth, int marginHeight)    
   130     bridge->createFrameViewWithScrollView(v, v->marginWidth(), v->marginHeight());
   129     bridge->createFrameViewWithScrollView(v, v->marginWidth(), v->marginHeight());
   131     //m_webFrame.get() _updateBackground];
   130     //m_webFrame.get() _updateBackground];
   132     bridge->installInFrame(v);
   131     bridge->installInFrame(v);
       
   132     }
   133 
   133 
   134     // Call setDataSource on the document view after it has been placed in the view hierarchy.
   134     // Call setDataSource on the document view after it has been placed in the view hierarchy.
   135     // This what we for the top-level view, so should do this for views in subframes as well.
   135     // This what we for the top-level view, so should do this for views in subframes as well.
   136     //[documentView setDataSource:ds];
   136     //[documentView setDataSource:ds];
   137 }
   137 }
   145             if((err == KErrNone) && (m_WmlContentListener != NULL))
   145             if((err == KErrNone) && (m_WmlContentListener != NULL))
   146                 {
   146                 {
   147                 brctl(m_webFrame)->setWmlDispatcher(m_WmlContentListener);
   147                 brctl(m_webFrame)->setWmlDispatcher(m_WmlContentListener);
   148                 }
   148                 }
   149         }
   149         }
   150         TRAPD(err,m_WmlContentListener->HeadersL( 0, m_response ));
   150         if ( m_WmlContentListener ) {
       
   151           TRAPD(err,m_WmlContentListener->HeadersL( 0, m_response ));
       
   152         }
   151     }
   153     }
   152     else{
   154     else{
   153         if (m_WmlContentListener) {
   155         if (m_WmlContentListener) {
   154             m_WmlContentListener->MakeWmlVisible(EFalse);
   156             m_WmlContentListener->MakeWmlVisible(EFalse);
   155         brctl(m_webFrame)->setWmlMode(EFalse);
   157         brctl(m_webFrame)->setWmlMode(EFalse);
   159             m_webFrame->frameView()->topView()->setRedirectWithLockedHistory(true);
   161             m_webFrame->frameView()->topView()->setRedirectWithLockedHistory(true);
   160         if (docLoader->isLoadingMainResource()&&
   162         if (docLoader->isLoadingMainResource()&&
   161             core(m_webFrame)->loader()->isLoadingMainFrame() &&
   163             core(m_webFrame)->loader()->isLoadingMainFrame() &&
   162             FrameLoadTypeStandard == core(m_webFrame)->loader()->loadType()){
   164             FrameLoadTypeStandard == core(m_webFrame)->loader()->loadType()){
   163             m_webFrame->frameView()->topView()->resetZoomLevel();
   165             m_webFrame->frameView()->topView()->resetZoomLevel();
       
   166             m_webFrame->frameView()->topView()->resetJsTimers();
   164         }
   167         }
   165 
   168 
   166         if (!core(m_webFrame)->ownerElement()) {
   169         if (!core(m_webFrame)->ownerElement()) {
   167             brctl(m_webFrame)->settings()->setNavigationType((brctl(m_webFrame)->capabilities()&TBrCtlDefs::ECapabilityCursorNavigation) ? SettingsContainer::NavigationTypeCursor : SettingsContainer::NavigationTypeTabbed);
   170             brctl(m_webFrame)->settings()->setNavigationType((brctl(m_webFrame)->capabilities()&TBrCtlDefs::ECapabilityCursorNavigation) ? SettingsContainer::NavigationTypeCursor : SettingsContainer::NavigationTypeTabbed);
   168             StaticObjectsContainer::instance()->webCursor()->cursorUpdate(true);
   171             StaticObjectsContainer::instance()->webCursor()->cursorUpdate(true);
   929 }
   932 }
   930 
   933 
   931 void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length) 
   934 void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length) 
   932 { 
   935 { 
   933     if (brctl(m_webFrame)->wmlMode()) {
   936     if (brctl(m_webFrame)->wmlMode()) {
   934         TRAP_IGNORE(
   937     if(m_WmlContentListener)
   935         m_WmlContentListener->ResponseL( data, length );
   938     	TRAP_IGNORE(
   936         );
   939          m_WmlContentListener->ResponseL( data, length );
       
   940          );
   937         return;
   941         return;
   938     }
   942     }
   939     m_webFrame->bridge()->receivedData(data, length, m_response.textEncodingName());
   943     m_webFrame->bridge()->receivedData(data, length, m_response.textEncodingName());
   940 }
   944 }
   941 
   945 
  1140 }
  1144 }
  1141 
  1145 
  1142 void WebFrameLoaderClient::frameLoadCompleted()
  1146 void WebFrameLoaderClient::frameLoadCompleted()
  1143 {
  1147 {
  1144     if (brctl(m_webFrame)->wmlMode()) {
  1148     if (brctl(m_webFrame)->wmlMode()) {
       
  1149     if (m_WmlContentListener)
  1145         TRAP_IGNORE(
  1150         TRAP_IGNORE(
  1146 		if (m_WmlContentListener)
  1151          m_WmlContentListener->CompleteL( 0, 0 );
  1147         	m_WmlContentListener->CompleteL( 0, 0 );
       
  1148         );
  1152         );
  1149         return;
  1153         return;
  1150     }
  1154     }
  1151     /*
  1155     /*
  1152     // Note: Can be called multiple times.
  1156     // Note: Can be called multiple times.