|
1 /* |
|
2 * Copyright (c) 2008 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: WMDRM DLA Default UI Plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <wmdrmdlautils.rsg> |
|
20 #include <wmdrmdlatypes.h> |
|
21 #include <wmdrmdlacancelobserver.h> |
|
22 #include "wmdrmdlaui.h" |
|
23 #include "wmdrmdladefaultuiplugin.h" |
|
24 |
|
25 #define _LOGGING_FILE L"wmdrmdladefaultuiplugin.txt" |
|
26 #include "logfn.h" |
|
27 |
|
28 // ======== LOCAL FUNCTIONS ======== |
|
29 |
|
30 // ======== MEMBER FUNCTIONS ======== |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // CWmDrmDlaDefaultUiPlugin::ConstructL |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 void CWmDrmDlaDefaultUiPlugin::ConstructL() |
|
37 { |
|
38 LOGFN( "CWmDrmDlaDefaultUiPlugin::ConstructL" ); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CWmDrmDlaDefaultUiPlugin::CWmDrmDlaDefaultUiPlugin |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CWmDrmDlaDefaultUiPlugin::CWmDrmDlaDefaultUiPlugin() |
|
46 { |
|
47 LOGFN( "CWmDrmDlaDefaultUiPlugin::CWmDrmDlaDefaultUiPlugin" ); |
|
48 TRAP_IGNORE( iUi = CWmDrmDlaUi::NewL() ); |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CWmDrmDlaDefaultUiPlugin::NewL |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CWmDrmDlaDefaultUiPlugin* CWmDrmDlaDefaultUiPlugin::NewL() |
|
56 { |
|
57 LOGFN( "CWmDrmDlaDefaultUiPlugin::NewL" ); |
|
58 CWmDrmDlaDefaultUiPlugin* self = new( ELeave ) CWmDrmDlaDefaultUiPlugin; |
|
59 CleanupStack::PushL( self ); |
|
60 self->ConstructL(); |
|
61 CleanupStack::Pop( self ); |
|
62 return self; |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CWmDrmDlaDefaultUiPlugin::~CWmDrmDlaDefaultUiPlugin |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 CWmDrmDlaDefaultUiPlugin::~CWmDrmDlaDefaultUiPlugin() |
|
70 { |
|
71 LOGFN( "CWmDrmDlaDefaultUiPlugin::~CWmDrmDlaDefaultUiPlugin" ); |
|
72 delete iUi; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CWmDrmDlaDefaultUiPlugin::SetCancelObserver |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 void CWmDrmDlaDefaultUiPlugin::SetCancelObserver( |
|
80 MWmDrmDlaCancelObserver* aObserver ) |
|
81 { |
|
82 LOGFN( "CWmDrmDlaDefaultUiPlugin::SetCancelObserver" ); |
|
83 iObserver = aObserver; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CWmDrmDlaDefaultUiPlugin::SetSilent |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 void CWmDrmDlaDefaultUiPlugin::SetSilent( |
|
91 TBool /*aSilent*/ ) |
|
92 { |
|
93 LOGFN( "CWmDrmDlaDefaultUiPlugin::SetSilent" ); |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // CWmDrmDlaDefaultUiPlugin::SetProgress |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CWmDrmDlaDefaultUiPlugin::SetProgress( |
|
101 TInt aState ) |
|
102 { |
|
103 TInt err( KErrNone ); |
|
104 |
|
105 LOGFNR( "CWmDrmDlaDefaultUiPlugin::SetProgress", err ); |
|
106 |
|
107 switch( aState ) |
|
108 { |
|
109 case EProcessingDRMHeader: |
|
110 if ( iUi ) |
|
111 { |
|
112 TRAP( err, |
|
113 iUi->ShowWaitNoteL( R_WMDRMDLA_WAIT_NOTE_ACQUIRING_LICENSE, |
|
114 this ) ); |
|
115 } |
|
116 break; |
|
117 |
|
118 case EProcessingMeteringChallenge: |
|
119 if ( iUi ) |
|
120 { |
|
121 TRAP( err, |
|
122 iUi->ShowWaitNoteL( R_WMDRMDLA_WAIT_NOTE_METERING, |
|
123 this ) ); |
|
124 } |
|
125 break; |
|
126 |
|
127 case EIdle: |
|
128 if ( iUi ) |
|
129 { |
|
130 iUi->RemoveWaitNote(); |
|
131 } |
|
132 break; |
|
133 |
|
134 default: |
|
135 break; |
|
136 } |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // CWmDrmDlaDefaultUiPlugin::HandleErrorL |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void CWmDrmDlaDefaultUiPlugin::HandleErrorL( |
|
144 TInt /*aError*/ ) |
|
145 { |
|
146 LOGFN( "CWmDrmDlaDefaultUiPlugin::HandleErrorL" ); |
|
147 if ( iUi ) |
|
148 { |
|
149 iUi->RemoveWaitNote(); |
|
150 } |
|
151 User::Leave( KErrNotSupported ); |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // CWmDrmDlaDefaultUiPlugin::UserWaitNoteCancellation |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 void CWmDrmDlaDefaultUiPlugin::UserWaitNoteCancellation() |
|
159 { |
|
160 LOGFN( "CWmDrmDlaDefaultUiPlugin::UserWaitNoteCancellation" ); |
|
161 if ( iObserver ) |
|
162 { |
|
163 iObserver->UserCancellation(); |
|
164 } |
|
165 } |