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_function_manager.cpp
18 * @author Grzegorz Krawczyk (g.krawczyk@samgsung.com)
19 * @author Yunchan Cho (yunchan.cho@samgsung.com)
24 #include <dpl/singleton_safe_impl.h>
25 #include <js_function_manager.h>
26 #include <js_overlay_functions.h>
27 #include <wrt_plugin_export.h>
29 IMPLEMENT_SAFE_SINGLETON(JsFunctionManager)
32 const char* JSPRINT_NAME = "jsPrint";
33 const char* JSGLOBAL_OBJECT = "GLOBAL_OBJECT";
34 const char* JSHOOK_NAME = "jsHook";
37 namespace JavaScriptFunctions {
39 class_definition_options_t jsHookfunctionsOptions = {
43 USE_OVERLAYED, //ignored
46 reinterpret_cast<js_function_impl>(JSCFunctions::JavaScriptHookProc)
49 class_definition_options_t jsPrintfunctionsOptions = {
53 USE_OVERLAYED, //ignored
56 reinterpret_cast<js_function_impl>(JSCFunctions::JavaScriptPrintProc)
59 js_entity_definition_t jsPrint = {
65 &jsPrintfunctionsOptions
68 js_entity_definition_t jsHook = {
74 &jsHookfunctionsOptions
77 const js_entity_definition_ptr_t jsPrintPtr = &jsPrint;
78 const js_entity_definition_ptr_t jsHookPtr = &jsHook;
81 bool JsFunctionManager::initialize()
83 LogInfo("JSObjectDeclaration for js functions are intialized");
84 JSObjectDeclarationPtr jsPrintObj(
85 new JSObjectDeclaration(JavaScriptFunctions::jsPrintPtr));
87 JSObjectDeclarationPtr jsHookObj(
88 new JSObjectDeclaration(JavaScriptFunctions::jsHookPtr));
90 m_functions.push_back(jsPrintObj);
91 m_functions.push_back(jsHookObj);
96 JsFunctionManager::Functions JsFunctionManager::getFunctions()
98 LogInfo("get standard js fucntions");
99 static bool initialized = initialize();