|
1 /* |
|
2 * Copyright (c) 2007 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __HTTPDOWNLOAD_H__ |
|
19 #define __HTTPDOWNLOAD_H__ |
|
20 |
|
21 #include <BrCtlSpecialLoadObserver.h> |
|
22 #include "HttpUiCallbacks.h" |
|
23 #include "HttpCallbacks.h" |
|
24 #include <DownloadMgrClient.h> |
|
25 #include <CDownloadMgrUiLibRegistry.h> |
|
26 #include <BrCtlDownloadObserver.h> |
|
27 |
|
28 class HttpDlConnection; |
|
29 class RHTTPTransaction; |
|
30 class CHttpLoaderEventToUiListener; |
|
31 class HttpSessionManager; |
|
32 |
|
33 class HttpDownload : public MHttpDownloadMgrObserver, public MHttpDownloadMgrNextUriObserver |
|
34 { |
|
35 public: |
|
36 HttpDownload(HttpSessionManager* sessionManager); |
|
37 virtual ~HttpDownload(); |
|
38 void continueDownloadL(RHTTPTransaction* connTransaction, HttpDlConnection* dlConnection); |
|
39 |
|
40 /** |
|
41 * Create a connection in DMgr with the given name. |
|
42 */ |
|
43 void connect( TName& aName ); |
|
44 |
|
45 /** |
|
46 * Close Download Manager connection |
|
47 */ |
|
48 void disconnect(); |
|
49 |
|
50 /* This method displays download list |
|
51 */ |
|
52 void ShowDownloadsL(); |
|
53 |
|
54 /* |
|
55 * This method calls to download manager in order to display query "Cancel |
|
56 * outstanding downloads?" and cancel if it requested by user |
|
57 * return ETrue if it is OK to exit; EFalse - if it is not OK to exit |
|
58 */ |
|
59 bool okToExit(); |
|
60 |
|
61 /* |
|
62 * This method calls to Download Manager to prepare to exit. |
|
63 */ |
|
64 void prepareToExit( long appUid, long viewId, long customMessageId ); |
|
65 |
|
66 /* |
|
67 * This method calls to Download Manager to HandleDownloadCommandL. |
|
68 */ |
|
69 void HandleDownloadCommandL(unsigned int transId, TBrCtlDefs::TBrCtlDownloadCmd command); |
|
70 |
|
71 /** |
|
72 * Enables cookie usage in DMgr. |
|
73 * enable true if cookies are enabled |
|
74 */ |
|
75 void enableCookies(int enable ); |
|
76 |
|
77 /** |
|
78 */ |
|
79 void updateDownloadsOpenEnabled(); |
|
80 |
|
81 // from MHttpDownloadMgrObserver |
|
82 void HandleDMgrEventL( RHttpDownload& download, THttpDownloadEvent dvent ); |
|
83 |
|
84 //from MHttpDownloadMgrNextUriObserver |
|
85 void NextUriL( RHttpDownload& download, const TDesC8& uri ); |
|
86 |
|
87 /* |
|
88 * Returns a number of outstanding downloads which not handled by |
|
89 * the media |
|
90 */ |
|
91 unsigned int numOfDownloads(); |
|
92 |
|
93 private: |
|
94 /** |
|
95 * Initialize Download Manager |
|
96 */ |
|
97 void initDownloadMgrL(); |
|
98 |
|
99 /** |
|
100 * Initialize Download Manager Ui Lib |
|
101 */ |
|
102 void initDownloadMgrUiLibL(); |
|
103 |
|
104 /** |
|
105 * Finds connection associated with the download id |
|
106 * dlId unique download id |
|
107 */ |
|
108 HttpDlConnection* findDownloadConnection(long dlId, int& position); |
|
109 |
|
110 /** |
|
111 * Handle the EHttpDlCompleted DM event. |
|
112 * download The download with which the event occured. |
|
113 */ |
|
114 void handleDMgrCompletedEventL(RHttpDownload& download, TInt event ); |
|
115 |
|
116 void handleDMgrEventDlCompletedL(RHttpDownload& download); |
|
117 void handleDMgrEventDlFailedL(RHttpDownload& download); |
|
118 void handleDMgrEventDlDeletingL(RHttpDownload& download); |
|
119 void handleDMgrEventDlPausableL(RHttpDownload& download); |
|
120 void handleDMgrEventDlNonPausableL(RHttpDownload& download); |
|
121 void handleDMgrEventDlPausedL(RHttpDownload& download); |
|
122 void handleDMgrEventProgConnectionNeededL(RHttpDownload& download); |
|
123 void handleDMgrEventProgResponseBodyReceivedL(RHttpDownload& download); |
|
124 void handleDMgrEventProgResponseHeaderReceivedL(RHttpDownload& download); |
|
125 |
|
126 void CreateDownloadArraysLC(RHttpDownload& download, RArray<TUint>*& typeArray, CDesCArrayFlat*& desArray ); |
|
127 |
|
128 private: |
|
129 HttpSessionManager* m_sessionManager; |
|
130 bool m_dMgrReady; |
|
131 int m_launchViewer; |
|
132 Vector<HttpDlConnection*> m_pendingHttpDownloadRequests; |
|
133 RHttpDownloadMgr m_downloadMgr; |
|
134 CDownloadMgrUiLibRegistry* m_dMgrUiReg; |
|
135 int m_suppressDloadConfirmation; |
|
136 MBrCtlDownloadObserver* m_downloadObserver; |
|
137 }; |
|
138 #endif // __HTTPDOWNLOAD_H__ |
|
139 // end of file |