|
1 // Copyright (c) 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 "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 // This file contains the implementation of the CRegistryResolveTransaction class. |
|
15 // |
|
16 // |
|
17 |
|
18 #include "RegistryData.h" |
|
19 #include "RegistryResolveTransaction.h" |
|
20 #include "EComMessageIds.h" |
|
21 // |
|
22 // CRegistryResolveTransaction class |
|
23 /** |
|
24 Constructor for CRegistryResolveTransaction |
|
25 @param aRegistryData Registry data handle. |
|
26 @param aExtendedInterfaces The array of extended interfaces for match. |
|
27 @param aClientRequest Client's request |
|
28 @param aCapability The boolean value for checking the incoming client's capability |
|
29 */ |
|
30 CRegistryResolveTransaction::CRegistryResolveTransaction(CRegistryData &aRegistryData, |
|
31 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
32 const TClientRequest& aClientRequest,TBool aCapability): |
|
33 iRegistryData(aRegistryData), |
|
34 iExtendedInterfaces(&aExtendedInterfaces), |
|
35 iClientRequest(&aClientRequest), |
|
36 iCapability(aCapability) |
|
37 { |
|
38 // Do nothing here |
|
39 } |
|
40 |
|
41 /** |
|
42 Standardized safe construction which leaves nothing on the cleanup stack. |
|
43 @param aRegistryData Registry data handle. |
|
44 @param aExtendedInterfaces The array of extended interfaces for match. |
|
45 @param aClientRequest Client's request |
|
46 @param aCapability The boolean value for checking the incoming client's capability |
|
47 @return The newly created instance. |
|
48 */ |
|
49 CRegistryResolveTransaction* CRegistryResolveTransaction::NewL(CRegistryData &aRegistryData, |
|
50 const RExtendedInterfacesArray& aExtendedInterfaces, |
|
51 const TClientRequest& aClientRequest,TBool aCapability) |
|
52 { |
|
53 CRegistryResolveTransaction* self=new(ELeave) CRegistryResolveTransaction(aRegistryData,aExtendedInterfaces,aClientRequest,aCapability); |
|
54 return self; |
|
55 } |
|
56 |
|
57 CRegistryResolveTransaction::~CRegistryResolveTransaction() |
|
58 { |
|
59 iImplementationInfo.Close(); |
|
60 } |
|
61 |
|
62 /** |
|
63 Returns an array of implementations which satisfy the specified interface, extended interface(s) and |
|
64 pass the capability check. |
|
65 @param aInterfaceUid The Uid of the interface which the implementations should provide |
|
66 @return Array of implementations which satisfy the specified interface |
|
67 */ |
|
68 RImplInfoArray& CRegistryResolveTransaction::ListImplementationsL(TUid aInterfaceUid) const |
|
69 { |
|
70 __ASSERT_DEBUG(iExtendedInterfaces!=NULL, User::Invariant()); |
|
71 __ASSERT_DEBUG(iClientRequest!=NULL, User::Invariant()); |
|
72 iImplementationInfo.Reset(); |
|
73 |
|
74 CRegistryData::RImplDataArray implDataList; |
|
75 CleanupClosePushL(implDataList); |
|
76 iRegistryData.ListImplementationsL(aInterfaceUid,implDataList); |
|
77 |
|
78 |
|
79 // Do capability check and extended interfaces check |
|
80 for (TInt j = 0; j < implDataList.Count(); j++) |
|
81 { |
|
82 CRegistryData::CImplementationData *currentImplementation = implDataList[j]; |
|
83 CImplementationInformation* implInfo = currentImplementation->iImplInfo; |
|
84 CRegistryData::CDllData *dll = currentImplementation->iParent->iParent; |
|
85 |
|
86 if(!(iCapability)) |
|
87 { |
|
88 ListImplementationsL(implInfo,dll); |
|
89 } |
|
90 else |
|
91 { |
|
92 // Check the capability of the calling client to see |
|
93 // if it has the capabilities to view the implementation in the |
|
94 // dll in which the implementation resides. |
|
95 if(iClientRequest->CheckCapability(dll->iCapSet,*(implInfo))) |
|
96 { |
|
97 ListImplementationsL(implInfo,dll); |
|
98 } |
|
99 } |
|
100 |
|
101 |
|
102 } |
|
103 CleanupStack::PopAndDestroy(&implDataList); |
|
104 return iImplementationInfo; |
|
105 } |
|
106 |
|
107 /** |
|
108 Does the extended interface checks |
|
109 @param aImplInfo pointer to the CImplementationInformation class |
|
110 @param aDll pointer to the CDllData class |
|
111 |
|
112 */ |
|
113 void CRegistryResolveTransaction::ListImplementationsL(CImplementationInformation* aImplInfo,CRegistryData::CDllData *aDll) const |
|
114 { |
|
115 TBool passExtendedInterfaceCheck = ETrue; |
|
116 // Filter on the extended interfaces. |
|
117 RExtendedInterfacesArray* extendedInterfacesOfThisImp = aImplInfo->GetExtendedInterfaceList(); |
|
118 // For each extended interface to filter on, see if the extended |
|
119 // interface exists in this implementation. |
|
120 if (iExtendedInterfaces->Count() > 0 && extendedInterfacesOfThisImp == NULL) |
|
121 { |
|
122 passExtendedInterfaceCheck = EFalse; |
|
123 } |
|
124 else |
|
125 { |
|
126 for (TInt i=0;i<iExtendedInterfaces->Count();i++) |
|
127 { |
|
128 if (extendedInterfacesOfThisImp->Find((*iExtendedInterfaces)[i]) == KErrNotFound) |
|
129 { |
|
130 passExtendedInterfaceCheck = EFalse; |
|
131 break; |
|
132 } |
|
133 } |
|
134 } |
|
135 if (passExtendedInterfaceCheck) |
|
136 { |
|
137 aImplInfo->SetVendorId(aDll->iVid); |
|
138 // Append the capability check passed found implementation |
|
139 User::LeaveIfError(iImplementationInfo.Append(aImplInfo)); |
|
140 } |
|
141 } |
|
142 |