Fix : The exception handling according to the situation
[platform/framework/native/content.git] / src / inc / FCnt_DownloadManagerImpl.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17  * @file                FCnt_DownloadManagerImpl.h
18  * @brief               This is the header file for the %_DownloadManagerImpl class.
19  *
20  * This header file contains the declarations of the %_DownloadManagerImpl class.
21  */
22 #ifndef _FCNT_DOWNLOAD_MANAGER_IMPL_H_
23 #define _FCNT_DOWNLOAD_MANAGER_IMPL_H_
24
25 #include <FBaseResult.h>
26 #include <FBaseString.h>
27 #include <FBaseRtEvent.h>
28 #include <FBaseColHashMapT.h>
29
30 namespace Tizen { namespace Content
31 {
32
33 class DownloadRequest;
34 class _DownloadRequestImpl;
35
36 class IDownloadListener;
37
38 class _OSP_EXPORT_ _DownloadManagerImpl
39         : public Tizen::Base::Object
40 {
41 public:
42         enum NetworkType
43         {
44                 NETWORK_DATA = 1,
45                 NETWORK_WIFI,
46                 NETWORK_ALL = 100
47         };
48
49 public:
50         _DownloadManagerImpl(void);
51         virtual ~_DownloadManagerImpl(void);
52
53         result Start(const DownloadRequest& request, RequestId& reqId);
54         result Pause(RequestId reqId);
55         result Resume(RequestId reqId);
56         result Cancel(RequestId reqId);
57
58         DownloadRequest* GetDownloadRequestN(RequestId reqId);
59
60         int GetState(RequestId reqId) const;
61
62         result GetMimeType(RequestId reqId, Tizen::Base::String& mimeType);
63
64         result GetProgress(RequestId reqId, int& progress);
65
66         result SetAllowedNetwork(unsigned long flags);
67
68         void SetDownloadListener(IDownloadListener* pListener);
69
70         void DestroyResources(RequestId reqId);
71
72         static result ConvertToResult(int error);
73
74         static _DownloadManagerImpl* GetInstance(void);
75
76 public:
77         IDownloadListener* __pListener;
78         Tizen::Base::Runtime::Event* __pEvent;
79
80 private:
81         _DownloadManagerImpl(const _DownloadManagerImpl& clientChannel);
82         _DownloadManagerImpl& operator =(const _DownloadManagerImpl& clientChannel);
83
84         static void InitSingleton(void);
85         static void DestroySingleton(void);
86
87         int RegisterCallback(RequestId reqId);
88         void UnregisterCallback(RequestId reqId);
89
90 private:
91         static _DownloadManagerImpl* __pInstance;
92 }; // _DownloadManagerImpl
93
94 } } // Tizen::Content
95
96 #endif //_FCNT_DOWNLOAD_MANAGER_IMPL_H_
97