40WebViewServicesManager::getWebViewHandlerPointer(
const std::string&
pluginId)
44 if (
it == handlersIdMap.end()) {
50 return it->second.get();
54WebViewServicesManager::registerComponentsLifeCycleManagers(PluginManager&
pluginManager)
64 JAMI_ERR(
"Attempting to register a webview handler with invalid pointer!");
72 handlersIdMap[id] = std::move(
ptr);
81 WebViewHandler*
ptr {(
static_cast<WebViewHandler*
>(data))};
85 JAMI_ERR(
"Attempting to unregister a webview handler with invalid pointer!");
93 handlersIdMap.erase(
id);
99 pluginManager.registerComponentManager(
"WebViewHandlerManager",
105WebViewServicesManager::registerWebViewService(PluginManager&
pluginManager)
108 auto pluginWebViewMessage = [](
const DLPlugin*
plugin,
void* data) {
110 auto* message =
static_cast<WebViewMessage*
>(data);
124 pluginManager.registerService(
"pluginWebViewMessage", pluginWebViewMessage);
129 const std::string& webViewId,
130 const std::string& messageId,
131 const std::string& payload)
134 handler->pluginWebViewMessage(webViewId, messageId, payload);
140 const std::string& accountId,
141 const std::string& webViewId,
142 const std::string&
action)
145 return handler->pluginWebViewAttach(accountId, webViewId,
action);
154 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