summaryrefslogtreecommitdiff
path: root/mobile_src/Contact/JSAddressBookChangeCallbackManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'mobile_src/Contact/JSAddressBookChangeCallbackManager.h')
-rw-r--r--mobile_src/Contact/JSAddressBookChangeCallbackManager.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/mobile_src/Contact/JSAddressBookChangeCallbackManager.h b/mobile_src/Contact/JSAddressBookChangeCallbackManager.h
new file mode 100644
index 0000000..b6be4e0
--- /dev/null
+++ b/mobile_src/Contact/JSAddressBookChangeCallbackManager.h
@@ -0,0 +1,90 @@
+//
+// Tizen Web Device API
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// 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.
+//
+
+/**
+ * @file JSAddressBookChangeCallbackManager.h
+ * @version 0.1
+ * @brief
+ */
+
+#ifndef _TIZEN_CONTACT_JS_ADDRESS_BOOK_CHANGE_CALLBACK_MANAGER_H_
+#define _TIZEN_CONTACT_JS_ADDRESS_BOOK_CHANGE_CALLBACK_MANAGER_H_
+
+#include <dpl/shared_ptr.h>
+#include <Commons/IEvent.h>
+#include <JavaScriptCore/JavaScript.h>
+
+namespace DeviceAPI {
+namespace Contact {
+
+class JSAddressBookChangeCallbackManager;
+typedef DPL::SharedPtr<JSAddressBookChangeCallbackManager> JSAddressBookChangeCallbackManagerPtr;
+
+class JSAddressBookChangeCallbackManager : public WrtDeviceApis::Commons::IEventPrivateData
+{
+private:
+ JSAddressBookChangeCallbackManager() {}
+ JSAddressBookChangeCallbackManager( JSContextRef context,
+ JSObjectRef onContactsAdded = NULL,
+ JSObjectRef onContactsUpdated = NULL,
+ JSObjectRef onContactsDeleted = NULL,
+ JSObjectRef onError = NULL );
+
+public:
+ static JSAddressBookChangeCallbackManagerPtr createObject(JSContextRef context);
+
+ virtual ~JSAddressBookChangeCallbackManager();
+
+ void setContext( JSContextRef context );
+ JSContextRef getContext() const { return m_context; }
+
+ void setOnContactsAdded( JSValueRef onContactsAdded );
+ JSValueRef getOnContactsAdded() const;
+ void setOnContactsUpdated( JSValueRef onContactsUpdated );
+ JSValueRef getOnContactsUpdated() const;
+ void setOnContactsDeleted( JSValueRef onContactsDeleted );
+ JSValueRef getOnContactsDeleted() const;
+ void setOnError( JSValueRef onError );
+ JSValueRef getOnError() const;
+ void setObject( JSObjectRef object );
+ JSObjectRef getObject() const;
+
+ void callOnContactsAdded( JSValueRef contacts );
+ void callOnContactsUpdated( JSValueRef contacts );
+ void callOnContactsDeleted( JSValueRef contactIds );
+ void callOnError( JSValueRef error );
+
+private:
+ void makeCallback(JSContextRef context,
+ JSObjectRef object,
+ JSObjectRef callback,
+ const char *szName,
+ JSValueRef argv[],
+ unsigned argc);
+
+ JSObjectRef m_onContactsAdded;
+ JSObjectRef m_onContactsUpdated;
+ JSObjectRef m_onContactsDeleted;
+ JSObjectRef m_onError;
+ JSContextRef m_context;
+ JSObjectRef m_object;
+};
+
+} // Contact
+} // DeviceAPI
+
+#endif // _TIZEN_CONTACT_JS_ADDRESS_BOOK_CHANGE_CALLBACK_MANAGER_H_