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