contentstorage/casrv/carunningappmonitor/inc/carunningappmonitor.h
changeset 116 305818acdca4
parent 112 dbfb5e38438b
child 119 50e220be30d1
equal deleted inserted replaced
112:dbfb5e38438b 116:305818acdca4
     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 "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: ccarunningappmonitor.h
       
    15 *
       
    16 */
       
    17 #ifndef C_CARUNNINGTASKHANDLER_H
       
    18 #define C_CARUNNINGTASKHANDLER_H
       
    19 
       
    20 #include "carunningtaskhandler.h"
       
    21 #include <e32base.h>
       
    22 #include <w32std.h>
       
    23 #include <e32hashtab.h>
       
    24 
       
    25 class CApaWindowGroupName;
       
    26 class CCaStorageProxy;
       
    27 NONSHARABLE_CLASS( CCaRunningAppMonitor ): public CActive
       
    28     {
       
    29 public:
       
    30     /**
       
    31      * Function create monitor instance and initialize observation process.
       
    32      * Monitor instance will be registered on task handler.
       
    33      * @param aTaskHandler - task handler instance
       
    34      * @param aStorage - content storage proxy instance
       
    35      */
       
    36     static void ExecuteL( MCaRunningTaskHandler& aTaskHandler, 
       
    37                           CCaStorageProxy& aStorage );
       
    38     
       
    39     /**
       
    40      * Destructor
       
    41      */
       
    42     ~CCaRunningAppMonitor();
       
    43 
       
    44 private:
       
    45     /**
       
    46      * First step constructor.
       
    47      */
       
    48     CCaRunningAppMonitor( MCaRunningTaskHandler& aTaskHandler,
       
    49                           CCaStorageProxy& aStorage );
       
    50     
       
    51     /**
       
    52      * Second step constructor
       
    53      */
       
    54     void ConstructL();
       
    55     
       
    56     /**
       
    57      * Function update content storage with running applications list
       
    58      */
       
    59     void UpdateRunningAppStorageL();
       
    60     
       
    61     /**
       
    62      * Function subscribe monitor to window server events
       
    63      */
       
    64     void Subscribe();
       
    65     
       
    66     /**
       
    67      * Function create window group to observe window server events
       
    68      */
       
    69     void ConstractObserverL();
       
    70     
       
    71     /**
       
    72      * Function mark all storage entries as "not running"
       
    73      */
       
    74     void ResetStorageL();
       
    75 
       
    76 private: //from CActive
       
    77     /**
       
    78      * @see CActive
       
    79      */
       
    80     void RunL();
       
    81     
       
    82     /**
       
    83      * @see CActive
       
    84      */
       
    85     TInt RunError( TInt aError );
       
    86     
       
    87     /**
       
    88      * @see CActive
       
    89      */
       
    90     void DoCancel();
       
    91 
       
    92 private:
       
    93     //members
       
    94     
       
    95     /**
       
    96      * Reference to task handler.
       
    97      */
       
    98     MCaRunningTaskHandler& iTaskHandler;
       
    99     
       
   100     /**
       
   101      * Reference to constent storage proxy 
       
   102      */
       
   103     CCaStorageProxy& iStorage;
       
   104     
       
   105     /**
       
   106      * IPC session to window server
       
   107      */
       
   108     RWsSession iSession;
       
   109     
       
   110     /**
       
   111      * Window group.
       
   112      */
       
   113     RWindowGroup iWg;
       
   114     
       
   115     /**
       
   116      * Running apps hash map
       
   117      * key - application window group id
       
   118      * value - application uid
       
   119      */
       
   120     RHashMap<TInt, TUid> iRunningTasks;
       
   121     };
       
   122 
       
   123 #endif //C_CARUNNINGTASKHANDLER_H