[content] Fix remove item bug on PlayList
[platform/framework/native/content.git] / src / FCnt_ContentDownloadHandler.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file                FCnt_ContentDownloadHandler.h
19  * @brief               This is the header file for the %_ContentDownloadHandler class.
20  *
21  * This header file contains the declarations of the %_ContentDownloadHandler class.
22  */
23
24 #ifndef _FCNT_INTERNAL_CONTENT_DOWNLOAD_HANDLER_H_
25 #define _FCNT_INTERNAL_CONTENT_DOWNLOAD_HANDLER_H_
26
27 #include "FCnt_ContentDownloadListener.h"
28
29 namespace Tizen { namespace Net { namespace Http
30 {
31 class HttpTransaction;
32 }}}
33 namespace Tizen { namespace Net { namespace Http
34 {
35 class HttpSession;
36 }}}
37 namespace Tizen { namespace Net { namespace Http
38 {
39 class HttpRequest;
40 }}}
41
42 namespace Tizen { namespace Content
43 {
44
45 class ContentTransferInfo;
46 class _ContentDownloadUserData;
47 class _ContentTransferEvent;
48
49 class _ContentDownloadHandler
50         : public Tizen::Base::Object
51 {
52 public:
53         _ContentDownloadHandler(void);
54         virtual ~_ContentDownloadHandler(void);
55         result Construct(void);
56
57         result Cancel(RequestId requestId, _ContentDownloadUserData* pContentDownloadUserDataSequence);
58         RequestId HttpDownload(const Tizen::Base::String uri, int srcFileSize, const Tizen::Base::String destPath, _ContentDownloadUserData* pContentDownloadUserDataSequence);
59         result RequestDownload(Tizen::Base::String& srcUrl, const Tizen::Base::String destFilePath, int timeout, int percent, _ContentDownloadUserData* pUserData);
60         bool CheckSystem(const Tizen::Base::String& destPath, int srcFileSize);
61
62         void SetTimeout(int sec);
63         void SetProgressIntervalByPercent(int percent);
64         void SetDownloadPath(Tizen::Base::String destFilePath);
65         void SetSlot(int slot);
66         void SetRequestId(RequestId requestId);
67
68 private:
69         _ContentDownloadHandler(const _ContentDownloadHandler& rhs);
70         _ContentDownloadHandler& operator =(const _ContentDownloadHandler& rhs);
71
72 private:
73         RequestId __requestId;
74         RequestId __restRequestId;
75         int __timeout;
76         int __percent;
77         int __slot;
78         Tizen::Base::String __destFilePath;
79         Tizen::Base::String __sourceFilePath;
80         std::unique_ptr<_ContentDownloadListener> __pListener;
81         std::unique_ptr<Tizen::Net::Http::HttpSession> __pSession;
82         std::unique_ptr<Tizen::Net::Http::HttpTransaction> __pTransaction;
83 };  // class _ContentDownloadHandler
84
85 }}  // Tizen::Content
86
87 #endif  // _FCNT_INTERNAL_CONTENT_DOWNLOAD_HANDLER_H_