2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief This file is the implementation file of plugin
22 #ifndef WRT_SRC_PLUGIN_SERVICE_PLUGIN_H_
23 #define WRT_SRC_PLUGIN_SERVICE_PLUGIN_H_
28 #include <dpl/atomic.h>
30 #include <dpl/noncopyable.h>
31 #include <wrt_plugin_export.h>
32 #include <Commons/JSObjectDeclaration.h>
33 #include <dpl/wrt-dao-ro/wrt_db_types.h>
36 typedef std::shared_ptr<Plugin> PluginPtr;
38 class Plugin : private DPL::Noncopyable
41 typedef JSObjectDeclaration Class;
42 typedef JSObjectDeclarationPtr ClassPtr;
43 typedef std::list<ClassPtr> ClassList;
44 typedef std::shared_ptr<ClassList> ClassPtrList;
47 ///< Plug-in identifier. Currently plug-in file name is used as the ID
48 std::string m_fileName;
50 ///< Handle for the plug-in library. A plug-in is a dynamic loadable library
54 on_widget_start_proc* m_apiOnWidgetStart;
55 on_widget_init_proc* m_apiOnWidgetInit;
56 on_widget_stop_proc* m_apiOnWidgetStop;
57 on_frame_load_proc* m_apiOnFrameLoad;
58 on_frame_unload_proc* m_apiOnFrameUnload;
59 const ClassPtrList m_apiClassList;
61 Plugin(const std::string &fileName,
63 on_widget_start_proc* apiOnWidgetStart,
64 on_widget_init_proc* apiOnWidgetInit,
65 on_widget_stop_proc* apiOnWidgetStop,
66 on_frame_load_proc* apiOnFrameLoad,
67 on_frame_unload_proc* apiOnFrameUnload,
68 const ClassPtrList &apiClassList);
74 static PluginPtr LoadFromFile(const std::string &fileName);
77 std::string GetFileName() const;
80 void OnWidgetStart(WidgetHandle widgetId);
82 void OnWidgetInit(feature_mapping_interface_t *interface);
84 void OnWidgetStop(WidgetHandle widgetId);
86 void OnFrameLoad(java_script_context_t context);
88 void OnFrameUnload(java_script_context_t context);
90 const ClassPtrList GetClassList() const;