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: Methods for Location notifier Ecom Plugins entry point |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ecom/implementationproxy.h> |
|
20 #include <AknNotifierWrapper.h> // link against aknnotifierwrapper.lib |
|
21 #include <lbs/epos_privacynotifier.hrh> |
|
22 |
|
23 #include "locnotifierwrapper.h" |
|
24 |
|
25 |
|
26 const MEikSrvNotifierBase2::TNotifierPriority KNotifierPriority = |
|
27 MEikSrvNotifierBase2::ENotifierPriorityHigh; |
|
28 const TUid KNotifierChannel = { 0x100065ac }; |
|
29 const TInt KMaxSynchReplyBufLength = 256; |
|
30 const TInt KPrivSrvSecureId = 0x10281D45; |
|
31 |
|
32 |
|
33 // ======== MEMBER FUNCTIONS ======== |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CLocNotifierSecurityCheck::Release |
|
37 // This method will release all resources that have been allocated for |
|
38 // performing the custom security check. |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 void CLocNotifierSecurityCheck::Release() |
|
42 { |
|
43 delete this; |
|
44 } |
|
45 |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CLocNotifierSecurityCheck::CustomSecurityCheckL |
|
49 // This method performs the security check |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void CLocNotifierSecurityCheck::CustomSecurityCheckL(const RMessagePtr2& aMessage) |
|
53 { |
|
54 if (!aMessage.IsNull()) |
|
55 { |
|
56 static _LIT_SECURITY_POLICY_S0(SidPolicy, KPrivSrvSecureId); |
|
57 if (!SidPolicy().CheckPolicy(aMessage)) |
|
58 { |
|
59 User::Leave(KErrPermissionDenied); |
|
60 } |
|
61 } |
|
62 } |
|
63 |
|
64 |
|
65 // ======== LOCAL FUNCTIONS ======== |
|
66 |
|
67 // ECom registration related methods |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // Helper method to perform cleanup of the CArrayPtrFlat array object. |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CleanupArray(TAny* aArray) |
|
74 { |
|
75 CArrayPtrFlat<MEikSrvNotifierBase2>* |
|
76 subjects=static_cast<CArrayPtrFlat<MEikSrvNotifierBase2>*>(aArray); |
|
77 TInt lastInd = subjects->Count()-1; |
|
78 for (TInt i=lastInd; i >= 0; i--) |
|
79 subjects->At(i)->Release(); |
|
80 delete subjects; |
|
81 } |
|
82 |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // Creates an array of CAknCommonNotifierWrapper objects |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CArrayPtr<MEikSrvNotifierBase2>* DoCreateNotifierArrayL() |
|
89 { |
|
90 CArrayPtrFlat<MEikSrvNotifierBase2>* subjects= |
|
91 new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>(1); |
|
92 |
|
93 CleanupStack::PushL(TCleanupItem(CleanupArray, subjects)); |
|
94 |
|
95 CLocNotifierSecurityCheck* customSecurityImpl = |
|
96 new(ELeave) CLocNotifierSecurityCheck; |
|
97 CleanupStack::PushL(customSecurityImpl); |
|
98 |
|
99 // Session owning notifier(if default implementation is enough) |
|
100 CAknCommonNotifierWrapper* master = |
|
101 CAknCommonNotifierWrapper::NewL( TUid::Uid(KPosPrivacyNotifierImplUid), |
|
102 KNotifierChannel, |
|
103 KNotifierPriority, |
|
104 _L("LocVerifierDlg.dll"), |
|
105 KMaxSynchReplyBufLength); |
|
106 // set the custom security handler. |
|
107 |
|
108 CleanupStack::Pop(customSecurityImpl); |
|
109 // Control of customSecurityImpl transferred to CAknCommonNotifierWrapper |
|
110 // object |
|
111 master->SetCustomSecurityHandler(customSecurityImpl); |
|
112 subjects->AppendL( master ); |
|
113 CleanupStack::Pop(subjects); |
|
114 return(subjects); |
|
115 } |
|
116 |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // Called to instantiate this ECOM Plugin implementation. |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 CArrayPtr<MEikSrvNotifierBase2>* NotifierArray() |
|
123 // old Lib main entry point |
|
124 { |
|
125 CArrayPtr<MEikSrvNotifierBase2>* array = NULL; |
|
126 TRAPD(error, array = DoCreateNotifierArrayL()); |
|
127 if (error == KErrNone) |
|
128 { |
|
129 return array; |
|
130 } |
|
131 else |
|
132 { |
|
133 return NULL; |
|
134 } |
|
135 } |
|
136 |
|
137 const TImplementationProxy ImplementationTable[] = |
|
138 { |
|
139 #ifdef __EABI__ |
|
140 {{0x10207243},(TFuncPtr)NotifierArray} |
|
141 #else |
|
142 {{0x10207243},NotifierArray} |
|
143 #endif |
|
144 }; |
|
145 |
|
146 // ======== GLOBAL FUNCTIONS ======== |
|
147 |
|
148 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
149 { |
|
150 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ; |
|
151 return ImplementationTable; |
|
152 } |
|
153 |
|