1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-17 17:52:24 +00:00
serenity/Userland/Services/SpiceAgent/ClipboardServerConnection.h
Ben Wiederhake 4e55d649d7 Services: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00

34 lines
918 B
C++

/*
* Copyright (c) 2021, Kyle Pereira <kyle@xylepereira.me>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Function.h>
#include <Clipboard/ClipboardClientEndpoint.h>
#include <Clipboard/ClipboardServerEndpoint.h>
#include <LibGfx/Bitmap.h>
#include <LibIPC/ServerConnection.h>
#pragma once
class ClipboardServerConnection final
: public IPC::ServerConnection<ClipboardClientEndpoint, ClipboardServerEndpoint>
, public ClipboardClientEndpoint {
C_OBJECT(ClipboardServerConnection);
public:
Function<void()> on_data_changed;
RefPtr<Gfx::Bitmap> get_bitmap();
void set_bitmap(Gfx::Bitmap const& bitmap);
private:
ClipboardServerConnection()
: IPC::ServerConnection<ClipboardClientEndpoint, ClipboardServerEndpoint>(*this, "/tmp/portal/clipboard")
{
}
virtual void clipboard_data_changed(String const&) override
{
on_data_changed();
}
};