2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Handle download events
19 #ifndef BRCTLDOWNLOADOBSERVER_H
20 #define BRCTLDOWNLOADOBSERVER_H
25 #include <brctldefs.h>
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.
35 enum TBrCtlDownloadEvent
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.
42 EDownloadEventStarted,
44 * A download has completed. The aValue associated with this event
45 * is the total size of the file that was downloaded.
47 EDownloadEventCompleted,
49 * A download is in progress. The aValue associated with this event
50 * is the size of the file that was downloaded so far.
52 EDownloadEventProgress,
54 * A download was canceled by the HandleDownloadCommandL function.
56 EDownloadEventCanceled,
58 * An error occurred in the Download Manager during a download operation.
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.
67 * A paused download was resumed. The aValue associated with this event
68 * is the size of the file that was downloaded so far.
70 EDownloadEventResumed,
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
77 EDownloadEventPausable
80 // FORWARD DECLARATIONS
81 class CBrCtlInterface;
84 * The MBrCtlDownloadObserver class handles download events.
89 * #include <brctldownloadobserver.h>
92 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
93 * @lib BrowserEngine.lib
94 * @file brctldownloadobserver.h
97 class MBrCtlDownloadObserver
99 public: // New functions
101 * Inform the host application that a new download has started using the Download Manager
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
112 virtual TBool NewDownloadL(TUint aTransactionID,
113 const TDesC& aFileName,
114 const TDesC& aContentType,
115 const TDesC& aUrl) = 0;
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.
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
131 virtual void ResumeDownloadL(TUint aTransactionID,
133 const TDesC& aFileName,
134 const TDesC& aContentType,
135 const TDesC& aUrl) = 0;
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
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
155 virtual void HandleDownloadEventL(TUint aTransactionID,
156 TBrCtlDownloadEvent aDownloadEvent,
161 #endif // BRCTLDOWNLOADOBSERVER_H