browserui/browser/BrowserAppSrc/BrowserDialogsProviderBlocker.cpp
changeset 0 84ad3b177aa3
equal deleted inserted replaced
-1:000000000000 0:84ad3b177aa3
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Blocks dialog requests to the BrowserDialogsProvider if a
       
    15 *               window is in the background. When the window comes to the 
       
    16 *               foreground, it will be displayed.
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 #include "BrowserDialogsProviderBlocker.h"
       
    22 #include "BrowserWindowFocusNotifier.h"
       
    23 
       
    24 // ----------------------------------------------------------------------------
       
    25 //	static CBrowserDialogsProviderBlocker* 
       
    26 //                                  CBrowserDialogsProviderBlocker::NewLC
       
    27 // ----------------------------------------------------------------------------
       
    28 //    
       
    29 CBrowserDialogsProviderBlocker* CBrowserDialogsProviderBlocker::NewLC(
       
    30                             CBrowserWindowFocusNotifier& aWinFocusNotifier )
       
    31     {
       
    32     CBrowserDialogsProviderBlocker* self = new (ELeave) 
       
    33                 CBrowserDialogsProviderBlocker( aWinFocusNotifier );
       
    34     CleanupStack::PushL(self);
       
    35     self->ConstructL();
       
    36     return self;
       
    37     }
       
    38 
       
    39 // ----------------------------------------------------------------------------
       
    40 //	CBrowserDialogsProviderBlocker::CBrowserDialogsProviderBlocker()
       
    41 // ----------------------------------------------------------------------------
       
    42 //    
       
    43 CBrowserDialogsProviderBlocker::CBrowserDialogsProviderBlocker(
       
    44                             CBrowserWindowFocusNotifier& aWinFocusNotifier )
       
    45  
       
    46     : CActive( CActive::EPriorityStandard ),
       
    47     iWinFocusNotifier( aWinFocusNotifier )
       
    48     {
       
    49     CActiveScheduler::Add( this );
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 //	CBrowserDialogsProviderBlocker::~CBrowserDialogsProviderBlocker()
       
    54 //  Destroy the object and release all memory objects
       
    55 // ---------------------------------------------------------------------------
       
    56 //    
       
    57 CBrowserDialogsProviderBlocker::~CBrowserDialogsProviderBlocker()
       
    58     {
       
    59     Cancel();
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 //	void CBrowserDialogsProviderBlocker::ConstructL()
       
    64 //  Two-pase constructor
       
    65 // ---------------------------------------------------------------------------
       
    66 //    
       
    67 void CBrowserDialogsProviderBlocker::ConstructL()
       
    68     {
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 //	void CBrowserDialogsProviderBlocker::Start()
       
    73 //  Complete an asynchronous request.
       
    74 // ---------------------------------------------------------------------------
       
    75 //    
       
    76 void CBrowserDialogsProviderBlocker::Start()
       
    77     {
       
    78     // Register the AO status
       
    79     iStatus = KRequestPending;
       
    80     iWinFocusNotifier.Add( &iStatus );
       
    81     SetActive();
       
    82     
       
    83     // Asynch wait start
       
    84     iWait.Start();
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 //	void CBrowserDialogsProviderBlocker::DoCancel()
       
    89 //  Cancel any outstanding requests.
       
    90 // ---------------------------------------------------------------------------
       
    91 //    
       
    92 void CBrowserDialogsProviderBlocker::DoCancel()
       
    93     {
       
    94     // The AO can continue
       
    95     iWait.AsyncStop();
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 //	void CBrowserDialogsProviderBlocker::RunL()
       
   100 //  Handles object`s request completion event.
       
   101 // ---------------------------------------------------------------------------
       
   102 //    
       
   103 void CBrowserDialogsProviderBlocker::RunL()
       
   104     {
       
   105     // The AO can continue
       
   106     iWait.AsyncStop();  
       
   107     }
       
   108 
       
   109 // End of file