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