Merge from master branch
[platform/framework/native/image.git] / src / FMedia_ImageDownloadListener.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 /**
19  * @file   FMedia_ImageDownloadListener.h
20  * @brief  This file contains the declaration of Image download listener class,
21  *               required internally by Image::DecodeUrl.
22  */
23
24 #ifndef FMEDIA_INTERNAL_IMAGEDOWNLOADLISTENER_H_
25 #define FMEDIA_INTERNAL_IMAGEDOWNLOADLISTENER_H_
26
27 #define _EXCEPT_DEPENDENCY_
28 #include <FNet.h>
29
30 namespace Tizen{ namespace Media{
31
32 class _ImageUriDataEvent;
33 class _ImageUriData;
34
35 class _ImageDownloadListener
36         : virtual public Tizen::Net::Http::IHttpTransactionEventListener
37         , virtual public Tizen::Base::Object
38         , virtual public Tizen::Base::Runtime::IEventListener
39 {
40
41 public:
42         _ImageDownloadListener(void);
43         virtual ~_ImageDownloadListener(void);
44
45 public:
46         virtual void OnTransactionReadyToRead(Tizen::Net::Http::HttpSession& httpSession,
47           Tizen::Net::Http::HttpTransaction& httpTransaction, int availableBodyLen);
48
49         virtual void OnTransactionAborted(Tizen::Net::Http::HttpSession& httpSession,
50           Tizen::Net::Http::HttpTransaction& httpTransaction, result r);
51
52         virtual void OnTransactionCompleted(Tizen::Net::Http::HttpSession& httpSession,
53           Tizen::Net::Http::HttpTransaction& httpTransaction);
54
55         virtual void OnTransactionCertVerificationRequiredN(Tizen::Net::Http::HttpSession& httpSession,
56           Tizen::Net::Http::HttpTransaction& httpTransaction, Tizen::Base::String* pCert);
57
58         virtual void OnTransactionHeaderCompleted(Tizen::Net::Http::HttpSession& httpSession,
59           Tizen::Net::Http::HttpTransaction& httpTransaction, int headerLen, bool bAuthRequired);
60
61         virtual void OnTransactionReadyToWrite(Tizen::Net::Http::HttpSession& httpSession,
62           Tizen::Net::Http::HttpTransaction& httpTransaction, int recommendedChunkSize);
63
64         void OnDownloadCanceled(result res);
65
66         void setDownloadPath(Tizen::Base::String NewDownloadPath);
67         void SetImageUrlEvent(_ImageUriDataEvent* pImageUriEvent);
68         void SetImageUrlData(_ImageUriData* pImageUriData);
69         void SetImagePixelFormat(Tizen::Graphics::BitmapPixelFormat colorFormat);
70         void SetImageDestDimension(int destWidth, int destHeight);
71         void SetRequestId(RequestId reqId);
72
73 private:
74         /**
75         * This is the copy constructor for this class.
76         */
77         _ImageDownloadListener(const _ImageDownloadListener& rhs);
78         /**
79         * This is the assignment operator.
80         */
81         _ImageDownloadListener& operator =(const _ImageDownloadListener& rhs);
82
83         RequestId __requestID;
84         _ImageUriDataEvent* __pImageUriEvent;
85         _ImageUriData* __pImageUriData;
86         Tizen::Base::ByteBuffer* __pDownloadedData;
87         Tizen::Graphics::BitmapPixelFormat __colorFormat;
88         int __destWidth;
89         int __destHeight;
90 };
91
92 }} // Tizen::Media
93
94 #endif // FMEDIA_INTERNAL_IMAGEDOWNLOADLISTENER_H_