wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp
changeset 74 2768d547bb4b
parent 42 a7bc3704293e
child 72 1481bf457703
equal deleted inserted replaced
65:1e96dbdff71c 74:2768d547bb4b
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <AknDef.h>
    20 #include <AknDef.h>
    21 #include <aknview.h>
    21 #include <aknview.h>
    22 #include <brctlinterface.h>
       
    23 #include "wmdrmdlabrowserview.h"
    22 #include "wmdrmdlabrowserview.h"
    24 #include "wmdrmdlabrowsercontainer.h"
    23 #include "wmdrmdlabrowsercontainer.h"
    25 
    24 
    26 // ======== MEMBER FUNCTIONS ========
    25 // ======== MEMBER FUNCTIONS ========
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CWmDrmDlaBrowserContainer::ConstructL
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 void CWmDrmDlaBrowserContainer::ConstructL(
       
    33     MBrCtlSpecialLoadObserver* aObserver )
       
    34     {
       
    35     CreateWindowL();
       
    36     SetRect( iView->ClientRect() );
       
    37     
       
    38     iBrCtlInterface = CreateBrowserControlL(
       
    39             this,                                      // parent control
       
    40             iView->ClientRect(),                       // client rect
       
    41             TBrCtlDefs::ECapabilityLoadHttpFw |
       
    42             TBrCtlDefs::ECapabilityDisplayScrollBar |
       
    43             TBrCtlDefs::ECapabilityUseDlMgr |
       
    44             TBrCtlDefs::ECapabilityCursorNavigation,   // Capabilities
       
    45             TBrCtlDefs::ECommandIdBase,                // command base
       
    46             NULL,                                      // Softkeys observer
       
    47             NULL,                                      // LinkResolver
       
    48             aObserver,                                 // Special load observer
       
    49             NULL,                                      // Layout Observer
       
    50             NULL,                                      // Dialog provider
       
    51             NULL,                                      // window observer
       
    52             NULL                                       // Download observer
       
    53             );
       
    54 
       
    55     iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages,
       
    56                                          ETrue );
       
    57     iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsCookiesEnabled,
       
    58                                          ETrue );
       
    59     iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded,
       
    60                                          ETrue );
       
    61     ActivateL();
       
    62     }
       
    63 
    26 
    64 // ---------------------------------------------------------------------------
    27 // ---------------------------------------------------------------------------
    65 // CWmDrmDlaBrowserContainer::CWmDrmDlaBrowserContainer
    28 // CWmDrmDlaBrowserContainer::CWmDrmDlaBrowserContainer
    66 // ---------------------------------------------------------------------------
    29 // ---------------------------------------------------------------------------
    67 //
    30 //
    69     CAknView* aView ) : iView( aView )
    32     CAknView* aView ) : iView( aView )
    70     {
    33     {
    71     }
    34     }
    72 
    35 
    73 // ---------------------------------------------------------------------------
    36 // ---------------------------------------------------------------------------
    74 // CWmDrmDlaBrowserContainer::NewL
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewL(
       
    78     CAknView* aView,
       
    79     MBrCtlSpecialLoadObserver* aObserver )
       
    80     {
       
    81     CWmDrmDlaBrowserContainer* self
       
    82         = CWmDrmDlaBrowserContainer::NewLC( aView, aObserver );
       
    83     CleanupStack::Pop( self );
       
    84     return self;
       
    85     }
       
    86 
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CWmDrmDlaBrowserContainer::NewLC
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewLC(
       
    93     CAknView* aView,
       
    94     MBrCtlSpecialLoadObserver* aObserver )
       
    95     {
       
    96     CWmDrmDlaBrowserContainer* self
       
    97         = new( ELeave ) CWmDrmDlaBrowserContainer( aView );
       
    98     CleanupStack::PushL( self );
       
    99     self->ConstructL( aObserver );
       
   100     return self;
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // CWmDrmDlaBrowserContainer::~CWmDrmDlaBrowserContainer
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 CWmDrmDlaBrowserContainer::~CWmDrmDlaBrowserContainer()
       
   109     {
       
   110     if(iBrCtlInterface != NULL)
       
   111     {
       
   112     TRAP_IGNORE( iBrCtlInterface->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ));	
       
   113     }	
       
   114     delete iBrCtlInterface;
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CWmDrmDlaBrowserContainer::BrCtlInterface
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 CBrCtlInterface* CWmDrmDlaBrowserContainer::BrCtlInterface()
       
   122     {
       
   123     return iBrCtlInterface;
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CWmDrmDlaBrowserContainer::CountComponentControls
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 TInt CWmDrmDlaBrowserContainer::CountComponentControls() const
       
   131     {
       
   132     if ( iBrCtlInterface )
       
   133         {
       
   134         return 1;
       
   135         }
       
   136     return 0;
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // CWmDrmDlaBrowserContainer::SizeChanged
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 void CWmDrmDlaBrowserContainer::SizeChanged()
       
   144     {
       
   145     if ( iBrCtlInterface )
       
   146         {
       
   147         iBrCtlInterface->SetRect( Rect() );
       
   148         }
       
   149     }
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 // CWmDrmDlaBrowserContainer::ComponentControl
    37 // CWmDrmDlaBrowserContainer::ComponentControl
   153 // ---------------------------------------------------------------------------
    38 // ---------------------------------------------------------------------------
   154 //
    39 //
   155 CCoeControl* CWmDrmDlaBrowserContainer::ComponentControl(
    40 CCoeControl* CWmDrmDlaBrowserContainer::ComponentControl(
   156     TInt aIndex ) const
    41     TInt aIndex ) const
   157     {
    42     {
   158     switch ( aIndex )
    43     switch ( aIndex )
   159         {
    44         {
   160         case 0:
       
   161             return iBrCtlInterface;
       
   162 
       
   163         default:
    45         default:
   164             return NULL;
    46             return NULL;
   165         }
    47         }
   166     }
       
   167 
       
   168 // ---------------------------------------------------------------------------
       
   169 // CWmDrmDlaBrowserContainer::OfferKeyEventL
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 TKeyResponse CWmDrmDlaBrowserContainer::OfferKeyEventL(
       
   173     const TKeyEvent& aKeyEvent,
       
   174     TEventCode aType )
       
   175     {
       
   176     if ( iBrCtlInterface )
       
   177         {
       
   178         return iBrCtlInterface->OfferKeyEventL( aKeyEvent, aType );
       
   179         }
       
   180     return EKeyWasNotConsumed;
       
   181     }
    48     }
   182 
    49 
   183 // ---------------------------------------------------------------------------
    50 // ---------------------------------------------------------------------------
   184 // CWmDrmDlaBrowserContainer::FocusChanged
    51 // CWmDrmDlaBrowserContainer::FocusChanged
   185 // ---------------------------------------------------------------------------
    52 // ---------------------------------------------------------------------------
   186 //
    53 //
   187 void CWmDrmDlaBrowserContainer::FocusChanged(
    54 void CWmDrmDlaBrowserContainer::FocusChanged(
   188     TDrawNow aDrawNow )
    55     TDrawNow aDrawNow )
   189     {
    56     {
   190     iBrCtlInterface->SetFocus( IsFocused() );
       
   191     CCoeControl::FocusChanged( aDrawNow );
    57     CCoeControl::FocusChanged( aDrawNow );
   192     }
    58     }
   193 
    59 
   194 // ---------------------------------------------------------------------------
    60 // ---------------------------------------------------------------------------
   195 // CWmDrmDlaBrowserContainer::HandleResourceChange
    61 // CWmDrmDlaBrowserContainer::HandleResourceChange
   196 // ---------------------------------------------------------------------------
    62 // ---------------------------------------------------------------------------
   197 //
    63 //
   198 void CWmDrmDlaBrowserContainer::HandleResourceChange(
    64 void CWmDrmDlaBrowserContainer::HandleResourceChange(
   199     TInt aType )
    65     TInt aType )
   200     {
    66     {
   201     if ( iBrCtlInterface )
       
   202         {
       
   203         iBrCtlInterface->HandleResourceChange( aType );
       
   204         }
       
   205     CCoeControl::HandleResourceChange( aType );
    67     CCoeControl::HandleResourceChange( aType );
   206     if ( aType == KEikDynamicLayoutVariantSwitch )
    68     if ( aType == KEikDynamicLayoutVariantSwitch )
   207         {
    69         {
   208         SetRect( iView->ClientRect() );
    70         SetRect( iView->ClientRect() );
   209         DrawDeferred();
    71         DrawDeferred();