35WebViewServicesManager::getWebViewHandlerPointer(
const std::string&
pluginId)
39 if (
it == handlersIdMap.end()) {
45 return it->second.get();
49WebViewServicesManager::registerComponentsLifeCycleManagers(PluginManager&
pluginManager)
59 JAMI_ERR(
"Attempting to register a webview handler with invalid pointer!");
67 handlersIdMap[id] = std::move(
ptr);
76 WebViewHandler*
ptr {(
static_cast<WebViewHandler*
>(data))};
80 JAMI_ERR(
"Attempting to unregister a webview handler with invalid pointer!");
88 handlersIdMap.erase(
id);
98WebViewServicesManager::registerWebViewService(PluginManager&
pluginManager)
101 auto pluginWebViewMessage = [](
const DLPlugin*
plugin,
void* data) {
103 auto* message =
static_cast<WebViewMessage*
>(data);
117 pluginManager.registerService(
"pluginWebViewMessage", pluginWebViewMessage);
122 const std::string& webViewId,
123 const std::string& messageId,
124 const std::string& payload)
127 handler->pluginWebViewMessage(webViewId, messageId, payload);
133 const std::string& accountId,
134 const std::string& webViewId,
135 const std::string&
action)
138 return handler->pluginWebViewAttach(accountId, webViewId,
action);
147 handler->pluginWebViewDetach(webViewId);
This class manages plugin (un)loading.
This is an abstract class (API) that needs to be implemented by a plugin.
void sendWebViewMessage(const std::string &pluginId, const std::string &webViewId, const std::string &messageId, const std::string &payload)
Transmits a message from the client's webview to the plugin.
WebViewServicesManager(PluginManager &pluginManager)
Registers the WebViewHandler services with the PluginManager, allows for loading/unloading,...
void sendWebViewDetach(const std::string &pluginId, const std::string &webViewId)
Transmits a detach event from the client's webview to the plugin.
std::string sendWebViewAttach(const std::string &pluginId, const std::string &accountId, const std::string &webViewId, const std::string &action)
Transmits an attach event from the client's webview to the plugin.
std::filesystem::path dataPath(const std::filesystem::path &pluginSoPath)
Returns data path given a plugin's library path.
void emitSignal(Args... args)
std::unique_ptr< WebViewHandler > WebViewHandlerPtr