|
1 /* |
|
2 * Copyright (c) 2009 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 the License "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: |
|
15 * This class implements a test SIF plugin for native software |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent |
|
23 */ |
|
24 |
|
25 #ifndef REFNATIVEPLUGIN_H |
|
26 #define REFNATIVEPLUGIN_H |
|
27 |
|
28 #include <usif/sif/sifplugin.h> |
|
29 #include <usif/scr/screntries.h> |
|
30 #include <swi/msisuihandlers.h> |
|
31 #include <e32base.h> |
|
32 #include <e32std.h> |
|
33 |
|
34 namespace Swi |
|
35 { |
|
36 class CAsyncLauncher; |
|
37 class CInstallPrefs; |
|
38 } |
|
39 |
|
40 namespace Usif |
|
41 { |
|
42 |
|
43 _LIT(KDeclineOperationOptionName, "SwiDeclineOperation"); |
|
44 // ECOM objects and CActive do not interact well - especially since SIFPlugin inherits from CBase |
|
45 // and double C-inheritance is impossible. So, a separate class is used to drive the asynchronous interaction |
|
46 // to the CAsyncLauncher |
|
47 NONSHARABLE_CLASS(CRefNativePluginActiveImpl) : public CActive, public Swi::MUiHandler |
|
48 { |
|
49 public: |
|
50 static CRefNativePluginActiveImpl* NewL(); |
|
51 ~CRefNativePluginActiveImpl(); |
|
52 |
|
53 // CActive interface |
|
54 void RunL(); |
|
55 void DoCancel(); |
|
56 |
|
57 void Install(const TDesC& aFileName, const TSecurityContext& aSecurityContext, |
|
58 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
|
59 TRequestStatus& aStatus); |
|
60 |
|
61 void Install(RFile& aFileHandle, const TSecurityContext& aSecurityContext, |
|
62 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
|
63 TRequestStatus& aStatus); |
|
64 |
|
65 void GetComponentInfo(const TDesC& aFileName, CComponentInfo& aComponentInfo, TRequestStatus& aStatus); |
|
66 |
|
67 void GetComponentInfo(RFile& aFileHandle, CComponentInfo& aComponentInfo, TRequestStatus& aStatus); |
|
68 |
|
69 void Uninstall(TComponentId aComponentId, const TSecurityContext& aSecurityContext, |
|
70 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
|
71 TRequestStatus& aStatus); |
|
72 |
|
73 void Activate(TComponentId aComponentId, const TSecurityContext& aSecurityContext, |
|
74 TRequestStatus& aStatus); |
|
75 |
|
76 void Deactivate(TComponentId aComponentId, const TSecurityContext& aSecurityContext, |
|
77 TRequestStatus& aStatus); |
|
78 |
|
79 // Swi::MUiHandler interface |
|
80 TInt DisplayLanguageL(const Swi::CAppInfo& aAppInfo,const RArray<TLanguage>& aLanguages); |
|
81 TInt DisplayDriveL(const Swi::CAppInfo& aAppInfo,TInt64 aSize, const RArray<TChar>& aDriveLetters,const RArray<TInt64>& aDriveSpaces); |
|
82 TBool DisplayUninstallL(const Swi::CAppInfo& aAppInfo); |
|
83 TBool DisplayTextL(const Swi::CAppInfo& aAppInfo,Swi::TFileTextOption aOption,const TDesC& aText); |
|
84 TBool DisplayDependencyBreakL(const Swi::CAppInfo& aAppInfo, const RPointerArray<TDesC>& aComponents); |
|
85 TBool DisplayApplicationsInUseL(const Swi::CAppInfo& aAppInfo, const RPointerArray<TDesC>& aAppNames); |
|
86 TBool DisplayQuestionL(const Swi::CAppInfo& aAppInfo, Swi::TQuestionDialog aQuestion, const TDesC& aDes); |
|
87 TBool DisplayInstallL(const Swi::CAppInfo& aAppInfo,const CApaMaskedBitmap* aLogo, const RPointerArray<Swi::CCertificateInfo>& aCertificates); |
|
88 TBool DisplayGrantCapabilitiesL(const Swi::CAppInfo& aAppInfo, const TCapabilitySet& aCapabilitySet); |
|
89 TBool DisplayUpgradeL(const Swi::CAppInfo& aAppInfo, const Swi::CAppInfo& aExistingAppInfo); |
|
90 TBool DisplayOptionsL(const Swi::CAppInfo& aAppInfo, const RPointerArray<TDesC>& aOptions,RArray<TBool>& aSelections); |
|
91 TBool DisplaySecurityWarningL(const Swi::CAppInfo& aAppInfo, Swi::TSignatureValidationResult aSigValidationResult, |
|
92 RPointerArray<CPKIXValidationResultBase>& aPkixResults, RPointerArray<Swi::CCertificateInfo>& aCertificates,TBool aInstallAnyway); |
|
93 TBool DisplayOcspResultL(const Swi::CAppInfo& aAppInfo, Swi::TRevocationDialogMessage aMessage,RPointerArray<TOCSPOutcome>& aOutcomes, |
|
94 RPointerArray<Swi::CCertificateInfo>& aCertificates,TBool aWarningOnly); |
|
95 TBool DisplayMissingDependencyL(const Swi::CAppInfo& aAppInfo, const TDesC& aDependencyName,TVersion aWantedVersionFrom, |
|
96 TVersion aWantedVersionTo,TVersion aInstalledVersion); |
|
97 TBool HandleInstallEventL(const Swi::CAppInfo& aAppInfo, Swi::TInstallEvent aEvent,TInt aValue = 0,const TDesC& aDes = KNullDesC); |
|
98 void HandleCancellableInstallEventL(const Swi::CAppInfo& aAppInfo, Swi::TInstallCancellableEvent aEvent,Swi::MCancelHandler& aCancelHandler, |
|
99 TInt aValue = 0,const TDesC& aDes=KNullDesC); |
|
100 void DisplayCannotOverwriteFileL(const Swi::CAppInfo& aAppInfo, const Swi::CAppInfo& aInstalledAppInfo,const TDesC& aFileName); |
|
101 void DisplayErrorL(const Swi::CAppInfo& aAppInfo,Swi::TErrorDialog aType,const TDesC& aParam); |
|
102 private: |
|
103 CRefNativePluginActiveImpl() : CActive(EPriorityStandard) {} |
|
104 CRefNativePluginActiveImpl(const CRefNativePluginActiveImpl &); |
|
105 CRefNativePluginActiveImpl & operator =(const CRefNativePluginActiveImpl &); |
|
106 void ConstructL(); |
|
107 void CommonRequestPreamble(const TSecurityContext& aSecurityContext, const COpaqueNamedParams& aInputParams, |
|
108 COpaqueNamedParams& aOutputParams, TRequestStatus& aStatus); |
|
109 void UninstallL(TComponentId aComponentId, const TSecurityContext& aSecurityContext, |
|
110 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
|
111 TRequestStatus& aStatus); |
|
112 |
|
113 TComponentId GetLastInstalledComponentIdL(); |
|
114 TBool NeedUserCapabilityL(); |
|
115 void ProcessSilentInstallL(); |
|
116 private: |
|
117 Swi::CAsyncLauncher* iAsyncLauncher; |
|
118 Swi::CInstallPrefs* iInstallPrefs; |
|
119 TRequestStatus* iClientStatus; |
|
120 const COpaqueNamedParams* iInputParams; |
|
121 COpaqueNamedParams* iOutputParams; |
|
122 CComponentInfo* iComponentInfo; |
|
123 TFileName iFileName; |
|
124 RFile* iFileHandle; // FileHandle is not owned by the plug-in |
|
125 TBool iDeclineOperation; // Used for plugin options - optionally specifies that the operation will not be confirmed at the first callback |
|
126 TBool iInstallRequest; // Used to identify the type of the current requst in RunL() so we know if the id of an installed component should be sent |
|
127 TBool iSilentInstall; // Used to identify a silent install |
|
128 }; |
|
129 |
|
130 |
|
131 NONSHARABLE_CLASS(CRefNativePlugin) : public CSifPlugin |
|
132 { |
|
133 public: |
|
134 static CRefNativePlugin* NewL(); |
|
135 ~CRefNativePlugin(); |
|
136 |
|
137 // MSIFPlugin interface |
|
138 void GetComponentInfo(const TDesC& aFileName, const TSecurityContext& aSecurityContext, |
|
139 CComponentInfo& aComponentInfo, TRequestStatus& aStatus); |
|
140 |
|
141 void GetComponentInfo(RFile& aFileHandle, const TSecurityContext& aSecurityContext, |
|
142 CComponentInfo& aComponentInfo, TRequestStatus& aStatus); |
|
143 |
|
144 void Install(const TDesC& aFileName, const TSecurityContext& aSecurityContext, |
|
145 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
|
146 TRequestStatus& aStatus); |
|
147 |
|
148 void Install(RFile& aFileHandle, const TSecurityContext& aSecurityContext, |
|
149 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
|
150 TRequestStatus& aStatus); |
|
151 |
|
152 virtual void Uninstall(TComponentId aComponentId, const TSecurityContext& aSecurityContext, |
|
153 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
|
154 TRequestStatus& aStatus); |
|
155 |
|
156 virtual void Activate(TComponentId aComponentId, const TSecurityContext& aSecurityContext, |
|
157 TRequestStatus& aStatus); |
|
158 |
|
159 virtual void Deactivate(TComponentId aComponentId, const TSecurityContext& aSecurityContext, |
|
160 TRequestStatus& aStatus); |
|
161 |
|
162 void CancelOperation(); |
|
163 private: |
|
164 CRefNativePlugin() {} |
|
165 void ConstructL(); |
|
166 CRefNativePlugin(const CRefNativePlugin &); |
|
167 CRefNativePlugin & operator =(const CRefNativePlugin &); |
|
168 private: |
|
169 CRefNativePluginActiveImpl *iImpl; |
|
170 }; |
|
171 } // end namespace Usif |
|
172 |
|
173 #endif // REFNATIVEPLUGIN_H |