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
69 UseOverlayed, //deprecated
70 OverlayedBeforeOriginal //deprecated
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 js_function_impl getFunctionImpl() const;
84 void invokeCallback(JsContext ctx,
85 ObjectInstance iframe,
86 ObjectInstance object) const;
88 PrivateData getPrivateData() const;
91 const ClassOptions* m_options;
94 explicit Options(const ClassOptions* options) : m_options(options)
96 assert(options && "Dont create empty options");
99 friend class JSObjectDeclaration;
102 typedef std::shared_ptr<Options> OptionsPtr;
106 explicit JSObjectDeclaration(js_entity_definition_ptr_t declaration);
108 virtual const std::string& getName() const
113 virtual const std::string& getParentName() const
118 virtual ConstClassTemplate getClassTemplate() const
120 return m_classTemplate;
123 virtual const std::string& getInterfaceName() const
125 return m_interfaceName;
128 virtual ConstructorCallback getConstructorCallback() const
130 return m_constructorCallback;
133 const OptionsPtr getOptions() const
138 bool checkIframesSupported() const;
140 virtual ~JSObjectDeclaration();
144 std::string m_parentName;
145 std::string m_interfaceName;
146 ConstClassTemplate m_classTemplate;
147 ConstructorCallback m_constructorCallback;
148 OptionsPtr m_options;
151 typedef DPL::SharedPtr<JSObjectDeclaration> JSObjectDeclarationPtr;