2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file LocalMessagePortController.h
20 * @author Kisub Song (kisubs.song@samsung.com)
25 #ifndef _TIZEN_MESSAGE_PORT_LOCAL_MESSAGE_PORT_CONTROLLER_H_
26 #define _TIZEN_MESSAGE_PORT_LOCAL_MESSAGE_PORT_CONTROLLER_H_
28 #include <dpl/shared_ptr.h>
29 #include <Commons/EventReceiver.h>
30 #include <Commons/EventListener.h>
31 #include <CommonsJavaScript/PrivateObject.h>
32 #include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
33 #include <CommonsJavaScript/JSPendingOperation.h>
34 #include "ILocalMessagePort.h"
37 namespace MessagePort {
39 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<LocalMessagePortPtr,
40 WrtDeviceApis::CommonsJavaScript::NoOwnership> LocalMessagePortPrivObject;
42 typedef WrtDeviceApis::Commons::EventListener<EventLocalMessagePortListener> EventLocalMessagePortListenerListener;
44 class LocalMessagePortController :
45 public EventLocalMessagePortListenerListener,
46 public LocalMessagePortPrivObject
49 LocalMessagePortController(JSContextRef context,
50 LocalMessagePortPtr localMessagePort);
51 virtual ~LocalMessagePortController();
53 void onAnswerReceived(const EventLocalMessagePortListenerPtr &event);
56 typedef DPL::SharedPtr<LocalMessagePortController> LocalMessagePortControllerPtr;
59 class LocalMessagePortAsyncAnswerHandler
62 static void localMessagePortListener(const EventLocalMessagePortListenerPtr &event);
68 #endif // _TIZEN_MESSAGE_PORT_LOCAL_MESSAGE_PORT_CONTROLLER_H_