browserutilities/feedsengine/FeedsServer/UrlHandler/src/ServerHttpConnection.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
    14 * Description:  A class that fetches resources via HTTP 1.1.
    14 * Description:  A class that fetches resources via HTTP 1.1.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <ApUtils.h> 
    19 #include "browser_platform_variant.hrh"
    20 #include <InternetConnectionManager.h>
    20 #include <aputils.h> 
       
    21 #include <internetconnectionmanager.h>
    21 
    22 
    22 #include "ServerHttpConnection.h"
    23 #include "ServerHttpConnection.h"
    23 #include "Logger.h"
    24 #include "Logger.h"
    24 
    25 #ifdef BRDO_OCC_ENABLED_FF
       
    26 #include <FeatMgr.h>
       
    27 #include <CentralRepository.h>
       
    28 #include <CoreApplicationUIsSDKCRKeys.h>
       
    29 #endif
    25 
    30 
    26 // -----------------------------------------------------------------------------
    31 // -----------------------------------------------------------------------------
    27 // CServerHttpConnection::NewL
    32 // CServerHttpConnection::NewL
    28 //
    33 //
    29 // Two-phased constructor.
    34 // Two-phased constructor.
    96     TInt  err = KErrNone;
   101     TInt  err = KErrNone;
    97 
   102 
    98     // If need be establish the connection.
   103     // If need be establish the connection.
    99     if(!IsConnected())
   104     if(!IsConnected())
   100         {
   105         {
       
   106 #ifdef BRDO_OCC_ENABLED_FF
       
   107         TUint32 snapId = 0; //Defaults connects to Internet snap
       
   108         iConMgr->SetConnectionType(CMManager::EDestination);
       
   109         iConMgr->SetRequestedSnap(snapId);
       
   110        if ( !IsPhoneOfflineL() )
       
   111            {
       
   112            // For only feeds, this silent is required
       
   113            iConMgr->SetOccPreferences(ESilient);
       
   114            }
       
   115 #else
   101         // Set the default access point.
   116         // Set the default access point.
   102         iConMgr->SetRequestedAP( iDefaultAccessPoint );
   117         iConMgr->SetRequestedAP( iDefaultAccessPoint );
   103             
   118 #endif
   104         // Open a connection.
   119         // Open a connection.
   105         TRAP(err, err = iConMgr->StartConnectionL(ETrue));                
   120         TRAP(err, err = iConMgr->StartConnectionL(ETrue));                
   106         if (err != KErrNone)
   121         if (err != KErrNone)
   107             {
   122             {
   108             // Notify the HttpHandler that the establishing the access point failed
   123             // Notify the HttpHandler that the establishing the access point failed
   183 //
   198 //
   184 void CServerHttpConnection::SetAccessPointL( TUint32 aAccessPoint )
   199 void CServerHttpConnection::SetAccessPointL( TUint32 aAccessPoint )
   185     {
   200     {
   186     iDefaultAccessPoint = aAccessPoint;
   201     iDefaultAccessPoint = aAccessPoint;
   187     }
   202     }
       
   203 
       
   204 #ifdef BRDO_OCC_ENABLED_FF
       
   205 // ---------------------------------------------------------
       
   206 // CServerHttpConnection::IsPhoneOfflineL
       
   207 //
       
   208 // Checks if phone is in offline mode or not.
       
   209 // Return ETrue if phone is in offline mode.
       
   210 // Return EFalse if phone is not in offline mode.
       
   211 // ---------------------------------------------------------
       
   212 //
       
   213 TBool CServerHttpConnection::IsPhoneOfflineL() 
       
   214      {
       
   215      FeatureManager::InitializeLibL();
       
   216      TBool onLineMode = FeatureManager::FeatureSupported( KFeatureIdOfflineMode );
       
   217      FeatureManager::UnInitializeLib();
       
   218      if ( onLineMode )
       
   219          {
       
   220          CRepository* repository = CRepository::NewLC( KCRUidCoreApplicationUIs );
       
   221          TInt connAllowed = 1;
       
   222          repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed );
       
   223          CleanupStack::PopAndDestroy(); //repository  
       
   224          if ( !connAllowed )
       
   225              {
       
   226              //Yes, Phone is in Offline mode
       
   227              return ETrue;
       
   228              }
       
   229          }
       
   230      //Phone is in Online mode
       
   231      return EFalse;
       
   232      }
       
   233 #endif