WebUserContentControllerProxy.h [plain text]
#ifndef WebUserContentControllerProxy_h
#define WebUserContentControllerProxy_h
#include "MessageReceiver.h"
#include <wtf/Forward.h>
#include <wtf/HashCountedSet.h>
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace IPC {
class DataReference;
}
namespace WebCore {
class UserScript;
class UserStyleSheet;
}
namespace WebKit {
class WebProcessProxy;
class WebScriptMessageHandler;
class WebUserContentControllerProxy : public RefCounted<WebUserContentControllerProxy>, private IPC::MessageReceiver {
public:
static PassRefPtr<WebUserContentControllerProxy> create();
~WebUserContentControllerProxy();
uint64_t identifier() const { return m_identifier; }
void addProcess(WebProcessProxy&);
void removeProcess(WebProcessProxy&);
void addUserScript(WebCore::UserScript);
void removeAllUserScripts();
void addUserStyleSheet(WebCore::UserStyleSheet);
void removeAllUserStyleSheets();
bool addUserScriptMessageHandler(WebScriptMessageHandler*);
void removeUserMessageHandlerForName(const String&);
private:
explicit WebUserContentControllerProxy();
virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
void didPostMessage(IPC::Connection*, uint64_t pageID, uint64_t frameID, uint64_t messageHandlerID, const IPC::DataReference&);
uint64_t m_identifier;
HashCountedSet<WebProcessProxy*> m_processes;
Vector<WebCore::UserScript> m_userScripts;
Vector<WebCore::UserStyleSheet> m_userStyleSheets;
HashMap<uint64_t, RefPtr<WebScriptMessageHandler>> m_scriptMessageHandlers;
};
}
#endif // WebUserContentControllerProxy_h