f0d38e822895fc2ea0291204c097ed0d0d4034a8
[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* getPdCanvas() const;
44         virtual bool isPdOpened() const;
45         virtual ~PdHelper();
46
47     private:
48         virtual void didExecuteScript(Evas_Object* webview, std::string& result);
49
50         std::string validateUrl(std::string& url);
51         static void executeScriptCallback(
52             Evas_Object* webview, const char* result, void* data);
53
54         PdHelper(Evas_Object* pdWin, std::string pdStartUrl, RenderInfoPtr pdRenderInfo); 
55
56         //members
57         Evas_Object* m_win;
58         Evas_Object* m_baseWebView;
59         Evas_Object* m_pdWebView;
60         std::string m_startUrl;
61         RenderInfoPtr m_renderInfo;
62         bool m_opened;
63 };