webengine/osswebengine/WebKit/s60/plugins/PluginSkin.cpp
branchRCL_3
changeset 36 c711bdda59f4
parent 28 d39add9822e2
child 37 ac77f89b1d9e
equal deleted inserted replaced
35:1f3c3f2f5b0a 36:c711bdda59f4
    42 #include "FrameLoader.h"
    42 #include "FrameLoader.h"
    43 #include "DocumentLoader.h"
    43 #include "DocumentLoader.h"
    44 #include "ResourceRequest.h"
    44 #include "ResourceRequest.h"
    45 #include "Widget.h"
    45 #include "Widget.h"
    46 #include "PlatformScrollBar.h"
    46 #include "PlatformScrollBar.h"
       
    47 #include "Page.h"
       
    48 #include "FocusController.h"
    47 
    49 
    48 #include <ApEngineConsts.h>
    50 #include <ApEngineConsts.h>
    49 #include <Uri8.h>
    51 #include <Uri8.h>
    50 #include <internetconnectionmanager.h>
    52 #include <internetconnectionmanager.h>
    51 #include <es_enum.h>
    53 #include <es_enum.h>
    52 #include "WidgetExtension.h"
    54 #include "WidgetExtension.h"
    53 #include <widgetregistryclient.h>
    55 #include <widgetregistryclient.h>
       
    56 
    54 
    57 
    55 // CONSTANTS
    58 // CONSTANTS
    56 using namespace WebCore;
    59 using namespace WebCore;
    57 // scheme for RTSP url
    60 // scheme for RTSP url
    58 _LIT8(KRtsp, "rtsp");
    61 _LIT8(KRtsp, "rtsp");
   193         NPN_GenericElement ScriptSession(SecMgrScriptSession,scriptSession);
   196         NPN_GenericElement ScriptSession(SecMgrScriptSession,scriptSession);
   194         iGenericElementArray->AppendL(ScriptSession);           
   197         iGenericElementArray->AppendL(ScriptSession);           
   195 #endif
   198 #endif
   196 
   199 
   197         TInt uid = wdgtExt->GetWidgetId();         
   200         TInt uid = wdgtExt->GetWidgetId();         
       
   201         
   198         CWidgetPropertyValue* AccessValue = widgetregistry.GetWidgetPropertyValueL(TUid::Uid(uid), EAllowNetworkAccess ); 
   202         CWidgetPropertyValue* AccessValue = widgetregistry.GetWidgetPropertyValueL(TUid::Uid(uid), EAllowNetworkAccess ); 
   199         TInt networkAccess = *AccessValue;
   203         TInt networkAccess = AccessValue && *AccessValue;
       
   204         delete AccessValue;
       
   205         
   200         const TDesC& allowNetworkAccess = KAllowNetworkAccess();
   206         const TDesC& allowNetworkAccess = KAllowNetworkAccess();
   201         NPN_GenericElement NetworkAccess(allowNetworkAccess,networkAccess);
   207         NPN_GenericElement NetworkAccess(allowNetworkAccess,networkAccess);
   202         iGenericElementArray->AppendL(NetworkAccess);
   208         iGenericElementArray->AppendL(NetworkAccess);
   203     }
   209     }
   204     User::LeaveIfError(widgetregistry.Disconnect());
   210     User::LeaveIfError(widgetregistry.Disconnect());
   564             TRAP_IGNORE( m_pluginwin->processEventL(EEventActivate, consumed));
   570             TRAP_IGNORE( m_pluginwin->processEventL(EEventActivate, consumed));
   565             if (consumed)
   571             if (consumed)
   566                 {
   572                 {
   567                 m_active = ETrue;
   573                 m_active = ETrue;
   568                 m_frame->frameView()->topView()->setFocusedElementType(TBrCtlDefs::EElementActivatedObjectBox);
   574                 m_frame->frameView()->topView()->setFocusedElementType(TBrCtlDefs::EElementActivatedObjectBox);
       
   575                 control(m_frame)->webView()->page()->focusController()->setFocusedNode(getElement(), control(m_frame)->webView()->page()->focusController()->focusedOrMainFrame());                        
   569                 pluginHandler->setActivePlugin(this);
   576                 pluginHandler->setActivePlugin(this);
   570                 pluginHandler->setPluginToActivate(NULL);
   577                 pluginHandler->setPluginToActivate(NULL);
   571                 }
   578                 }
   572             // Set right soft key
   579             // Set right soft key
   573             m_frame->frameView()->topView()->brCtl()->updateDefaultSoftkeys();
   580             m_frame->frameView()->topView()->brCtl()->updateDefaultSoftkeys();
   803     TPluginLoadMode loadmode = GetLoadMode(aWindowType);
   810     TPluginLoadMode loadmode = GetLoadMode(aWindowType);
   804 
   811 
   805     if (url.Ptr() == NULL ) {                        
   812     if (url.Ptr() == NULL ) {                        
   806         return KErrArgument;
   813         return KErrArgument;
   807     }
   814     }
   808     _LIT8(KSwfExtn, ".swf");
   815     
   809     _LIT8(KJs, "javascript:");
   816     _LIT8(KJs, "javascript:");
   810     if ((url.Length() > KJs().Length() ) &&(url.Left(KJs().Length()).FindF(KJs) == 0)) {
   817     if ((url.Length() > KJs().Length() ) &&(url.Left(KJs().Length()).FindF(KJs) == 0)) {
   811         HBufC* pBuffer = HBufC::NewL(url.Length());
   818         HBufC* pBuffer = HBufC::NewL(url.Length());
   812 	    TPtr16 temp = pBuffer->Des(); 
   819 	    TPtr16 temp = pBuffer->Des(); 
   813 	    temp.Copy(url);
   820 	    temp.Copy(url);
   825     HBufC8* docUrl = HBufC8::NewLC(core(m_frame)->document()->baseURI().length());
   832     HBufC8* docUrl = HBufC8::NewLC(core(m_frame)->document()->baseURI().length());
   826     docUrl->Des().Copy(core(m_frame)->document()->baseURI());
   833     docUrl->Des().Copy(core(m_frame)->document()->baseURI());
   827     HBufC8* absoluteUrl = makeAbsoluteUrlL(m_url, docUrl, url); 
   834     HBufC8* absoluteUrl = makeAbsoluteUrlL(m_url, docUrl, url); 
   828     CleanupStack::PushL(absoluteUrl);
   835     CleanupStack::PushL(absoluteUrl);
   829 
   836 
   830     if( (loadmode == ELoadModePlugin ) || (url.FindF(KSwfExtn)!= KErrNotFound) ){    
   837     PluginHandler* pluginHandler = StaticObjectsContainer::instance()->pluginHandler();
   831         
   838     if( (loadmode == ELoadModePlugin ) || (loadmode == ELoadModeTop && (pluginHandler->pluginMimeByExtention(url) != NULL)) ){        
   832         if (m_instance && m_pluginfuncs) {
   839         if (m_instance && m_pluginfuncs) {
   833         
   840         
   834             NetscapePlugInStreamLoaderClient* pluginloader = NetscapePlugInStreamLoaderClient::NewL(url, this, core(m_frame), notifydata, notify);
   841             NetscapePlugInStreamLoaderClient* pluginloader = NetscapePlugInStreamLoaderClient::NewL(url, this, core(m_frame), notifydata, notify);
   835             if (pluginloader) {
   842             if (pluginloader) {
   836                 pluginloader->start();                                          
   843                 pluginloader->start();                                          
  1196         return EWindowTypeTop;
  1203         return EWindowTypeTop;
  1197     }
  1204     }
  1198 
  1205 
  1199     return EWindowTypeUnknown;
  1206     return EWindowTypeUnknown;
  1200 }
  1207 }
       
  1208 
       
  1209 void PluginSkin::reCreatePlugin()
       
  1210 {
       
  1211     //destroy the plugin
       
  1212     
       
  1213     Vector<PluginStream*> streams;
       
  1214     for (HashSet<PluginStream*>::iterator it = m_streams.begin(); it != m_streams.end(); ++it) {
       
  1215         streams.append(*it);
       
  1216     }    
       
  1217     for (int i=0; i<streams.size(); ++i) {
       
  1218         streams[i]->close();
       
  1219     }
       
  1220     m_streams.clear();
       
  1221 
       
  1222     if (m_instance && m_pluginfuncs && m_pluginfuncs->destroy) {        
       
  1223         m_pluginfuncs->destroy(m_instance, NULL);
       
  1224     }
       
  1225     User::Free(m_instance); m_instance = 0;
       
  1226     delete m_pluginwin; m_pluginwin = 0;
       
  1227     delete iJavascriptTimer; iJavascriptTimer = 0;
       
  1228     
       
  1229     RFs& rfs = StaticObjectsContainer::instance()->fsSession();
       
  1230     for(TInt i=0; i < m_tempFilesArray.Count(); i++)
       
  1231         {
       
  1232           rfs.Delete(m_tempFilesArray[i]->Des());
       
  1233         }
       
  1234     
       
  1235     m_tempFilesArray.ResetAndDestroy();
       
  1236     
       
  1237     
       
  1238     //create/load the destroyed plugin again
       
  1239     
       
  1240     NetscapePlugInStreamLoaderClient* pluginloader = NetscapePlugInStreamLoaderClient::NewL(m_url->Des(), this, core(m_frame));
       
  1241     if (pluginloader) {
       
  1242         pluginloader->start();                            
       
  1243     }    
       
  1244 }