|
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 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: Handle a download related util functions, such as isDrm |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CDOWNLOADUTILS_H |
|
21 #define CDOWNLOADUTILS_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <HttpDownloadMgrCommon.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class RHttpDownload; |
|
29 |
|
30 // CONSTANTS |
|
31 _LIT8( KSisFileMimeType, "application/vnd.symbian.install" ); |
|
32 _LIT8( KOctetStreamMimeType, "application/octet-stream" ); |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Supports user interaction dialogs for downloads, etc. |
|
38 */ |
|
39 NONSHARABLE_CLASS( CDownloadUtils ) : public CBase |
|
40 { |
|
41 public: // Constructors and destructor |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 * ¶m aDMgrUiBase Reference to UI base functionality. |
|
46 */ |
|
47 static CDownloadUtils* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CDownloadUtils(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Check if the download is DRM. |
|
58 * @param aDownload The actual download |
|
59 * @return ETrue/EFalse |
|
60 */ |
|
61 TBool DrmDownloadL( RHttpDownload& aDownload ); |
|
62 |
|
63 /** |
|
64 * Check if the DRM download has rights on the phone. |
|
65 * @param aDownload The actual download |
|
66 * @param aPreviewRights Output. ETrue, if the right is preview. |
|
67 * @return ETrue/EFalse |
|
68 */ |
|
69 TBool DrmRightsOnThePhoneL( RHttpDownload& aDownload, TBool& aPreviewRights ) const; |
|
70 |
|
71 /** |
|
72 * Is the content type supported. |
|
73 * @param aDownload The actual download |
|
74 * @return True/False. |
|
75 */ |
|
76 TBool IsContentTypeSupportedL( RHttpDownload& aDownload ); |
|
77 |
|
78 /** |
|
79 * Is the content type supported. |
|
80 * @param aContentType The mime type |
|
81 * @return True/False. |
|
82 */ |
|
83 TBool IsContentTypeSupportedL( const TDesC8& aContentType ); |
|
84 |
|
85 /** |
|
86 * Is the content type supported. |
|
87 * @param aDownload The actual download. |
|
88 * @param aContentType The mime type |
|
89 * @return True/False. |
|
90 */ |
|
91 TBool IsContentTypeSupportedL( RHttpDownload& aDownload, const TDesC8& aContentType ); |
|
92 |
|
93 /** |
|
94 * Get the MIME type of the download.. |
|
95 * @param aDownload The actual download. |
|
96 * @param aDrmResolve If it's ETrue, the inner DRM content type is got. |
|
97 * @return The allocated buffer containing the mime type. |
|
98 */ |
|
99 HBufC8* ContentTypeL( RHttpDownload& aDownload, TBool aDrmResolve, TInt mediaObjectIndex = 0 ); |
|
100 |
|
101 /** |
|
102 * Is the content type supported by gallery. |
|
103 * @param aContentType The mime type |
|
104 * @return True/False. |
|
105 */ |
|
106 static TBool IsGallerySupported(const TDesC8& aContentType); |
|
107 |
|
108 protected: // Constructors |
|
109 |
|
110 /** |
|
111 * C++ default constructor. |
|
112 */ |
|
113 CDownloadUtils(); |
|
114 |
|
115 /** |
|
116 * By default Symbian 2nd phase constructor is private. |
|
117 */ |
|
118 void ConstructL(); |
|
119 |
|
120 private: // file operations |
|
121 |
|
122 /** |
|
123 * Find the content type from file using content recognizer |
|
124 * @param aDownload The actual download. |
|
125 * @param aContentType The mime type |
|
126 */ |
|
127 void FindContentTypeFromFileL( RHttpDownload& aDownload, TUint8*& aContentTypeString ); |
|
128 |
|
129 private: // Data |
|
130 HBufC8* iMimeType; ///< Temp storage. Owned. |
|
131 HBufC8* iContentURI; ///< Temp storage. Owned. |
|
132 |
|
133 }; |
|
134 |
|
135 #endif /* CDOWNLOADUTILS_H */ |