|
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: Implementation of applicationmanagement components |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CAMDOWNLOAD_H__ |
|
19 #define __CAMDOWNLOAD_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <downloadmgrclient.h> |
|
23 |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class RHttpDownload; |
|
27 |
|
28 namespace NApplicationManagement |
|
29 { |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CDeploymentComponent; |
|
33 class CAMDownloader; |
|
34 |
|
35 /** |
|
36 * Mix in interface that will receive status updates |
|
37 * as the download progresses. |
|
38 */ |
|
39 class MAMDownloadStateObserver |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * StatusUpdateL Sets the current download status. This is |
|
44 * currently HTTP status code |
|
45 * (200 is success, 400+ failure, 100-199 in progress) |
|
46 * @param aNewStatus The new download status |
|
47 */ |
|
48 virtual void StatusUpdateL(TInt aNewStatus) = 0; |
|
49 virtual void SuccessStatusUpdateL(const TDesC &aDlFileName, |
|
50 const TDesC8& aDlMimeType) = 0; |
|
51 }; |
|
52 |
|
53 class MAMDownloaderObserver |
|
54 { |
|
55 public: |
|
56 /* Whenever User cancels the download AM Download observes the event. If User cancels |
|
57 * then calls download complete of AM Server*/ |
|
58 virtual void SetStatus(TInt aStatus) = 0; |
|
59 }; |
|
60 |
|
61 /** |
|
62 * CAMDownload contains context info about specific download. |
|
63 * |
|
64 * @since Series |
|
65 */ |
|
66 class CAMDownload : public CBase, public MAMDownloaderObserver |
|
67 { |
|
68 private: |
|
69 /** |
|
70 * C++ default constructor. |
|
71 */ |
|
72 CAMDownload(CDeploymentComponent *aComponent); |
|
73 |
|
74 /** |
|
75 * By default Symbian 2nd phase constructor is private. |
|
76 */ |
|
77 void ConstructL(RHttpDownload& aDownload); |
|
78 |
|
79 public: |
|
80 // Constructors and destructor |
|
81 |
|
82 /** |
|
83 * Two-phased constructor. |
|
84 */ |
|
85 static CAMDownload* NewL(RHttpDownload& aDownload, |
|
86 CDeploymentComponent *aComponent); |
|
87 |
|
88 /** |
|
89 * Destructor. |
|
90 */ |
|
91 virtual ~CAMDownload(); |
|
92 |
|
93 public: |
|
94 |
|
95 TBool DownloadURIMatch(const TDesC8& aURI); |
|
96 |
|
97 const TDesC8& DownloadURI(); |
|
98 const TDesC8& ContentMimeType(); |
|
99 |
|
100 TInt StartDownload(); |
|
101 TInt StopDownload(); |
|
102 TInt ContinueDownload(); |
|
103 void DownloadCompleted(); |
|
104 void DownloadFailedL(THttpDownloadState aDownloadState); |
|
105 TInt32 DownloadErrorCodeL(); |
|
106 void ProgressDialogL(TInt32 aDownloadedSize, TInt32 aContentSize, THttpProgressState aState); |
|
107 void SetStatus(TInt aStatus); |
|
108 |
|
109 private: |
|
110 CAMDownloader* iDownloader; // owned |
|
111 CDeploymentComponent* iComponent; // NOT owned |
|
112 }; |
|
113 |
|
114 } //namespace NApplicationManagement |
|
115 |
|
116 #endif // __CAMDOWNLOAD_H__ |
|
117 // End of File |