1 /* |
|
2 * Copyright (c) 2002-2007 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: Monitor for browser termination |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "csatbrowserwsmonitor.h" |
|
21 #include "CSatBrowserTerminationMonitor.h" |
|
22 #include "SatLog.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CSatBrowserTerminationMonitor::CSatBrowserTerminationMonitor |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CSatBrowserTerminationMonitor::CSatBrowserTerminationMonitor( |
|
32 MSatEventMonitorUtils& aUtils ) : |
|
33 CSatEventMonitorHandler( aUtils ) |
|
34 { |
|
35 LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\ |
|
36 CSatBrowserTerminationMonitor calling-exiting" ) |
|
37 } |
|
38 |
|
39 // Destructor |
|
40 CSatBrowserTerminationMonitor::~CSatBrowserTerminationMonitor() |
|
41 { |
|
42 LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\ |
|
43 ~CSatBrowserTerminationMonitor calling" ) |
|
44 |
|
45 if ( iWSMonitor ) |
|
46 { |
|
47 iWSMonitor->DoCancelMonitor(); |
|
48 delete iWSMonitor; |
|
49 iWSMonitor = NULL; |
|
50 } |
|
51 |
|
52 LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\ |
|
53 ~CSatBrowserTerminationMonitor exiting" ) |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CSatBrowserTerminationMonitor::NewL |
|
58 // Two-phased constructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CSatBrowserTerminationMonitor* CSatBrowserTerminationMonitor::NewL( |
|
62 MSatEventMonitorUtils& aUtils ) |
|
63 { |
|
64 LOG( SIMPLE, |
|
65 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::NewL calling" ) |
|
66 |
|
67 CSatBrowserTerminationMonitor* self = |
|
68 new ( ELeave ) CSatBrowserTerminationMonitor( aUtils ); |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL(); |
|
71 CleanupStack::Pop( /*self*/ ); |
|
72 |
|
73 LOG( SIMPLE, |
|
74 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::NewL exiting" ) |
|
75 return self; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CSatBrowserTerminationMonitor::ConstructL |
|
80 // Symbian 2nd phase constructor can leave. |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 void CSatBrowserTerminationMonitor::ConstructL() |
|
84 { |
|
85 LOG( SIMPLE, |
|
86 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::ConstructL calling" ) |
|
87 |
|
88 // Create base class and give this monitors event as a parameter. |
|
89 BaseConstructL( MSatEventMonitor::EBrowserTerminated ); |
|
90 |
|
91 // Create Windows session monitor. |
|
92 iWSMonitor = CSatBrowserWSMonitor::NewL(); |
|
93 |
|
94 LOG( SIMPLE, |
|
95 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::ConstructL exiting" ) |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CSatBrowserTerminationMonitor::DoCancelMonitor |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CSatBrowserTerminationMonitor::DoCancelMonitor() |
|
103 { |
|
104 LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\ |
|
105 DoCancelMonitor calling" ) |
|
106 |
|
107 iWSMonitor->DoCancelMonitor(); |
|
108 |
|
109 LOG( SIMPLE, "SATEVENTMONITORS: CSatBrowserTerminationMonitor::\ |
|
110 DoCancelMonitor exiting" ) |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CSatBrowserTerminationMonitor::StartMonitor |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TInt CSatBrowserTerminationMonitor::StartMonitor() |
|
118 { |
|
119 LOG( SIMPLE, |
|
120 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::StartMonitor calling" ) |
|
121 |
|
122 if ( !iWSMonitor->IsActive() ) |
|
123 { |
|
124 LOG( SIMPLE, |
|
125 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::StartMonitor \ |
|
126 StartMonitor" ) |
|
127 iWSMonitor->StartMonitor( this ); |
|
128 } |
|
129 |
|
130 LOG( SIMPLE, |
|
131 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::StartMonitor exiting" ) |
|
132 return KErrNone; |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CSatBrowserTerminationMonitor::NotifyBrowserTerminated |
|
137 // Sends event download notification to SAT Engine. |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CSatBrowserTerminationMonitor::NotifyBrowserTerminated( |
|
141 const RSat::TBrowserTerminationCause aCause ) |
|
142 { |
|
143 LOG( SIMPLE, |
|
144 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::BrowserTerminated \ |
|
145 calling" ) |
|
146 |
|
147 // Send cause to SAT Engine |
|
148 EventOccured( aCause ); |
|
149 |
|
150 // Restart the monitor |
|
151 StartMonitor(); |
|
152 |
|
153 LOG( SIMPLE, |
|
154 "SATEVENTMONITORS: CSatBrowserTerminationMonitor::NotifyBrowserTerminated\ |
|
155 exiting" ) |
|
156 } |
|
157 |
|
158 // End of file |
|