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.
18 * @file plugin_initializer.cpp
19 * @author Karol Majewski (k.majewski@samsung.com)
24 #include <dpl/log/log.h>
26 #include <Commons/plugin_initializer_def.h>
27 #include <Commons/WrtAccess/WrtAccess.h>
28 #include "JSContactManager.h"
29 #include "JSContact.h"
30 #include "JSContactRef.h"
31 #include "JSContactName.h"
32 #include "JSContactOrganization.h"
33 #include "JSContactWebSite.h"
34 #include "JSContactAnniversary.h"
35 #include "JSContactAccount.h"
36 #include "JSContactAddress.h"
37 #include "JSContactPhoneNumber.h"
38 #include "JSContactEmailAddress.h"
39 #include "ContactAsyncCallbackManager.h"
40 #include "ContactListenerManager.h"
42 using namespace WrtDeviceApis;
43 using namespace WrtDeviceApis::Commons;
45 void on_widget_start_callback(int widgetId)
47 LogDebug("[Tizen\\contact] on_widget_start_callback (" << widgetId << ")");
50 WrtAccessSingleton::Instance().initialize(widgetId);
52 Catch(Commons::Exception)
54 LogError("WrtAccess initialization failed");
58 void on_widget_stop_callback(int widgetId)
60 LogDebug("[Tizen\\contact] on_widget_stop_callback (" << widgetId << ")");
63 WrtAccessSingleton::Instance().deinitialize(widgetId);
65 Catch(Commons::Exception)
67 LogError("WrtAccess deinitialization failed");
71 void on_frame_load_callback(const void * context)
73 LogDebug("[Tizen\\contact] on_frame_load_callback (" << context << ")");
76 void on_frame_unload_callback(const void * context)
78 LogDebug("[Tizen\\contact] on_frame_unload_callback (" << context << ")");
80 TizenApis::Tizen1_0::Contact::ContactAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
81 TizenApis::Tizen1_0::Contact::ContactListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
84 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
85 PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
86 PLUGIN_ON_FRAME_LOAD(on_frame_load_callback)
87 PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback)
89 PLUGIN_CLASS_MAP_BEGIN
90 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
92 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactManager::getClassRef,
94 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
96 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContact::getClassRef,
98 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
100 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactRef::getClassRef,
102 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
104 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactName::getClassRef,
106 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
107 "ContactOrganization",
108 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactOrganization::getClassRef,
110 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
112 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactWebSite::getClassRef,
114 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
115 "ContactAnniversary",
116 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactAnniversary::getClassRef,
118 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
120 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactAccount::getClassRef,
122 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
124 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactAddress::getClassRef,
126 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
127 "ContactPhoneNumber",
128 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactPhoneNumber::getClassRef,
130 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
131 "ContactEmailAddress",
132 (js_class_template_getter)TizenApis::Tizen1_0::Contact::JSContactEmailAddress::getClassRef,