Ring Daemon 16.0.0
Loading...
Searching...
No Matches
webviewservicesmanager.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18// adapted from ChatServicesManager
19
20#pragma once
21
22#include "noncopyable.h"
23#include "webviewhandler.h"
24#include <list>
25#include <memory>
26#include <map>
27#include <mutex>
28#include <vector>
29#include <string>
30
31namespace jami {
32
33class PluginManager;
34
35using WebViewHandlerPtr = std::unique_ptr<WebViewHandler>;
36
42{
43public:
50
52
60 void sendWebViewMessage(const std::string& pluginId,
61 const std::string& webViewId,
62 const std::string& messageId,
63 const std::string& payload);
64
73 std::string sendWebViewAttach(const std::string& pluginId,
74 const std::string& accountId,
75 const std::string& webViewId,
76 const std::string& action);
77
83 void sendWebViewDetach(const std::string& pluginId, const std::string& webViewId);
84
85private:
90 void registerComponentsLifeCycleManagers(PluginManager& pluginManager);
91
96 void registerWebViewService(PluginManager& pluginManager);
97
102 WebViewHandler* getWebViewHandlerPointer(const std::string& pluginId);
103
107 std::map<std::string, WebViewHandlerPtr> handlersIdMap {};
108};
109} // namespace jami
This class manages plugin (un)loading.
This is an abstract class (API) that needs to be implemented by a plugin.
This class provides the interface between loaded WebViewHandlers and client webviews.
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.
void sendWebViewDetach(const std::string &pluginId, const std::string &webViewId)
Transmits a detach event from the client's webview to the plugin.
NON_COPYABLE(WebViewServicesManager)
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.
void emitSignal(Args... args)
Definition ring_signal.h:64
std::unique_ptr< WebViewHandler > WebViewHandlerPtr
Simple macro to hide class' copy constructor and assignment operator.