webengine/device/src/DeviceLiwBinding.cpp
branchRCL_3
changeset 48 79859ed3eea9
parent 47 e1bea15f9a39
child 49 919f36ff910f
equal deleted inserted replaced
47:e1bea15f9a39 48:79859ed3eea9
    19 #include <config.h>
    19 #include <config.h>
    20 #include <value.h>
    20 #include <value.h>
    21 #include <interpreter.h>
    21 #include <interpreter.h>
    22 #include <date_object.h>
    22 #include <date_object.h>
    23 #include <operations.h>
    23 #include <operations.h>
    24 #include <liwServiceHandler.h>
    24 #include <liwservicehandler.h>
    25 #include <RTSecManager.h>
    25 #include <rtsecmanager.h>
    26 #include <RTSecMgrUtility.h>
    26 #include <rtsecmgrutility.h>
    27 #include <RTSecMgrScriptSession.h>
    27 #include <rtsecmgrscriptsession.h>
    28 #include <RTSecMgrCommonDef.h>
    28 #include <rtsecmgrcommondef.h>
    29 #include <widgetregistryclient.h>
    29 #include <WidgetRegistryClient.h>
    30 #include <PropertyNameArray.h>
    30 #include <PropertyNameArray.h>
    31 #include <internal.h>
    31 #include <internal.h>
    32 #include <liwvariant.h>
    32 #include <liwvariant.h>
    33 #include <liwbufferextension.h>
    33 #include <liwbufferextension.h>
    34 
    34 
    40 #include "DeviceLiwInterface.h"
    40 #include "DeviceLiwInterface.h"
    41 #include "DeviceLiwMap.h"
    41 #include "DeviceLiwMap.h"
    42 #include "DeviceLiwIterable.h"
    42 #include "DeviceLiwIterable.h"
    43 #include "DeviceLiwResult.h"
    43 #include "DeviceLiwResult.h"
    44 
    44 
    45 
       
    46 
       
    47 using namespace KJS;
    45 using namespace KJS;
    48 using namespace LIW;
    46 using namespace LIW;
    49 
    47 
    50 // CONSTANTS
    48 // CONSTANTS
    51 #define SAPISECURITYPROMPTNEEDED 0x0001
    49 #define SAPISECURITYPROMPTNEEDED 0x0001
   125             {
   123             {
   126             User::Leave( KErrGeneral );
   124             User::Leave( KErrGeneral );
   127             }
   125             }
   128 #ifdef BRDO_SEC_MGR_PROMPT_ENHANCEMENT_FF
   126 #ifdef BRDO_SEC_MGR_PROMPT_ENHANCEMENT_FF
   129 		m_scriptSession->SetPromptOption(RTPROMPTUI_PROVIDER);   //  This is for setting the new prompting method
   127 		m_scriptSession->SetPromptOption(RTPROMPTUI_PROVIDER);   //  This is for setting the new prompting method
   130 #endif 
   128 #endif
   131         CleanupStack::PopAndDestroy( trust );
   129         CleanupStack::PopAndDestroy( trust );
   132     }
   130     }
   133 
   131 
   134 // ----------------------------------------------------------------------------
   132 // ----------------------------------------------------------------------------
   135 // CDeviceLiwBinding::~CDeviceLiwBinding
   133 // CDeviceLiwBinding::~CDeviceLiwBinding
   164     int argcount = args.size();
   162     int argcount = args.size();
   165 
   163 
   166     if ( argcount > 0 && args[0]->type() == StringType &&
   164     if ( argcount > 0 && args[0]->type() == StringType &&
   167         args[0]->toString( exec ).size() > 0 )
   165         args[0]->toString( exec ).size() > 0 )
   168         {
   166         {
   169        	  
       
   170             TRAP( error,
   167             TRAP( error,
   171             {
   168             {
   172             // Get service name
   169             // Get service name
   173             svcName = KJS::GetAsciiBufferL( args[0]->toString( exec ) );
   170             svcName = KJS::GetAsciiBufferL( args[0]->toString( exec ) );
   174             CleanupStack::PushL( svcName );
   171             CleanupStack::PushL( svcName );
   212                    }
   209                    }
   213 
   210 
   214                 switch ( widgetregistry.WidgetSapiAccessState(m_Uid))
   211                 switch ( widgetregistry.WidgetSapiAccessState(m_Uid))
   215                     {
   212                     {
   216                     case SAPISECURITYPROMPTNEEDED :
   213                     case SAPISECURITYPROMPTNEEDED :
   217                         load_err = sapiPromptNeededL(crit_arr);
   214                         load_err = m_serviceHandler->AttachL( crit_arr, *m_scriptSession );
   218                         break;
   215                         break;
   219                     case SAPIPROMPTLESS :
   216                     case SAPIPROMPTLESS :
   220                         load_err = m_serviceHandler->AttachL( crit_arr );
   217                         load_err = m_serviceHandler->AttachL( crit_arr );
   221                         break;
   218                         break;
   222                     case SAPIACCESSDENIED :
   219                     case SAPIACCESSDENIED :
   255         error = KErrArgument;
   252         error = KErrArgument;
   256         }
   253         }
   257 
   254 
   258     return error;
   255     return error;
   259     }
   256     }
   260     
   257 
   261 // ---------------------------------------------------------------------------
       
   262 // attachL called if sapi prompt is needed
       
   263 // return TInt - load error
       
   264 // ---------------------------------------------------------------------------
       
   265 //
       
   266 TInt CDeviceLiwBinding::sapiPromptNeededL(RCriteriaArray aCrit_arr)
       
   267     {
       
   268 #ifdef BRDO_SAPINTFN_ENABLED_FF
       
   269         return m_serviceHandler->AttachL( aCrit_arr, *m_scriptSession, m_Uid.iUid );
       
   270 #else
       
   271         return m_serviceHandler->AttachL( aCrit_arr, *m_scriptSession );
       
   272 #endif
       
   273     }
       
   274     
       
   275 // ---------------------------------------------------------------------------
   258 // ---------------------------------------------------------------------------
   276 // Convert Unload service provider
   259 // Convert Unload service provider
   277 // return JSValue - javascript list
   260 // return JSValue - javascript list
   278 // ---------------------------------------------------------------------------
   261 // ---------------------------------------------------------------------------
   279 //
   262 //
  1164         {
  1147         {
  1165         User::Leave( ret );
  1148         User::Leave( ret );
  1166         }
  1149         }
  1167 
  1150 
  1168     CWidgetPropertyValue* displayname = widgetregistry.GetWidgetPropertyValueL(m_Uid, EBundleDisplayName );
  1151     CWidgetPropertyValue* displayname = widgetregistry.GetWidgetPropertyValueL(m_Uid, EBundleDisplayName );
  1169     if(displayname)
       
  1170         {
       
  1171         CleanupStack::PushL(displayname);
       
  1172         if(displayname->iType == EWidgetPropTypeString)
       
  1173             m_scriptSession->SetApplicationNameL(*displayname);
       
  1174         CleanupStack::PopAndDestroy(); // displayname
       
  1175         }
       
  1176     
       
  1177     User::LeaveIfError(widgetregistry.Disconnect());
  1152     User::LeaveIfError(widgetregistry.Disconnect());
  1178     CleanupStack::PopAndDestroy(); // widgetregistry
  1153     CleanupStack::PopAndDestroy(); //widgetregistry
       
  1154 
       
  1155     if ( displayname && displayname->iType == EWidgetPropTypeString )
       
  1156         {
       
  1157         m_scriptSession->SetApplicationNameL(*displayname);
       
  1158         }
  1179     );
  1159     );
  1180     }
  1160     }
  1181 #endif
  1161 #endif
  1182 
  1162 
  1183 // ----------------------------------------------------------------------------
  1163 // ----------------------------------------------------------------------------