Support fast opening of PD
[platform/framework/web/web-provider.git] / src / Core / View / PdHelper.h
1
2 /*
3  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4  *
5  *    Licensed under the Flora License, Version 1.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://floralicense.org/license/
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    PdHelper.h
19  * @author  Yunchan Cho (yunchan.cho@samsung.com)
20  */
21
22 #ifndef PD_HELPER_H
23 #define PD_HELPER_H
24
25 #include <string>
26 #include <Evas.h>
27 #include "IRenderView.h"
28 #include "IPdHelper.h"
29
30 #define EXPORT_CLASS    __attribute__ ((visibility("default"))
31
32 class EXPORT_CLASS PdHelper: public IPdHelper {
33     public:
34         static IPdHelperPtr create(
35                 Evas_Object* pdWin, 
36                 std::string pdStartUrl, 
37                 RenderInfoPtr pdRenderInfo) 
38         {
39             return IPdHelperPtr(new PdHelper(pdWin, pdStartUrl, pdRenderInfo));
40         }
41         virtual void startOpen();
42         virtual void finishOpen(Evas_Object* child);
43         virtual void close();
44         virtual void setBoxWebView(Evas_Object* webview);
45         virtual void setPdWebView(Evas_Object* webview);
46         virtual Evas_Object* getBoxWebView() const;
47         virtual Evas_Object* getPdWebView() const;
48         virtual Evas* getPdCanvas() const;
49         virtual bool isPdOpened() const;
50         virtual ~PdHelper();
51
52     private:
53         virtual void didExecuteScript(Evas_Object* webview, std::string& result);
54
55         std::string validateUrl(std::string& url);
56         static void executeScriptCallback(
57             Evas_Object* webview, const char* result, void* data);
58
59         PdHelper(Evas_Object* pdWin, std::string pdStartUrl, RenderInfoPtr pdRenderInfo); 
60
61         //members
62         Evas_Object* m_win;
63         Evas_Object* m_boxWebView;
64         Evas_Object* m_pdWebView;
65         std::string m_startUrl;
66         RenderInfoPtr m_renderInfo;
67         bool m_opened;
68 };
69
70 #endif // PD_HELPER_H
71