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;
43 class Options : DPL::Noncopyable {
51 enum class IFrameObject{
57 enum class IFrameNotice{
63 enum class IFrameOverlay{
66 OverlayedBeforeOriginal
69 typedef js_object_instance_t ObjectInstance;
70 typedef java_script_context_t JsContext;
71 typedef void* PrivateData;
74 ClassType getType() const;
76 IFrameObject getIframeObject() const;
77 IFrameNotice getIframeNotice() const;
78 IFrameOverlay getIframeOverlay() const;
79 js_function_impl getFunctionImpl() const;
81 void invokeCallback(JsContext ctx,
82 ObjectInstance iframe,
83 ObjectInstance object) const;
85 PrivateData getPrivateData() const;
88 const ClassOptions* m_options;
91 explicit Options(const ClassOptions* options) : m_options(options)
93 assert(options && "Dont create empty options");
96 friend class JSObjectDeclaration;
100 typedef std::shared_ptr<Options> OptionsPtr;
104 explicit JSObjectDeclaration(js_entity_definition_ptr_t declaration);
106 virtual const std::string& getName() const
111 virtual const std::string& getParentName() const
116 virtual ConstClassTemplate getClassTemplate() const
118 return m_classTemplate;
121 virtual const std::string& getInterfaceName() const
123 return m_interfaceName;
126 virtual ConstructorCallback getConstructorCallback() const
128 return m_constructorCallback;
132 const OptionsPtr getOptions() const{
136 bool checkIframesSupported() const;
138 virtual ~JSObjectDeclaration();
142 std::string m_parentName;
143 std::string m_interfaceName;
144 ConstClassTemplate m_classTemplate;
145 ConstructorCallback m_constructorCallback;
146 OptionsPtr m_options;
149 typedef DPL::SharedPtr<JSObjectDeclaration> JSObjectDeclarationPtr;