2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FCnt_DownloadManagerImpl.h
19 * @brief This is the header file for the %_DownloadManagerImpl class.
21 * This header file contains the declarations of the %_DownloadManagerImpl class.
23 #ifndef _FCNT_DOWNLOAD_MANAGER_IMPL_H_
24 #define _FCNT_DOWNLOAD_MANAGER_IMPL_H_
26 #include <FBaseResult.h>
27 #include <FBaseString.h>
28 #include <FBaseRtEvent.h>
29 #include <FBaseColHashMapT.h>
31 namespace Tizen { namespace Content
34 class DownloadRequest;
35 class _DownloadRequestImpl;
37 class IDownloadListener;
39 class _OSP_EXPORT_ _DownloadManagerImpl
40 : public Tizen::Base::Object
62 _DownloadManagerImpl(void);
63 virtual ~_DownloadManagerImpl(void);
65 result Construct(void);
67 result Start(const DownloadRequest& request, RequestId& reqId);
68 result Pause(RequestId reqId);
69 result Resume(RequestId reqId);
70 result Cancel(RequestId reqId);
72 DownloadRequest* GetDownloadRequestN(RequestId reqId);
74 State GetState(RequestId reqId) const;
76 result GetMimeType(RequestId reqId, Tizen::Base::String& mimeType);
78 result GetProgress(RequestId reqId, int& progress);
80 result SetAllowedNetwork(unsigned long flags);
82 void SetDownloadListener(IDownloadListener* pListener);
84 void DestroyResources(RequestId reqId);
86 static result ConvertToResult(int error);
88 static _DownloadManagerImpl* GetInstance(void);
91 IDownloadListener* __pListener;
92 Tizen::Base::Runtime::Event* __pEvent;
95 _DownloadManagerImpl(const _DownloadManagerImpl& clientChannel);
96 _DownloadManagerImpl& operator =(const _DownloadManagerImpl& clientChannel);
98 static void InitSingleton(void);
99 static void DestroySingleton(void);
101 enum DownloadOperation
103 DOWNLOAD_OPERATION_START,
104 DOWNLOAD_OPERATION_PAUSE,
105 DOWNLOAD_OPERATION_RESUME,
106 DOWNLOAD_OPERATION_CANCEL,
109 result CheckPrestate(DownloadOperation operation, State current);
111 result RegisterCallback(RequestId reqId);
112 void UnregisterCallback(RequestId reqId);
115 Tizen::Base::Collection::HashMapT<RequestId, DownloadRequest*> __handleMap;
117 static _DownloadManagerImpl* __pInstance;
118 }; // _DownloadManagerImpl
120 } } // Tizen::Content
122 #endif //_FCNT_DOWNLOAD_MANAGER_IMPL_H_