Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Contact / ContactManagerController.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file        ContactManagerController.h
19  * @author      Kisub Song (kisubs.song@samsung.com)
20  * @version     0.1
21  * @brief
22  */
23
24 #ifndef _TIZEN_CONTACT_MANAGER_CONTROLLER_H_
25 #define _TIZEN_CONTACT_MANAGER_CONTROLLER_H_
26
27 #include <dpl/shared_ptr.h>
28 #include <CommonsJavaScript/PrivateObject.h>
29 #include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
30 #include <API/Contact/IContactManager.h>
31 #include <API/Contact/EventContactManagerGetAddressBooks.h>
32
33 namespace TizenApis {
34 namespace Tizen1_0 {
35 namespace Contact {
36
37 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<TizenApis::Api::Contact::IContactManagerPtr,
38                                WrtDeviceApis::CommonsJavaScript::NoOwnership> ContactManagerPrivObject;
39
40 typedef WrtDeviceApis::Commons::EventAnswerReceiver<TizenApis::Api::Contact::EventContactManagerGetAddressBooks> EventContactManagerGetAddressBooksAnswerReceiver;
41
42 class ContactManagerController :
43         public EventContactManagerGetAddressBooksAnswerReceiver,
44     public ContactManagerPrivObject
45 {
46 private:
47         ContactManagerController();
48
49 protected:
50         void     OnAnswerReceived(const TizenApis::Api::Contact::EventContactManagerGetAddressBooksPtr &event);
51
52 public:
53         ContactManagerController(JSContextRef context,
54                         TizenApis::Api::Contact::IContactManagerPtr contactManager);
55         virtual ~ContactManagerController();
56 };
57
58 typedef DPL::SharedPtr<ContactManagerController> ContactManagerControllerPtr;
59
60 class ContactManagerGetAddressBooksPendingOperation : public WrtDeviceApis::CommonsJavaScript::IJSPendingOperationPrivateObject
61 {
62 public:
63         ContactManagerGetAddressBooksPendingOperation(
64                         DPL::SharedPtr<WrtDeviceApis::Commons::IEventController> &event) :
65                 WrtDeviceApis::CommonsJavaScript::IJSPendingOperationPrivateObject(event)
66         {
67         }
68         virtual void handleCallingCallbacks();
69 };
70
71 //common part
72 class ContactManagerAsyncAnswerHandler
73 {
74 public:
75         static void getAddressBooks(const TizenApis::Api::Contact::EventContactManagerGetAddressBooksPtr &event);
76 };
77
78 } // Contact
79 } // Tizen1_0
80 } // TizenApis
81
82 #endif // _TIZEN_CONTACT_MANAGER_CONTROLLER_H_