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 JSAddressBookChangeCallbackManager.h
19 * @author Kisub Song (kisubs.song@samsung.com)
24 #ifndef _TIZEN_CONTACT_JS_ADDRESS_BOOK_CHANGE_CALLBACK_MANAGER_H_
25 #define _TIZEN_CONTACT_JS_ADDRESS_BOOK_CHANGE_CALLBACK_MANAGER_H_
27 #include <dpl/shared_ptr.h>
28 #include <Commons/IEvent.h>
29 #include <JavaScriptCore/JavaScript.h>
35 class JSAddressBookChangeCallbackManager;
36 typedef DPL::SharedPtr<JSAddressBookChangeCallbackManager> JSAddressBookChangeCallbackManagerPtr;
38 class JSAddressBookChangeCallbackManager : public WrtDeviceApis::Commons::IEventPrivateData
41 JSAddressBookChangeCallbackManager() {}
42 JSAddressBookChangeCallbackManager( JSContextRef context,
43 JSObjectRef onContactsAdded = NULL,
44 JSObjectRef onContactsUpdated = NULL,
45 JSObjectRef onContactsDeleted = NULL,
46 JSObjectRef onAddressBookReset = NULL,
47 JSObjectRef onError = NULL );
50 static JSAddressBookChangeCallbackManagerPtr createObject(JSContextRef context);
52 virtual ~JSAddressBookChangeCallbackManager();
54 void setContext( JSContextRef context );
55 JSContextRef getContext() const { return m_context; }
57 void setOnContactsAdded( JSValueRef onContactsAdded );
58 JSValueRef getOnContactsAdded() const;
59 void setOnContactsUpdated( JSValueRef onContactsUpdated );
60 JSValueRef getOnContactsUpdated() const;
61 void setOnContactsDeleted( JSValueRef onContactsDeleted );
62 JSValueRef getOnContactsDeleted() const;
63 void setOnAddressBookReset( JSValueRef onAddressBookReset );
64 JSValueRef getOnAddressBookReset() const;
65 void setOnError( JSValueRef onError );
66 JSValueRef getOnError() const;
67 void setObject( JSObjectRef object );
68 JSObjectRef getObject() const;
70 void callOnContactsAdded( JSValueRef contacts );
71 void callOnContactsUpdated( JSValueRef contacts );
72 void callOnContactsDeleted( JSValueRef contactIds );
73 void callOnAddressBookReset( );
74 void callOnError( JSValueRef error );
77 void makeCallback(JSContextRef context,
84 JSObjectRef m_onContactsAdded;
85 JSObjectRef m_onContactsUpdated;
86 JSObjectRef m_onContactsDeleted;
87 JSObjectRef m_onAddressBookReset;
88 JSObjectRef m_onError;
89 JSContextRef m_context;
97 #endif // _TIZEN_CONTACT_JS_ADDRESS_BOOK_CHANGE_CALLBACK_MANAGER_H_