1 brctldownloadobserver.h |
1 /* |
|
2 * Copyright (c) 2006 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 download events |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef BRCTLDOWNLOADOBSERVER_H |
|
20 #define BRCTLDOWNLOADOBSERVER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <BrCtlDefs.h> |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // MACROS |
|
30 |
|
31 /** |
|
32 * Defines the download events sent to the host application by the Download Manager. |
|
33 * @attention For more information on aValue, see the HandleDownloadEventL function. |
|
34 */ |
|
35 enum TBrCtlDownloadEvent |
|
36 { |
|
37 /** |
|
38 * A download has started. The aValue associated with this |
|
39 * event is the total size of the file to be downloaded. |
|
40 * @see For more information on aValue, see HandleDownloadEventL. |
|
41 */ |
|
42 EDownloadEventStarted, |
|
43 /** |
|
44 * A download has completed. The aValue associated with this event |
|
45 * is the total size of the file that was downloaded. |
|
46 */ |
|
47 EDownloadEventCompleted, |
|
48 /** |
|
49 * A download is in progress. The aValue associated with this event |
|
50 * is the size of the file that was downloaded so far. |
|
51 */ |
|
52 EDownloadEventProgress, |
|
53 /** |
|
54 * A download was canceled by the HandleDownloadCommandL function. |
|
55 */ |
|
56 EDownloadEventCanceled, |
|
57 /** |
|
58 * An error occurred in the Download Manager during a download operation. |
|
59 */ |
|
60 EDownloadEventError, |
|
61 /** |
|
62 * A download was paused. The aValue associated with this event |
|
63 * is the size of the file that was downloaded before the pause occurred. |
|
64 */ |
|
65 EDownloadEventPaused, |
|
66 /** |
|
67 * A paused download was resumed. The aValue associated with this event |
|
68 * is the size of the file that was downloaded so far. |
|
69 */ |
|
70 EDownloadEventResumed, |
|
71 /** |
|
72 * Notifies the host application as to whether or not a particular |
|
73 * download can be paused. The aValue associated with this event is one of the following: |
|
74 * ETrue if the download can be paused |
|
75 * EFalse if the download cannot be paused |
|
76 */ |
|
77 EDownloadEventPausable |
|
78 }; |
|
79 |
|
80 // FORWARD DECLARATIONS |
|
81 class CBrCtlInterface; |
|
82 |
|
83 /** |
|
84 * The MBrCtlDownloadObserver class handles download events. |
|
85 * |
|
86 * Usage: |
|
87 * |
|
88 * @code |
|
89 * #include <BrCtlDownloadObserver.h> |
|
90 * |
|
91 * |
|
92 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0 |
|
93 * @lib BrowserEngine.lib |
|
94 * @file BrCtlDownloadObserver.h |
|
95 * @endcode * |
|
96 */ |
|
97 class MBrCtlDownloadObserver |
|
98 { |
|
99 public: // New functions |
|
100 /** |
|
101 * Inform the host application that a new download has started using the Download Manager |
|
102 * @since 3.0 |
|
103 * @param aTransactionID The ID of the transaction, it is unique as long as the transaction is on-going |
|
104 * @param aFileName Name of the file in which the downloaded content is stored |
|
105 * @param aContentType Type of content to be downloaded. For example: |
|
106 * Markup, Image, Cascading Style Sheet (CSS), Javascript, Netscape plug-in, Sound |
|
107 * @param aUrl The Url of the request to be done in the new window |
|
108 * @return ETrue if the file can be displayed or played while it is |
|
109 * downloading (progressive download) |
|
110 * EFalse if the file cannot be displayed or played while it is downloading |
|
111 */ |
|
112 virtual TBool NewDownloadL(TUint aTransactionID, |
|
113 const TDesC& aFileName, |
|
114 const TDesC& aContentType, |
|
115 const TDesC& aUrl) = 0; |
|
116 |
|
117 /** |
|
118 * Tells the host application to resume an incomplete download. |
|
119 * After the host application restarts, this method is called |
|
120 * for each file whose download was interrupted when the host application closed. |
|
121 * @since 3.0 |
|
122 * @param aTransactionID ID of the transaction |
|
123 * This ID must be unique while the transaction is in progress. |
|
124 * @param aLength Length of the content previously downloaded |
|
125 * @param aFileName Name of the file in which the downloaded content is stored |
|
126 * @param aContentType Type of content downloaded. For example: |
|
127 * Markup, Image, Cascading Style Sheet (CSS), Javascript, Netscape plug-in, Sound |
|
128 * @param aUrl URL of the source of the content to be done in the new window |
|
129 * @return None |
|
130 */ |
|
131 virtual void ResumeDownloadL(TUint aTransactionID, |
|
132 TUint aLength, |
|
133 const TDesC& aFileName, |
|
134 const TDesC& aContentType, |
|
135 const TDesC& aUrl) = 0; |
|
136 |
|
137 |
|
138 |
|
139 /** |
|
140 * Informs the host application that one of the following download events is in progress: |
|
141 * NOTE: All events have the prefix EDownload: |
|
142 * EventStarted, EventCompleted, EventProgress, EventCanceled, EventError |
|
143 * EventPaused, EventResumed, EventPausable |
|
144 * @since 3.0 |
|
145 * @param aTransactionID The ID of the transaction, it is unique as long |
|
146 * as the transaction is on-going |
|
147 * @param aDownloadEvent Event to be handled Examples: |
|
148 * EventStarted, EventCompleted, EventProgress, EventCanceled, EventError |
|
149 * EventPaused, EventResumed, EventPausable |
|
150 * @param aValue Value associated with the event. Examples: |
|
151 * Total size of the downloaded file |
|
152 * Size of that was downloaded so far |
|
153 * @return void |
|
154 */ |
|
155 virtual void HandleDownloadEventL(TUint aTransactionID, |
|
156 TBrCtlDownloadEvent aDownloadEvent, |
|
157 TUint aValue) = 0; |
|
158 |
|
159 }; |
|
160 |
|
161 #endif // BRCTLDOWNLOADOBSERVER_H |
|
162 |
|
163 // End of File |