#ifndef JCEF_REMOTECLIENT_H #define JCEF_REMOTECLIENT_H #include #include #include #include #include "include/internal/cef_ptr.h" class RemoteMessageRouter; class MessageRoutersManager; class CefRequestContext; namespace thrift_codegen { class RObject; } class RemoteBrowser; class CefBrowser; class ServerHandlerContext; class RemoteClientHandler; class RemoteClient { public: explicit RemoteClient(int cid, CefRefPtr handler); ~RemoteClient(); int getCid() const { return myCid; } void addHandlers(int handlersMask); void removeHandlers(int handlersMask); void addMessageRouter(std::shared_ptr router); void removeMessageRouter(std::shared_ptr router); std::shared_ptr createBrowser(std::shared_ptr owner, std::shared_ptr ctx, const thrift_codegen::RObject &requestContextHandler); void close(); static std::shared_ptr findByBid(int bid); static int genNewCid(); std::string getDebugInfo(int tabs); private: const int myCid; const CefRefPtr myRemoteClientHandler; std::mutex myMutex; std::map> myBrowsers; friend class RemoteBrowser; void eraseBrowser(int bid); static std::atomic sNextCid; }; #endif //JCEF_REMOTECLIENT_H