1 /* |
|
2 * Copyright (c) 2002-2004 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: This module contains the implementation of CSWInstServer class |
|
15 * member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <coemain.h> |
|
22 |
|
23 #include "SWInstServer.h" |
|
24 #include "SWInstSession.h" |
|
25 #include "SWInstPrivateUid.h" |
|
26 #include "SWInstAppUi.h" |
|
27 |
|
28 using namespace SwiUI; |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CSWInstServer::CSWInstServer |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CSWInstServer::CSWInstServer() |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CSWInstServer::ConstructL |
|
44 // Symbian 2nd phase constructor can leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CSWInstServer::ConstructL() |
|
48 { |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CSWInstServer::NewL |
|
53 // Two-phased constructor. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CSWInstServer* CSWInstServer::NewL() |
|
57 { |
|
58 CSWInstServer* self = new (ELeave) CSWInstServer(); |
|
59 CleanupStack::PushL( self ); |
|
60 self->ConstructL(); |
|
61 CleanupStack::Pop(); |
|
62 return self; |
|
63 } |
|
64 |
|
65 // Destructor |
|
66 CSWInstServer::~CSWInstServer() |
|
67 { |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CSWInstServer::PrepareForExit |
|
72 // Prepare the session for exit. |
|
73 // (other items were commented in a header). |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 void CSWInstServer::PrepareForExit( MRequestCallback* aExitCallback ) |
|
77 { |
|
78 // We may assume that this server can have only one connected session |
|
79 iSessionIter.SetToFirst(); |
|
80 CSWInstSession* session = reinterpret_cast<CSWInstSession*>(iSessionIter++); |
|
81 if ( session ) |
|
82 { |
|
83 session->PrepareForExit( aExitCallback ); |
|
84 } |
|
85 else |
|
86 { |
|
87 // No connected sessions |
|
88 aExitCallback->RequestCompleted( KErrNone ); |
|
89 } |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CSWInstServer::CreateServiceL |
|
94 // Service creation function. |
|
95 // (other items were commented in a header). |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 CApaAppServiceBase* CSWInstServer::CreateServiceL( TUid aServiceType ) const |
|
99 { |
|
100 if ( aServiceType == TUid::Uid( KSWInstInstallServiceUid ) ) |
|
101 { |
|
102 return new (ELeave) CSWInstSession(); |
|
103 } |
|
104 else if ( aServiceType == TUid::Uid( KSWInstSilentInstallServiceUid ) ) |
|
105 { |
|
106 CCoeEnv* coe = CCoeEnv::Static(); |
|
107 CSWInstAppUi* appui = reinterpret_cast<CSWInstAppUi*>( coe->AppUi() ); |
|
108 appui->HideApplicationFromFSW( ETrue ); |
|
109 |
|
110 return new (ELeave) CSWInstSession(); |
|
111 } |
|
112 else |
|
113 { |
|
114 return CAknAppServer::CreateServiceL( aServiceType ); |
|
115 } |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CSWInstServer::CreateServiceL |
|
120 // Security check for services. |
|
121 // (other items were commented in a header). |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 CPolicyServer::TCustomResult CSWInstServer::CreateServiceSecurityCheckL( TUid aServiceType, |
|
125 const RMessage2& aMsg, |
|
126 TInt& aAction, |
|
127 TSecurityInfo& aMissing ) |
|
128 { |
|
129 if ( aServiceType == TUid::Uid( KSWInstInstallServiceUid ) ) |
|
130 { |
|
131 // No capabilities needed for normal installation |
|
132 return CPolicyServer::EPass; |
|
133 } |
|
134 else if ( aServiceType == TUid::Uid( KSWInstSilentInstallServiceUid ) ) |
|
135 { |
|
136 if ( aMsg.HasCapability( TCapability( ECapabilityTrustedUI ) ) ) |
|
137 { |
|
138 return CPolicyServer::EPass; |
|
139 } |
|
140 else |
|
141 { |
|
142 return CPolicyServer::EFail; |
|
143 } |
|
144 } |
|
145 else |
|
146 { |
|
147 return CAknAppServer::CreateServiceSecurityCheckL( aServiceType, aMsg, aAction, aMissing ); |
|
148 } |
|
149 } |
|
150 |
|
151 |
|
152 |
|
153 // End of File |
|