2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file plugin_initializer.cpp
20 * @author Karol Majewski (k.majewski@samsung.com)
25 #include <Commons/plugin_initializer_def.h>
26 #include <Commons/WrtAccess/WrtAccess.h>
27 #include <TimeTracer.h>
28 #include "JSContactManager.h"
29 #include "JSContact.h"
30 #include "JSContactGroup.h"
31 #include "JSContactRef.h"
32 #include "JSContactName.h"
33 #include "JSContactOrganization.h"
34 #include "JSContactWebSite.h"
35 #include "JSContactAnniversary.h"
36 #include "JSContactAddress.h"
37 #include "JSContactPhoneNumber.h"
38 #include "JSContactEmailAddress.h"
39 #include "ContactAsyncCallbackManager.h"
40 #include "ContactListenerManager.h"
46 using namespace WrtDeviceApis;
47 using namespace WrtDeviceApis::Commons;
49 void on_widget_start_callback(int widgetId)
51 LoggerD("[Tizen\\contact] on_widget_start_callback (" << widgetId << ")");
55 WrtAccessSingleton::Instance().initialize(widgetId);
57 Catch(Commons::Exception)
59 LoggerE("WrtAccess initialization failed");
63 void on_widget_stop_callback(int widgetId)
65 LoggerD("[Tizen\\contact] on_widget_stop_callback (" << widgetId << ")");
66 TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Contact");
67 TIME_TRACER_RELEASE();
70 WrtAccessSingleton::Instance().deinitialize(widgetId);
72 Catch(Commons::Exception)
74 LoggerE("WrtAccess deinitialization failed");
78 void on_frame_load_callback(const void * context)
80 LoggerD("[Tizen\\contact] on_frame_load_callback (" << context << ")");
83 void on_frame_unload_callback(const void * context)
85 LoggerD("[Tizen\\contact] on_frame_unload_callback (" << context << ")");
87 DeviceAPI::Contact::ContactAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
88 DeviceAPI::Contact::ContactListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
91 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
92 PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
93 PLUGIN_ON_FRAME_LOAD(on_frame_load_callback)
94 PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback)
96 PLUGIN_CLASS_MAP_BEGIN
97 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
99 (js_class_template_getter)DeviceAPI::Contact::JSContactManager::getClassRef,
101 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
103 (js_class_template_getter)DeviceAPI::Contact::JSContact::getClassRef,
105 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
107 (js_class_template_getter)DeviceAPI::Contact::JSContactGroup::getClassRef,
109 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
111 (js_class_template_getter)DeviceAPI::Contact::JSContactRef::getClassRef,
113 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
115 (js_class_template_getter)DeviceAPI::Contact::JSContactName::getClassRef,
117 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
118 "ContactOrganization",
119 (js_class_template_getter)DeviceAPI::Contact::JSContactOrganization::getClassRef,
121 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
123 (js_class_template_getter)DeviceAPI::Contact::JSContactWebSite::getClassRef,
125 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
126 "ContactAnniversary",
127 (js_class_template_getter)DeviceAPI::Contact::JSContactAnniversary::getClassRef,
129 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
131 (js_class_template_getter)DeviceAPI::Contact::JSContactAddress::getClassRef,
133 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
134 "ContactPhoneNumber",
135 (js_class_template_getter)DeviceAPI::Contact::JSContactPhoneNumber::getClassRef,
137 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
138 "ContactEmailAddress",
139 (js_class_template_getter)DeviceAPI::Contact::JSContactEmailAddress::getClassRef,