23 #include "DRMHelperInfoNoteWrapper.h" |
23 #include "DRMHelperInfoNoteWrapper.h" |
24 #include "DRMRightsClient.h" |
24 #include "DRMRightsClient.h" |
25 #include "DcfCommon.h" |
25 #include "DcfCommon.h" |
26 #include "DRMHelperDownloadManager.h" |
26 #include "DRMHelperDownloadManager.h" |
27 |
27 |
|
28 #include <sacls.h> |
28 #include <Drmhelper.rsg> |
29 #include <Drmhelper.rsg> |
29 #include <AknQueryDialog.h> |
30 #include <AknQueryDialog.h> |
30 #include <DRMCommon.h> |
31 #include <DRMCommon.h> |
31 |
32 |
32 #include <starterclient.h> |
33 #include <starterclient.h> |
57 |
58 |
58 #include <AknLaunchAppService.h> // for launching RMUI embedded |
59 #include <AknLaunchAppService.h> // for launching RMUI embedded |
59 |
60 |
60 #include <utf.h> |
61 #include <utf.h> |
61 |
62 |
|
63 #include <schemehandler.h> // for handling URLs |
62 #include "DRMHelperServer.h" |
64 #include "DRMHelperServer.h" |
63 #include "ConsumeData.h" |
65 #include "ConsumeData.h" |
64 #include "DRMTypes.h" |
66 #include "DRMTypes.h" |
65 #include "DRMClockClient.h" |
67 #include "DRMClockClient.h" |
66 #include "DRMPointerArray.h" |
68 #include "DRMPointerArray.h" |
67 #include <drmbrowserlauncher.h> |
|
68 |
69 |
69 #include <SecondaryDisplay/DRMHelperSecondaryDisplay.h> // for secondary display support |
70 #include <SecondaryDisplay/DRMHelperSecondaryDisplay.h> // for secondary display support |
70 #include <AknMediatorFacade.h> |
71 #include <AknMediatorFacade.h> |
71 #include <MediatorEventProvider.h> |
72 #include <MediatorEventProvider.h> |
72 #include <MediatorDomainUIDs.h> |
73 #include <MediatorDomainUIDs.h> |
80 #include "drmsettingsplugininternalcrkeys.h" |
81 #include "drmsettingsplugininternalcrkeys.h" |
81 #endif |
82 #endif |
82 #include "DRMRIContext.h" |
83 #include "DRMRIContext.h" |
83 #include "DRMDomainContext.h" |
84 #include "DRMDomainContext.h" |
84 |
85 |
|
86 #include <cmconnectionmethod.h> |
|
87 #include <cmdestination.h> |
|
88 #include <cmconnectionmethoddef.h> |
|
89 #include <cmmanager.h> |
|
90 |
85 // publish & subrscibe |
91 // publish & subrscibe |
86 #include <e32property.h> |
92 #include <e32property.h> |
87 #include <PSVariables.h> |
93 #include <PSVariables.h> |
88 |
94 |
89 |
95 #ifdef __SERIES60_NATIVE_BROWSER |
90 //connectivity logic |
96 #include <browseruisdkcrkeys.h> |
91 #include <cmconnectionmethod.h> // RCmConnectionMethod |
97 #endif |
92 #include <cmdestination.h> // RCmDestination |
98 |
93 #include <cmmanager.h> // RCmManager |
99 #ifndef __SERIES60_NATIVE_BROWSER |
|
100 const TUid KCRUidBrowser = {0x10008D39}; |
|
101 const TUint32 KBrowserDefaultAccessPoint = 0x0000000E; |
|
102 const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E; |
|
103 #endif |
|
104 |
94 |
105 |
95 // EXTERNAL DATA STRUCTURES |
106 // EXTERNAL DATA STRUCTURES |
96 |
107 |
97 // EXTERNAL FUNCTION PROTOTYPES |
108 // EXTERNAL FUNCTION PROTOTYPES |
98 |
109 |
156 private: |
167 private: |
157 T iHandle; |
168 T iHandle; |
158 }; |
169 }; |
159 |
170 |
160 // ============================= LOCAL FUNCTIONS =============================== |
171 // ============================= LOCAL FUNCTIONS =============================== |
161 // ----------------------------------------------------------------------------- |
172 |
162 // HasDefaultConnectionL |
173 // ----------------------------------------------------------------------------- |
163 // Finds default IAP id |
174 // IapIdOfDefaultSnapL |
164 // @return Etrue: valid AP found |
175 // for trapping purposes only |
165 // EFalse: valid AP not found |
176 // ----------------------------------------------------------------------------- |
166 // @leave system wide error codes |
177 // |
167 // ----------------------------------------------------------------------------- |
178 LOCAL_C TUint32 IapIdOfDefaultSnapL( |
168 // |
179 RCmManager& aCmManager, |
169 LOCAL_C TBool HasDefaultConnectionL() |
180 const TUint32 aDefaultSnap ) |
170 { |
181 { |
171 TBool hasDefault(EFalse); |
182 RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) ); |
172 TCmDefConnValue defConn; |
183 CleanupClosePushL( dest ); |
173 RCmManager cmManager; |
184 TUint32 iapIdOfDest( 0 ); |
174 cmManager.OpenLC(); |
185 |
175 cmManager.ReadDefConnL(defConn); |
186 if ( dest.ConnectionMethodCount() <= 0 ) |
176 if (defConn.iType == ECmDefConnConnectionMethod) |
187 { |
177 { |
188 User::Leave( KErrNotFound ); |
178 cmManager.GetConnectionMethodInfoIntL(defConn.iId, |
189 } |
179 CMManager::ECmIapId); |
190 |
180 hasDefault = ETrue; |
191 RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) ); |
181 } |
192 CleanupClosePushL( cMeth ); |
182 else if (defConn.iType == ECmDefConnDestination) |
193 |
183 { |
194 iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId ); |
184 RCmDestination dest(cmManager.DestinationL(defConn.iId)); |
195 CleanupStack::PopAndDestroy( &cMeth ); |
185 CleanupClosePushL(dest); |
196 CleanupStack::PopAndDestroy( &dest ); |
186 |
197 return iapIdOfDest; |
187 if (dest.ConnectionMethodCount() <= 0) |
|
188 { |
|
189 User::Leave(KErrNotFound); |
|
190 } |
|
191 |
|
192 RCmConnectionMethod cMeth(dest.ConnectionMethodL(0)); |
|
193 CleanupClosePushL(cMeth); |
|
194 |
|
195 cMeth.GetIntAttributeL(CMManager::ECmIapId); |
|
196 CleanupStack::PopAndDestroy(&cMeth); |
|
197 CleanupStack::PopAndDestroy(&dest); |
|
198 hasDefault = ETrue; |
|
199 } |
|
200 CleanupStack::PopAndDestroy(&cmManager); |
|
201 return hasDefault; |
|
202 } |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // HasAccessPointsL |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 LOCAL_C TBool HasAccessPointsL() |
|
209 { |
|
210 TInt apCount(0); |
|
211 RCmManager cmManager; |
|
212 CleanupClosePushL(cmManager); |
|
213 cmManager.OpenL(); |
|
214 RArray<TUint32> aps; |
|
215 CleanupClosePushL(aps); |
|
216 cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue); |
|
217 apCount = aps.Count(); |
|
218 CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager |
|
219 return apCount > 0; |
|
220 } |
198 } |
221 |
199 |
222 // ----------------------------------------------------------------------------- |
200 // ----------------------------------------------------------------------------- |
223 // Creates note for resource text to be viewed, |
201 // Creates note for resource text to be viewed, |
224 // Defaults to information note. |
202 // Defaults to information note. |
2358 } |
2337 } |
2359 |
2338 |
2360 if ( buttonCode == EAknSoftkeyYes ) |
2339 if ( buttonCode == EAknSoftkeyYes ) |
2361 { |
2340 { |
2362 // check if there are any APs defined |
2341 // check if there are any APs defined |
2363 TBool APs( HasAccessPointsL() ); |
2342 RCmManager cmManager; |
|
2343 cmManager.OpenLC(); |
|
2344 RArray<TUint32> aps; |
|
2345 CleanupClosePushL( aps ); |
|
2346 cmManager.ConnectionMethodL( aps, EFalse, EFalse, ETrue ); |
|
2347 TUint32 APs( aps.Count() ); |
|
2348 CleanupStack::PopAndDestroy( 2, &cmManager ); //aps, cmManager |
2364 if ( !APs ) |
2349 if ( !APs ) |
2365 { |
2350 { |
2366 // No AP defined |
2351 // No AP defined |
2367 DisplayInfoNoteL( R_DRM_WARN_NO_CONN_DEFINED ); |
2352 DisplayInfoNoteL( R_DRM_WARN_NO_CONN_DEFINED ); |
2368 r = KErrCANoRights; |
2353 r = KErrCANoRights; |
2443 return EFalse; |
2428 return EFalse; |
2444 #endif |
2429 #endif |
2445 } |
2430 } |
2446 |
2431 |
2447 |
2432 |
2448 // ----------------------------------------------------------------------------- |
|
2449 // CDRMHelper::CheckRightsPercentL |
|
2450 // Note: obsolete function name kept only |
|
2451 // to avoid SC break on Helper selection logic |
|
2452 // ----------------------------------------------------------------------------- |
|
2453 // |
|
2454 TBool CDRMHelper::BrowserAPDefinedL() |
2433 TBool CDRMHelper::BrowserAPDefinedL() |
2455 { |
2434 { |
2456 TBool apFound( EFalse ); |
2435 const TInt KDestinationSelectionMode( 2 ); |
2457 TRAP_IGNORE( apFound = HasDefaultConnectionL() ); |
2436 TInt err( KErrNone ); |
2458 return apFound; |
2437 TInt ap( 0 ); |
|
2438 TInt alwaysAsk( 0 ); |
|
2439 TInt defaultSnap( 0 ); |
|
2440 |
|
2441 CRepository* repository( CRepository::NewL( KCRUidBrowser ) ); |
|
2442 repository->Get( KBrowserDefaultAccessPoint, ap ); |
|
2443 repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk ); |
|
2444 repository->Get( KBrowserNGDefaultSnapId, defaultSnap ); |
|
2445 delete repository; |
|
2446 if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound ) |
|
2447 { |
|
2448 alwaysAsk = ETrue; |
|
2449 } |
|
2450 else |
|
2451 { |
|
2452 RCmManager cmManager; |
|
2453 cmManager.OpenLC(); |
|
2454 if ( !alwaysAsk ) |
|
2455 { |
|
2456 TRAP( err, cmManager.GetConnectionMethodInfoIntL( |
|
2457 ap, CMManager::ECmIapId ) ); |
|
2458 } |
|
2459 else if ( alwaysAsk == KDestinationSelectionMode ) |
|
2460 { |
|
2461 TRAP( err, IapIdOfDefaultSnapL( cmManager, defaultSnap ) ); |
|
2462 } |
|
2463 CleanupStack::PopAndDestroy( &cmManager ); |
|
2464 if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) ) |
|
2465 { |
|
2466 return ETrue; |
|
2467 } |
|
2468 } |
|
2469 return EFalse; |
2459 } |
2470 } |
2460 |
2471 |
2461 |
2472 |
2462 #pragma mark - |
2473 #pragma mark - |
2463 |
2474 |
5546 newUrl->Des().Append( ptr.Mid( i ) ); |
5557 newUrl->Des().Append( ptr.Mid( i ) ); |
5547 ptr.Set( *newUrl ); |
5558 ptr.Set( *newUrl ); |
5548 i = 0; |
5559 i = 0; |
5549 } |
5560 } |
5550 |
5561 |
5551 // convert given URL to QUrl format |
5562 CSchemeHandler* schemeHandler( CSchemeHandler::NewL( ptr.Mid( i ) ) ); |
5552 DRM::CDrmBrowserLauncher* browserLauncher = DRM::CDrmBrowserLauncher::NewLC(); |
5563 CleanupStack::PushL( schemeHandler ); |
5553 |
5564 if ( iUseCoeEnv ) |
5554 browserLauncher->LaunchUrlL(ptr); |
5565 { |
5555 |
5566 // launch embedded |
5556 CleanupStack::PopAndDestroy(); // browserLauncher |
5567 schemeHandler->Observer( this ); |
5557 |
5568 schemeHandler->HandleUrlEmbeddedL(); |
5558 |
5569 CleanupStack::Pop( schemeHandler ); |
|
5570 iSchemeHandler = schemeHandler; |
|
5571 iWait.Start(); |
|
5572 } |
|
5573 else |
|
5574 { |
|
5575 // no CoeEnv, launch standalone with scheme app |
|
5576 schemeHandler->HandleUrlStandaloneL(); |
|
5577 CleanupStack::PopAndDestroy( schemeHandler ); |
|
5578 } |
|
5579 schemeHandler = NULL; |
|
5580 |
5559 // delete newUrl if needed |
5581 // delete newUrl if needed |
5560 if ( newUrl ) |
5582 if ( newUrl ) |
5561 { |
5583 { |
5562 CleanupStack::PopAndDestroy( newUrl ); |
5584 CleanupStack::PopAndDestroy( newUrl ); |
5563 } |
5585 } |
5583 TAiwGenericParam param( EGenericParamFile, variantObject ); |
5605 TAiwGenericParam param( EGenericParamFile, variantObject ); |
5584 paramList->AppendL( param ); |
5606 paramList->AppendL( param ); |
5585 |
5607 |
5586 CAknLaunchAppService* launchAppService = |
5608 CAknLaunchAppService* launchAppService = |
5587 CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ); |
5609 CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ); |
5588 |
5610 |
5589 CleanupStack::PushL( launchAppService ); |
5611 CleanupStack::PushL( launchAppService ); |
5590 iWait.Start(); |
5612 iWait.Start(); |
5591 |
5613 |
5592 CleanupStack::PopAndDestroy( 2, paramList ); // paramList, launchAppService |
5614 CleanupStack::PopAndDestroy( 2, paramList ); // paramList, launchAppService |
5593 } |
5615 } |
7009 } |
7031 } |
7010 |
7032 |
7011 EXPORT_C TInt CDRMHelper::SupportedDRMMethods2( |
7033 EXPORT_C TInt CDRMHelper::SupportedDRMMethods2( |
7012 TInt& aDRMMethod, TDRMHelperOMALevel& aOMALevel) |
7034 TInt& aDRMMethod, TDRMHelperOMALevel& aOMALevel) |
7013 { |
7035 { |
7014 #ifndef __DRM_FULL |
7036 if ( !( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm1FullSupport ) ) ) |
7015 aDRMMethod = CDRMHelper::EForwardLock; |
7037 { |
7016 #else |
7038 aDRMMethod = CDRMHelper::EForwardLock; |
7017 aDRMMethod = |
7039 } |
7018 CDRMHelper::EForwardLock | |
7040 else |
7019 CDRMHelper::ECombinedDelivery | |
7041 { |
7020 CDRMHelper::ESeparateDelivery | |
7042 aDRMMethod = |
7021 CDRMHelper::ESuperDistribution; |
7043 CDRMHelper::EForwardLock | |
|
7044 CDRMHelper::ECombinedDelivery | |
|
7045 CDRMHelper::ESeparateDelivery | |
|
7046 CDRMHelper::ESuperDistribution; |
|
7047 aOMALevel = EOMA_1_0; |
|
7048 } |
|
7049 |
7022 #ifdef __DRM_OMA2 |
7050 #ifdef __DRM_OMA2 |
7023 aOMALevel = EOMA_2_0; |
7051 if ( FeatureManager::FeatureSupported( KFeatureIdFfOmadrm2Support ) ) |
7024 #else |
7052 { |
7025 aOmaLevel = EOMA_1_0; |
7053 aOMALevel = EOMA_2_0; |
|
7054 } |
7026 #endif // __DRM_OMA2 |
7055 #endif // __DRM_OMA2 |
7027 |
7056 |
7028 #endif // __DRM_FULL |
|
7029 return KErrNone; |
7057 return KErrNone; |
7030 } |
7058 } |
7031 |
7059 |
7032 |
7060 |
7033 // ----------------------------------------------------------------------------- |
7061 // ----------------------------------------------------------------------------- |
7034 // CDRMHelper::HandleServerAppExit |
7062 // CDRMHelper::HandleServerAppExit |
7035 // ----------------------------------------------------------------------------- |
7063 // ----------------------------------------------------------------------------- |
7036 // |
7064 // |
7037 void CDRMHelper::HandleServerAppExit( TInt aReason ) |
7065 void CDRMHelper::HandleServerAppExit( TInt aReason ) |
7038 { |
7066 { |
7039 if ( aReason == EAknCmdExit ) |
7067 if ( aReason == EAknCmdExit && !iSchemeHandler ) |
7040 { |
7068 { |
7041 CAknEnv::RunAppShutter(); |
7069 CAknEnv::RunAppShutter(); |
|
7070 } |
|
7071 |
|
7072 if ( iSchemeHandler ) |
|
7073 { |
|
7074 delete iSchemeHandler; |
|
7075 iSchemeHandler = NULL; |
7042 } |
7076 } |
7043 |
7077 |
7044 if ( iWait.IsStarted() ) |
7078 if ( iWait.IsStarted() ) |
7045 { |
7079 { |
7046 iWait.AsyncStop(); |
7080 iWait.AsyncStop(); |