Apply to remove download listener before deleting _WebImpl
[framework/osp/web.git] / src / controls / FWebCtrl_WebDataHandler.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                FWebCtrl_WebDataHandler.h
20  * @brief               The file contains the declaration of _WebDataHandler class.
21  *
22  * The file contains the declaration of _WebDataHandler class.
23  */
24 #ifndef _FWEB_CTRL_INTERNAL_WEBDATA_HANDLER_H_
25 #define _FWEB_CTRL_INTERNAL_WEBDATA_HANDLER_H_
26
27 #include <unique_ptr.h>
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FNetHttpHttpSession.h>
31 #include <FNetHttpHttpTransaction.h>
32 #include <FNetHttpIHttpTransactionEventListener.h>
33
34
35 namespace Tizen { namespace Web { namespace Controls
36 {
37
38 class IWebDownloadListener;
39 class _WebEvent;
40
41 class _WebDataHandler
42         : public Tizen::Net::Http::IHttpTransactionEventListener
43 {
44 public:
45         _WebDataHandler(void);
46         virtual ~_WebDataHandler(void);
47
48         //IHttpTransactionEventListener
49         virtual void OnTransactionReadyToRead(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, int availableBodyLen);
50         virtual void OnTransactionAborted(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, result r);
51         virtual void OnTransactionReadyToWrite(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, int recommendedChunkSize);
52         virtual void OnTransactionHeaderCompleted(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, int headerLen, bool bAuthRequired);
53         virtual void OnTransactionCertVerificationRequiredN(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction, Tizen::Base::String* pCert);
54         virtual void OnTransactionCompleted(Tizen::Net::Http::HttpSession& httpSession, Tizen::Net::Http::HttpTransaction& httpTransaction);
55
56         Tizen::Web::Controls::_WebEvent* GetWebEvent(void) const;
57         void SetWebEvent(const Tizen::Web::Controls::_WebEvent* pWebEvent);
58
59         Tizen::Web::Controls::IWebDownloadListener* GetDownloadListener(void) const;
60         void SetDownloadListener(const Tizen::Web::Controls::IWebDownloadListener* pDownloadListener);
61
62         result StartDownload(const Tizen::Base::String& url);
63
64 private:
65         Tizen::Web::Controls::IWebDownloadListener* __pDownloadListener;
66         Tizen::Web::Controls::_WebEvent* __pWebEvent;
67         std::unique_ptr<Tizen::Net::Http::HttpSession> __pHttpSession;
68
69 }; // _WebDataHandler
70
71 }}} //Tizen::Web::Controls
72 #endif // _FWEB_CTRL_INTERNAL_WEBDATA_HANDLER_H_