[Release] wrt_0.8.191
[platform/framework/web/wrt.git] / src / api_new / ewk_context_manager.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file    ewk_context_manager.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  * @version 0.1
20  * @brief   Declaration of EwkContextManager class.
21  *          This file handles operation regarding Ewk_Context.
22  */
23
24 #ifndef EWK_CONTEXT_MANAGER_H
25 #define EWK_CONTEXT_MANAGER_H
26
27 #include<abstract_context_manager.h>
28
29 namespace WRT {
30
31 class EwkContextManager : public AbstractContextManager {
32     public:
33         EwkContextManager(
34             const std::string& tizenAppId,
35             Ewk_Context* ewkContext,
36             ViewModule::IViewModulePtr viewModule);
37         Ewk_Context * getEwkContext() const;
38         void handleLowMemory();
39         ~EwkContextManager();
40
41     private:
42         bool initialize();
43         void destroy();
44         void setCallbacks();
45         void unsetCallbacks();
46         void setAutoFullscreenMode();
47         void setBackgroundSupport();
48         void setCSPSupport();
49
50         // ewk context callback functions
51         static void messageFromInjectedBundleCallback(
52                 const char* name,
53                 const char* body,
54                 char** returnData,
55                 void* clientInfo);
56         static void didStartDownloadCallback(const char* downloadUrl, void* data);
57         static void vibrationClientStartCallback(uint64_t time, void* data);
58         static void vibrationClientStopCallback(void* data);
59
60         // members
61         bool m_initialized;
62         bool m_isInternalContext;
63 };
64
65 }
66
67 #endif // EWK_CONTEXT_MANAGER_H