X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fplugins-ipc-message%2Fipc_message_support.h;h=d2c5384f5ed6b7525d6044470ee783937683eace;hb=135c918861ce17baec8a12727e76b569be97cecd;hp=fa96e3faa4a434238ce5c30e3c5cc4bf08906ea6;hpb=d1c0ceec58a5ffb0fd21bd93992776afbc4ff341;p=platform%2Fframework%2Fweb%2Fwrt-plugins-common.git diff --git a/src/plugins-ipc-message/ipc_message_support.h b/src/plugins-ipc-message/ipc_message_support.h index fa96e3f..d2c5384 100644 --- a/src/plugins-ipc-message/ipc_message_support.h +++ b/src/plugins-ipc-message/ipc_message_support.h @@ -22,13 +22,59 @@ #ifndef WRT_SRC_IPC_MESSAGE_SUPPORT #define WRT_SRC_IPC_MESSAGE_SUPPORT +#include +#include #include #include +#include + +typedef void (*AsyncReplyCallback)(unsigned int, void*, const char*); namespace IPCMessageSupport { + +static const char * const REPLY_ASYNC = "ToInjectedBundle::REPLY_ASYNC"; +static const char * const TIZEN_CHANGE_USERAGENT = "tizen://changeUA"; +static const char * const TIZEN_DELETE_ALL_COOKIES = "tizen://deleteAllCookies"; + +class AsyncConnection +{ + public: + AsyncReplyCallback replyCallback; + void* data; + + AsyncConnection(AsyncReplyCallback r, void* d) : + replyCallback(r), + data(d) + { + } +}; + +typedef std::shared_ptr AsyncConnectionPtr; +typedef std::map AsyncConnectionMap; + +class AsyncConnectionManager +{ + private: + AsyncConnectionMap m_connectionMap; + + public: + ~AsyncConnectionManager(); + + // Singleton + static AsyncConnectionManager &instance(); + + int addConnection(AsyncConnectionPtr connection); + bool removeConnection(int handle); + AsyncConnectionPtr getConnection(int handle); + +}; + void setWKBundleRef(WKBundleRef bundleRef); void setXwindowHandle(unsigned int handle); const char* sendMessageToUiProcess(const char* name, const char* body); +int sendAsyncMessageToUiProcess(const char* name, const char* body, AsyncReplyCallback replyCallback, void* data); +void* ignoreAsyncMessageReply(int handle); +void replyAsyncMessageToWebProcess(Ewk_Context* ewkContext, int handle, const char* body); } #endif // WRT_SRC_IPC_MESSAGE_SUPPORT \ No newline at end of file