webengine/osswebengine/WebKit/s60/webcoresupport/WebFrameLoaderClient.cpp
branchRCL_3
changeset 48 79859ed3eea9
parent 47 e1bea15f9a39
child 49 919f36ff910f
equal deleted inserted replaced
47:e1bea15f9a39 48:79859ed3eea9
    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     if(m_webFrame) {
   118 
   119         if (m_webFrame->frameView() && 
   119     if (m_webFrame && 
   120             m_webFrame->frameView()->topView()&&
   120         m_webFrame->frameView() && 
   121            !m_webFrame->parentFrame()) {
   121         m_webFrame->frameView()->topView()&&
   122             m_webFrame->frameView()->topView()->setEditable(false);
   122         !m_webFrame->parentFrame()) {
   123         }
   123 
   124         
   124         m_webFrame->frameView()->topView()->setEditable(false);
       
   125     }
   125     WebFrameBridge *bridge = m_webFrame->bridge();
   126     WebFrameBridge *bridge = m_webFrame->bridge();
   126 
   127 
   127     // FIXME: We could save work and not do this for a top-level view that is not a WebHTMLView.
   128     // FIXME: We could save work and not do this for a top-level view that is not a WebHTMLView.
   128     //(MWebCoreWidget* view, int marginWidth, int marginHeight)    
   129     //(MWebCoreWidget* view, int marginWidth, int marginHeight)    
   129     bridge->createFrameViewWithScrollView(v, v->marginWidth(), v->marginHeight());
   130     bridge->createFrameViewWithScrollView(v, v->marginWidth(), v->marginHeight());
   130     //m_webFrame.get() _updateBackground];
   131     //m_webFrame.get() _updateBackground];
   131     bridge->installInFrame(v);
   132     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         if ( m_WmlContentListener ) {
   150         TRAPD(err,m_WmlContentListener->HeadersL( 0, m_response ));
   151           TRAPD(err,m_WmlContentListener->HeadersL( 0, m_response ));
       
   152         }
       
   153     }
   151     }
   154     else{
   152     else{
   155         if (m_WmlContentListener) {
   153         if (m_WmlContentListener) {
   156             m_WmlContentListener->MakeWmlVisible(EFalse);
   154             m_WmlContentListener->MakeWmlVisible(EFalse);
   157         brctl(m_webFrame)->setWmlMode(EFalse);
   155         brctl(m_webFrame)->setWmlMode(EFalse);
   161             m_webFrame->frameView()->topView()->setRedirectWithLockedHistory(true);
   159             m_webFrame->frameView()->topView()->setRedirectWithLockedHistory(true);
   162         if (docLoader->isLoadingMainResource()&&
   160         if (docLoader->isLoadingMainResource()&&
   163             core(m_webFrame)->loader()->isLoadingMainFrame() &&
   161             core(m_webFrame)->loader()->isLoadingMainFrame() &&
   164             FrameLoadTypeStandard == core(m_webFrame)->loader()->loadType()){
   162             FrameLoadTypeStandard == core(m_webFrame)->loader()->loadType()){
   165             m_webFrame->frameView()->topView()->resetZoomLevel();
   163             m_webFrame->frameView()->topView()->resetZoomLevel();
   166             m_webFrame->frameView()->topView()->resetJsTimers();
       
   167         }
   164         }
   168 
   165 
   169         if (!core(m_webFrame)->ownerElement()) {
   166         if (!core(m_webFrame)->ownerElement()) {
   170             brctl(m_webFrame)->settings()->setNavigationType((brctl(m_webFrame)->capabilities()&TBrCtlDefs::ECapabilityCursorNavigation) ? SettingsContainer::NavigationTypeCursor : SettingsContainer::NavigationTypeTabbed);
   167             brctl(m_webFrame)->settings()->setNavigationType((brctl(m_webFrame)->capabilities()&TBrCtlDefs::ECapabilityCursorNavigation) ? SettingsContainer::NavigationTypeCursor : SettingsContainer::NavigationTypeTabbed);
   171             StaticObjectsContainer::instance()->webCursor()->cursorUpdate(true);
   168             StaticObjectsContainer::instance()->webCursor()->cursorUpdate(true);
   932 }
   929 }
   933 
   930 
   934 void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length) 
   931 void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length) 
   935 { 
   932 { 
   936     if (brctl(m_webFrame)->wmlMode()) {
   933     if (brctl(m_webFrame)->wmlMode()) {
   937     if(m_WmlContentListener)
   934         TRAP_IGNORE(
   938     	TRAP_IGNORE(
   935         m_WmlContentListener->ResponseL( data, length );
   939          m_WmlContentListener->ResponseL( data, length );
   936         );
   940          );
       
   941         return;
   937         return;
   942     }
   938     }
   943     m_webFrame->bridge()->receivedData(data, length, m_response.textEncodingName());
   939     m_webFrame->bridge()->receivedData(data, length, m_response.textEncodingName());
   944 }
   940 }
   945 
   941 
  1144 }
  1140 }
  1145 
  1141 
  1146 void WebFrameLoaderClient::frameLoadCompleted()
  1142 void WebFrameLoaderClient::frameLoadCompleted()
  1147 {
  1143 {
  1148     if (brctl(m_webFrame)->wmlMode()) {
  1144     if (brctl(m_webFrame)->wmlMode()) {
  1149     if (m_WmlContentListener)
       
  1150         TRAP_IGNORE(
  1145         TRAP_IGNORE(
  1151          m_WmlContentListener->CompleteL( 0, 0 );
  1146 		if (m_WmlContentListener)
       
  1147         	m_WmlContentListener->CompleteL( 0, 0 );
  1152         );
  1148         );
  1153         return;
  1149         return;
  1154     }
  1150     }
  1155     /*
  1151     /*
  1156     // Note: Can be called multiple times.
  1152     // Note: Can be called multiple times.