114
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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: Active Idle Content Observer interface multiplexer
|
|
15 |
* implementation.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#include "aimulticontentobserver.h"
|
|
20 |
#include "aicontentobserveroptimizer.h"
|
|
21 |
|
|
22 |
CAiMultiContentObserver* CAiMultiContentObserver::NewL()
|
|
23 |
{
|
|
24 |
return new(ELeave) CAiMultiContentObserver;
|
|
25 |
}
|
|
26 |
|
|
27 |
|
|
28 |
CAiMultiContentObserver::~CAiMultiContentObserver()
|
|
29 |
{
|
|
30 |
iObserverOptimizers.ResetAndDestroy();
|
|
31 |
}
|
|
32 |
|
|
33 |
|
|
34 |
void CAiMultiContentObserver::AddObserverL(MAiContentObserver& aObserver)
|
|
35 |
{
|
|
36 |
TBool foundExisting = EFalse;
|
|
37 |
|
|
38 |
for( TInt i = 0; i < iObserverOptimizers.Count(); ++i )
|
|
39 |
{
|
|
40 |
if ( &(iObserverOptimizers[i]->Observer()) == &aObserver )
|
|
41 |
{
|
|
42 |
foundExisting = ETrue;
|
|
43 |
break;
|
|
44 |
}
|
|
45 |
}
|
|
46 |
if( !foundExisting )
|
|
47 |
{
|
|
48 |
CAiContentObserverOptimizer *optimizer =
|
|
49 |
CAiContentObserverOptimizer::NewL( aObserver );
|
|
50 |
iObserverOptimizers.AppendL( optimizer );
|
|
51 |
}
|
|
52 |
}
|
|
53 |
|
|
54 |
|
|
55 |
TInt CAiMultiContentObserver::StartTransaction( TInt aTxId )
|
|
56 |
{
|
|
57 |
TInt result = KErrNone;
|
|
58 |
const TInt count = iObserverOptimizers.Count();
|
|
59 |
for ( TInt i = 0; i < count; ++i )
|
|
60 |
{
|
|
61 |
const TInt r = iObserverOptimizers[i]->StartTransaction( aTxId );
|
|
62 |
|
|
63 |
if ( r != KErrNone )
|
|
64 |
{
|
|
65 |
result = r;
|
|
66 |
}
|
|
67 |
}
|
|
68 |
return result;
|
|
69 |
}
|
|
70 |
|
|
71 |
|
|
72 |
TInt CAiMultiContentObserver::Commit( TInt aTxId )
|
|
73 |
{
|
|
74 |
TInt result = KErrNone;
|
|
75 |
const TInt count = iObserverOptimizers.Count();
|
|
76 |
for ( TInt i = 0; i < count; ++i )
|
|
77 |
{
|
|
78 |
const TInt r = iObserverOptimizers[i]->Commit( aTxId );
|
|
79 |
|
|
80 |
if ( r != KErrNone )
|
|
81 |
{
|
|
82 |
result = r;
|
|
83 |
}
|
|
84 |
}
|
|
85 |
return result;
|
|
86 |
}
|
|
87 |
|
|
88 |
|
|
89 |
TInt CAiMultiContentObserver::CancelTransaction( TInt aTxId )
|
|
90 |
{
|
|
91 |
TInt result = KErrNone;
|
|
92 |
const TInt count = iObserverOptimizers.Count();
|
|
93 |
for ( TInt i = 0; i < count; ++i )
|
|
94 |
{
|
|
95 |
const TInt r = iObserverOptimizers[i]->CancelTransaction( aTxId );
|
|
96 |
if ( r != KErrNone )
|
|
97 |
{
|
|
98 |
result = r;
|
|
99 |
}
|
|
100 |
}
|
|
101 |
return result;
|
|
102 |
}
|
|
103 |
|
|
104 |
|
|
105 |
TBool CAiMultiContentObserver::CanPublish( CHsContentPublisher& aPlugin,
|
|
106 |
TInt aContent,
|
|
107 |
TInt aIndex )
|
|
108 |
{
|
|
109 |
const TInt count = iObserverOptimizers.Count();
|
|
110 |
for ( TInt i = 0; i < count; ++i )
|
|
111 |
{
|
|
112 |
if( iObserverOptimizers[i]->CanPublish( aPlugin, aContent, aIndex ) )
|
|
113 |
{
|
|
114 |
return ETrue;
|
|
115 |
}
|
|
116 |
}
|
|
117 |
return EFalse;
|
|
118 |
}
|
|
119 |
|
|
120 |
|
|
121 |
TInt CAiMultiContentObserver::Publish( CHsContentPublisher& aPlugin,
|
|
122 |
TInt aContent,
|
|
123 |
TInt aResource,
|
|
124 |
TInt aIndex )
|
|
125 |
{
|
|
126 |
TInt result = KErrNone;
|
|
127 |
const TInt count = iObserverOptimizers.Count();
|
|
128 |
for ( TInt i = 0; i < count; ++i )
|
|
129 |
{
|
|
130 |
const TInt r = iObserverOptimizers[i]->Publish( aPlugin, aContent, aResource, aIndex );
|
|
131 |
if ( r != KErrNone )
|
|
132 |
{
|
|
133 |
result = r;
|
|
134 |
}
|
|
135 |
}
|
|
136 |
return result;
|
|
137 |
}
|
|
138 |
|
|
139 |
|
|
140 |
TInt CAiMultiContentObserver::Publish( CHsContentPublisher& aPlugin,
|
|
141 |
TInt aContent,
|
|
142 |
const TDesC16& aText,
|
|
143 |
TInt aIndex )
|
|
144 |
{
|
|
145 |
TInt result = KErrNone;
|
|
146 |
const TInt count = iObserverOptimizers.Count();
|
|
147 |
for ( TInt i = 0; i < count; ++i )
|
|
148 |
{
|
|
149 |
const TInt r = iObserverOptimizers[i]->Publish( aPlugin, aContent, aText, aIndex );
|
|
150 |
if ( r != KErrNone )
|
|
151 |
{
|
|
152 |
result = r;
|
|
153 |
}
|
|
154 |
}
|
|
155 |
return result;
|
|
156 |
}
|
|
157 |
|
|
158 |
|
|
159 |
TInt CAiMultiContentObserver::Publish( CHsContentPublisher& aPlugin,
|
|
160 |
TInt aContent,
|
|
161 |
const TDesC8& aBuf,
|
|
162 |
TInt aIndex )
|
|
163 |
{
|
|
164 |
TInt result = KErrNone;
|
|
165 |
const TInt count = iObserverOptimizers.Count();
|
|
166 |
for ( TInt i = 0; i < count; ++i )
|
|
167 |
{
|
|
168 |
const TInt r = iObserverOptimizers[i]->Publish( aPlugin, aContent, aBuf, aIndex );
|
|
169 |
if ( r != KErrNone )
|
|
170 |
{
|
|
171 |
result = r;
|
|
172 |
}
|
|
173 |
}
|
|
174 |
return result;
|
|
175 |
}
|
|
176 |
|
|
177 |
|
|
178 |
TInt CAiMultiContentObserver::Publish( CHsContentPublisher& aPlugin,
|
|
179 |
TInt aContent,
|
|
180 |
RFile& aFile,
|
|
181 |
TInt aIndex )
|
|
182 |
{
|
|
183 |
TInt result = KErrNone;
|
|
184 |
const TInt count = iObserverOptimizers.Count();
|
|
185 |
for ( TInt i = 0; i < count; ++i )
|
|
186 |
{
|
|
187 |
const TInt r = iObserverOptimizers[i]->Publish( aPlugin, aContent, aFile, aIndex );
|
|
188 |
if ( r != KErrNone )
|
|
189 |
{
|
|
190 |
result = r;
|
|
191 |
}
|
|
192 |
}
|
|
193 |
return result;
|
|
194 |
}
|
|
195 |
|
|
196 |
|
|
197 |
TInt CAiMultiContentObserver::Clean( CHsContentPublisher& aPlugin,
|
|
198 |
TInt aContent,
|
|
199 |
TInt aIndex )
|
|
200 |
{
|
|
201 |
TInt result = KErrNone;
|
|
202 |
const TInt count = iObserverOptimizers.Count();
|
|
203 |
for ( TInt i = 0; i < count; ++i )
|
|
204 |
{
|
|
205 |
const TInt r = iObserverOptimizers[i]->Clean( aPlugin, aContent, aIndex );
|
|
206 |
if ( r != KErrNone )
|
|
207 |
{
|
|
208 |
result = r;
|
|
209 |
}
|
|
210 |
}
|
|
211 |
return result;
|
|
212 |
}
|
|
213 |
|
|
214 |
|
|
215 |
TAny* CAiMultiContentObserver::Extension( TUid /*aUid*/ )
|
|
216 |
{
|
|
217 |
return NULL;
|
|
218 |
}
|
|
219 |
|
|
220 |
TBool CAiMultiContentObserver::RequiresSubscription(
|
|
221 |
const THsPublisherInfo& /*aPublisherInfo*/ ) const
|
|
222 |
{
|
|
223 |
return ETrue;
|
|
224 |
}
|
|
225 |
|
|
226 |
TInt CAiMultiContentObserver::SetProperty( CHsContentPublisher& /*aPlugin*/,
|
|
227 |
const TDesC8& /*aElementId*/,
|
|
228 |
const TDesC8& /*aPropertyName*/,
|
|
229 |
const TDesC8& /*aPropertyValue*/ )
|
|
230 |
{
|
|
231 |
return KErrNotSupported;
|
|
232 |
}
|
|
233 |
|
|
234 |
TInt CAiMultiContentObserver::SetProperty( CHsContentPublisher& /*aPlugin*/,
|
|
235 |
const TDesC8& /*aElementId*/,
|
|
236 |
const TDesC8& /*aPropertyName*/,
|
|
237 |
const TDesC8& /*aPropertyValue*/,
|
|
238 |
MAiContentObserver::TValueType /*aValueType*/)
|
|
239 |
{
|
|
240 |
return KErrNotSupported;
|
|
241 |
}
|
|
242 |
|
|
243 |
void CAiMultiContentObserver::ClearBlackList()
|
|
244 |
{
|
|
245 |
const TInt count = iObserverOptimizers.Count();
|
|
246 |
for ( TInt i = 0; i < count; ++i )
|
|
247 |
{
|
|
248 |
iObserverOptimizers[i]->ClearBlackList();
|
|
249 |
}
|
|
250 |
}
|
|
251 |
|
|
252 |
CAiMultiContentObserver::CAiMultiContentObserver()
|
|
253 |
{
|
|
254 |
}
|
|
255 |
|
|
256 |
// End of file
|