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>
29 #include <dpl/shared_ptr.h>
30 #include <dpl/noncopyable.h>
31 #include <wrt_plugin_export.h>
32 #include <Commons/JSObjectDeclaration.h>
35 typedef DPL::SharedPtr<Plugin> PluginPtr;
37 class Plugin : private DPL::Noncopyable
40 typedef JSObjectDeclaration Class;
41 typedef JSObjectDeclarationPtr ClassPtr;
42 typedef std::list<ClassPtr> ClassList;
43 typedef DPL::SharedPtr<ClassList> ClassPtrList;
46 ///< Plug-in identifier. Currently plug-in file name is used as the ID
47 std::string m_fileName;
49 ///< Handle for the plug-in library. A plug-in is a dynamic loadable library
53 on_widget_start_proc* m_apiOnWidgetStart;
54 on_widget_init_proc* m_apiOnWidgetInit;
55 on_widget_stop_proc* m_apiOnWidgetStop;
56 on_frame_load_proc* m_apiOnFrameLoad;
57 on_frame_unload_proc* m_apiOnFrameUnload;
58 const ClassPtrList m_apiClassList;
60 Plugin(const std::string &fileName,
62 on_widget_start_proc* apiOnWidgetStart,
63 on_widget_init_proc* apiOnWidgetInit,
64 on_widget_stop_proc* apiOnWidgetStop,
65 on_frame_load_proc* apiOnFrameLoad,
66 on_frame_unload_proc* apiOnFrameUnload,
67 const ClassPtrList &apiClassList);
73 static PluginPtr LoadFromFile(const std::string &fileName);
76 std::string GetFileName() const;
79 void OnWidgetStart(int widgetId);
81 void OnWidgetInit(feature_mapping_interface_t *interface);
83 void OnWidgetStop(int widgetId);
85 void OnFrameLoad(java_script_context_t context);
87 void OnFrameUnload(java_script_context_t context);
89 const ClassPtrList GetClassList() const;