f6c4766bd1ba46fbaf78f6dc54930f2e8d2dfe1c
[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 #include <string>
23 #include <Evas.h>
24 #include "IRenderView.h"
25 #include "IPdHelper.h"
26
27 #define EXPORT_CLASS    __attribute__ ((visibility("default"))
28
29 class EXPORT_CLASS PdHelper: public IPdHelper {
30     public:
31         static IPdHelperPtr create(
32                 Evas_Object* pdWin, 
33                 std::string pdStartUrl, 
34                 RenderInfoPtr pdRenderInfo) 
35         {
36             return IPdHelperPtr(new PdHelper(pdWin, pdStartUrl, pdRenderInfo));
37         }
38         virtual void startOpen();
39         virtual void finishOpen(Evas_Object*& child);
40         virtual void close();
41         virtual void setBaseWebView(Evas_Object*& parent);
42         virtual Evas_Object* getBaseWebView() const;
43         virtual Evas_Object* getPdWebView() const;
44         virtual Evas* getPdCanvas() const;
45         virtual bool isPdOpened() const;
46         virtual ~PdHelper();
47
48     private:
49         virtual void didExecuteScript(Evas_Object* webview, std::string& result);
50
51         std::string validateUrl(std::string& url);
52         static void executeScriptCallback(
53             Evas_Object* webview, const char* result, void* data);
54
55         PdHelper(Evas_Object* pdWin, std::string pdStartUrl, RenderInfoPtr pdRenderInfo); 
56
57         //members
58         Evas_Object* m_win;
59         Evas_Object* m_baseWebView;
60         Evas_Object* m_pdWebView;
61         std::string m_startUrl;
62         RenderInfoPtr m_renderInfo;
63         bool m_opened;
64 };