upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Messaging / plugin_initializer.cpp
index 1d88089..14ddd0a 100755 (executable)
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
-* limitations under the License. 
+* limitations under the License.
 */
 
 #include <dpl/log/log.h>
 #include <Commons/plugin_initializer_def.h>
+#include <Commons/WrtAccess/WrtAccess.h>
 #include "JSMessagingServiceManager.h"
 #include "JSMessagingStorage.h"
 #include "JSMessage.h"
 #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
 #define OBJECT_MESSAGING ".messaging"
 
+using namespace WrtDeviceApis;
+using namespace WrtDeviceApis::Commons;
 
-void on_widget_start_callback(int widgetId, JavaScriptContext context, const engine_interface_t *interface) {
+void on_widget_start_callback(int widgetId) {
        LogDebug("[Tizen\\MessagingServiceManager] on_widget_start_callback ("<<widgetId<<")");
+    Try {
+        WrtAccessSingleton::Instance().initialize(widgetId);
+    } Catch(Commons::Exception) {
+        LogError("WrtAccess initialization failed");
+    }
 }
 
 void on_widget_stop_callback(int widgetId) {
        LogDebug("[Tizen\\MessagingServiceManager] on_widget_stop_callback ("<<widgetId<<")");
+    Try {
+        WrtAccessSingleton::Instance().deinitialize(widgetId);
+    } Catch(Commons::Exception) {
+        LogError("WrtAccess deinitialization failed");
+    }
 }
 
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
@@ -42,14 +55,7 @@ PLUGIN_CLASS_MAP_BEGIN
                "messaging",
                TizenApis::Tizen1_0::JSMessagingServiceManager::getClassRef(),
                NULL)
-#if 1
        PLUGIN_CLASS_MAP_ADD_CLASS(
-               WRT_JS_EXTENSION_OBJECT_TIZEN OBJECT_MESSAGING,
-               "messagingStorage",
-               TizenApis::Tizen1_0::JSMessagingStorage::getClassRef(),
-               NULL)
-#endif
-     PLUGIN_CLASS_MAP_ADD_CLASS(
                WRT_JS_EXTENSION_OBJECT_TIZEN,
                "Message",
                TizenApis::Tizen1_0::JSMessage::getClassRef(),