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.
17 * @file js_object_declaration.h
18 * @author Grzegorz Krawczyk (g.krawczyk@samgsung.com)
23 #ifndef WRT_SRC_PLUGIN_SERVICE_JS_OBJECT_DECLARATION_H_
24 #define WRT_SRC_PLUGIN_SERVICE_JS_OBJECT_DECLARATION_H_
29 #include <dpl/shared_ptr.h>
30 #include <dpl/noncopyable.h>
31 #include <dpl/log/log.h>
32 #include <wrt_plugin_export.h>
34 class JSObjectDeclaration : private DPL::Noncopyable
37 typedef const void* ConstClassTemplate;
38 typedef void* ClassTemplate;
39 typedef js_class_constructor_cb_t ConstructorCallback;
40 typedef class_definition_options_t ClassOptions;
42 class Options : DPL::Noncopyable
52 enum class IFrameObject
59 enum class IFrameNotice
66 enum class IFrameOverlay
70 OverlayedBeforeOriginal
73 typedef js_object_instance_t ObjectInstance;
74 typedef java_script_context_t JsContext;
75 typedef void* PrivateData;
78 ClassType getType() const;
80 IFrameObject getIframeObject() const;
81 IFrameNotice getIframeNotice() const;
82 IFrameOverlay getIframeOverlay() const;
83 js_function_impl getFunctionImpl() const;
85 void invokeCallback(JsContext ctx,
86 ObjectInstance iframe,
87 ObjectInstance object) const;
89 PrivateData getPrivateData() const;
92 const ClassOptions* m_options;
95 explicit Options(const ClassOptions* options) : m_options(options)
97 assert(options && "Dont create empty options");
100 friend class JSObjectDeclaration;
103 typedef std::shared_ptr<Options> OptionsPtr;
107 explicit JSObjectDeclaration(js_entity_definition_ptr_t declaration);
109 virtual const std::string& getName() const
114 virtual const std::string& getParentName() const
119 virtual ConstClassTemplate getClassTemplate() const
121 return m_classTemplate;
124 virtual const std::string& getInterfaceName() const
126 return m_interfaceName;
129 virtual ConstructorCallback getConstructorCallback() const
131 return m_constructorCallback;
134 const OptionsPtr getOptions() const
139 bool checkIframesSupported() const;
141 virtual ~JSObjectDeclaration();
145 std::string m_parentName;
146 std::string m_interfaceName;
147 ConstClassTemplate m_classTemplate;
148 ConstructorCallback m_constructorCallback;
149 OptionsPtr m_options;
152 typedef DPL::SharedPtr<JSObjectDeclaration> JSObjectDeclarationPtr;