51d9fcb812fb5aa95f53f2c2b1861348789d80fc
[platform/framework/web/web-provider.git] / src / Plugin / AppBoxPlugin / AppBoxManager.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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    AppBoxManager.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  */
20 #ifndef APP_BOX_MANAGER_H
21 #define APP_BOX_MANAGER_H
22
23 #include <Core/IBox.h>
24 #include <Core/IBoxManager.h>
25 #include <Core/BoxManager.h>
26 #include <Core/BoxData.h>
27 #include <Plugin/IBoxPluginFactory.h>
28
29 class AppBoxManager: public BoxManager {
30     public:
31         static IBoxManagerPtr create(IBoxPluginFactoryPtr factory) 
32         { 
33             return IBoxManagerPtr(new AppBoxManager(factory)); 
34         };
35         ~AppBoxManager();
36
37     private:
38         // BoxManager implementation
39         bool requestAddBox(BoxInfoPtr boxInfo, EwkContextPtr ewkContext);
40         bool requestRemoveBox(std::string& instanceId);
41
42         EwkContextPtr getAvailableEwkContext();
43         void insertContextMap(EwkContextPtr context, std::string& instanceId);
44         void eraseContextMap(std::string& instanceId);
45         explicit AppBoxManager(IBoxPluginFactoryPtr factory);
46
47         // members
48         typedef std::map<EwkContextPtr, IBoxPtr> EwkContextMap;
49         EwkContextMap m_contextMap;
50         EwkContextPtr m_defaultEwkContext;
51 };
52
53
54 #endif //  APP_BOX_MANAGER_H