tizen 2.4 release
[framework/web/wrt-plugins-common.git] / src / xwalk-module / XW_Extension_SyncMessage.h
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_SYNCMESSAGE_H_
6 #define XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_SYNCMESSAGE_H_
7
8 // NOTE: This file and interfaces marked as internal are not considered stable
9 // and can be modified in incompatible ways between Crosswalk versions.
10
11 #ifndef XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_H_
12 #error "You should include XW_Extension.h before this file"
13 #endif
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 //
20 // XW_INTERNAL_SYNC_MESSAGING_INTERFACE: allow JavaScript code to send a
21 // synchronous message to extension code and block until response is
22 // available. The response is made available by calling the SetSyncReply
23 // function, that can be done from outside the context of the SyncMessage
24 // handler.
25 //
26
27 #define XW_INTERNAL_SYNC_MESSAGING_INTERFACE_1 \
28   "XW_InternalSyncMessagingInterface_1"
29 #define XW_INTERNAL_SYNC_MESSAGING_INTERFACE \
30   XW_INTERNAL_SYNC_MESSAGING_INTERFACE_1
31
32 typedef void (*XW_HandleSyncMessageCallback)(XW_Instance instance,
33                                              const char* message);
34
35 struct XW_Internal_SyncMessagingInterface_1 {
36   void (*Register)(XW_Extension extension,
37                    XW_HandleSyncMessageCallback handle_sync_message);
38   void (*SetSyncReply)(XW_Instance instance, const char* reply);
39 };
40
41 typedef struct XW_Internal_SyncMessagingInterface_1
42     XW_Internal_SyncMessagingInterface;
43
44 #ifdef __cplusplus
45 }  // extern "C"
46 #endif
47
48 #endif  // XWALK_EXTENSIONS_PUBLIC_XW_EXTENSION_SYNCMESSAGE_H_