1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <apsidchecker.h> |
|
17 #include <ecom/ecom.h> |
|
18 |
|
19 //const TUid KAppSidCheckerInterfaceUid = {0x10281FBB}; //old interface used when checking based only on SID |
|
20 const TUid KAppSidCheckerInterfaceUid = {0x20007D8C}; // current interface used when checking based on SID and drive number |
|
21 |
|
22 |
|
23 CAppSidChecker* CAppSidChecker::CheckerForAppType(const TUid &aAppTypeUid) |
|
24 { |
|
25 TEComResolverParams resolverParams; |
|
26 TBuf8<KMaxUidName> sidName; |
|
27 sidName.Copy(aAppTypeUid.Name()); |
|
28 resolverParams.SetDataType(sidName); |
|
29 TAny* ptr = NULL; |
|
30 TRAP_IGNORE( ptr = REComSession::CreateImplementationL( |
|
31 KAppSidCheckerInterfaceUid, |
|
32 _FOFF(CAppSidChecker, iDtor_ID_Key), |
|
33 NULL, resolverParams) ); |
|
34 return reinterpret_cast<CAppSidChecker*>(ptr); |
|
35 } |
|
36 |
|
37 /** The destruction of the interface implementation */ |
|
38 EXPORT_C CAppSidChecker::~CAppSidChecker() |
|
39 { |
|
40 REComSession::DestroyedImplementation(iDtor_ID_Key); |
|
41 iReserved1 = NULL; |
|
42 iReserved2 = NULL; |
|
43 iReserved3 = NULL; |
|
44 } |
|
45 |
|
46 EXPORT_C void CAppSidChecker::SetRescanCallBackL(const TCallBack&) |
|
47 { |
|
48 } |
|
49 |
|
50 EXPORT_C void CAppSidChecker::reserved1() |
|
51 { |
|
52 } |
|
53 |
|
54 EXPORT_C void CAppSidChecker::reserved2() |
|
55 { |
|
56 } |
|
57 |
|
58 EXPORT_C void CAppSidChecker::reserved3() |
|
59 { |
|
60 } |
|
61 |
|
62 RSidCheckerMap::RSidCheckerMap( TCallBack aRescanCallBack ) : |
|
63 iRescanCallBack( aRescanCallBack ) |
|
64 { |
|
65 } |
|
66 |
|
67 CAppSidChecker& RSidCheckerMap::FindSidCheckerL(TUid aAppType) |
|
68 { |
|
69 CAppSidChecker* checker = NULL; |
|
70 CAppSidChecker** checkerPtr = Find(aAppType.iUid); |
|
71 if(checkerPtr) |
|
72 { |
|
73 checker = *checkerPtr; |
|
74 } |
|
75 else |
|
76 { |
|
77 // No CAppSidChecker instance loaded, try to find one |
|
78 checker = CAppSidChecker::CheckerForAppType(aAppType); |
|
79 if(checker) |
|
80 { |
|
81 CleanupStack::PushL(checker); |
|
82 InsertL(aAppType.iUid, checker); |
|
83 CleanupStack::Pop(checker); |
|
84 checker->SetRescanCallBackL(iRescanCallBack); |
|
85 } |
|
86 else |
|
87 { |
|
88 User::Leave(KErrNotFound); |
|
89 } |
|
90 } |
|
91 return *checker; |
|
92 } |
|
93 |
|
94 void RSidCheckerMap::Close() |
|
95 { |
|
96 TIter iter(*this); |
|
97 while(iter.NextValue()) |
|
98 { |
|
99 delete *(iter.CurrentValue()); |
|
100 iter.RemoveCurrent(); |
|
101 } |
|
102 RHashMap<TUint,CAppSidChecker*>::Close(); |
|
103 } |
|