diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-05-02 04:39:36 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-02 08:11:38 +0200 |
commit | 7cf2839a262a38e00f110bee1102020c658ac476 (patch) | |
tree | a94b0916c48de61beb76171d85f6c113903090dd /Userland/Services/LaunchServer/ClientConnection.cpp | |
parent | 1a015dc379b81cde5a7ee1518f4704320ed736a2 (diff) | |
download | serenity-7cf2839a262a38e00f110bee1102020c658ac476.zip |
Userland: Get rid of the OwnPtr<...> boilerplate code for IPC handlers
Diffstat (limited to 'Userland/Services/LaunchServer/ClientConnection.cpp')
-rw-r--r-- | Userland/Services/LaunchServer/ClientConnection.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/Userland/Services/LaunchServer/ClientConnection.cpp b/Userland/Services/LaunchServer/ClientConnection.cpp index 07ecdc764f..c5ab40e6dd 100644 --- a/Userland/Services/LaunchServer/ClientConnection.cpp +++ b/Userland/Services/LaunchServer/ClientConnection.cpp @@ -28,12 +28,12 @@ void ClientConnection::die() s_connections.remove(client_id()); } -OwnPtr<Messages::LaunchServer::GreetResponse> ClientConnection::handle(const Messages::LaunchServer::Greet&) +Messages::LaunchServer::GreetResponse ClientConnection::handle(const Messages::LaunchServer::Greet&) { - return make<Messages::LaunchServer::GreetResponse>(); + return {}; } -OwnPtr<Messages::LaunchServer::OpenURLResponse> ClientConnection::handle(const Messages::LaunchServer::OpenURL& request) +Messages::LaunchServer::OpenURLResponse ClientConnection::handle(const Messages::LaunchServer::OpenURL& request) { if (!m_allowlist.is_empty()) { bool allowed = false; @@ -47,30 +47,27 @@ OwnPtr<Messages::LaunchServer::OpenURLResponse> ClientConnection::handle(const M if (!allowed) { // You are not on the list, go home! did_misbehave(String::formatted("Client requested a combination of handler/URL that was not on the list: '{}' with '{}'", request.handler_name(), request.url()).characters()); - return {}; + return nullptr; } } URL url(request.url()); - auto result = Launcher::the().open_url(url, request.handler_name()); - return make<Messages::LaunchServer::OpenURLResponse>(result); + return Launcher::the().open_url(url, request.handler_name()); } -OwnPtr<Messages::LaunchServer::GetHandlersForURLResponse> ClientConnection::handle(const Messages::LaunchServer::GetHandlersForURL& request) +Messages::LaunchServer::GetHandlersForURLResponse ClientConnection::handle(const Messages::LaunchServer::GetHandlersForURL& request) { URL url(request.url()); - auto result = Launcher::the().handlers_for_url(url); - return make<Messages::LaunchServer::GetHandlersForURLResponse>(result); + return Launcher::the().handlers_for_url(url); } -OwnPtr<Messages::LaunchServer::GetHandlersWithDetailsForURLResponse> ClientConnection::handle(const Messages::LaunchServer::GetHandlersWithDetailsForURL& request) +Messages::LaunchServer::GetHandlersWithDetailsForURLResponse ClientConnection::handle(const Messages::LaunchServer::GetHandlersWithDetailsForURL& request) { URL url(request.url()); - auto result = Launcher::the().handlers_with_details_for_url(url); - return make<Messages::LaunchServer::GetHandlersWithDetailsForURLResponse>(result); + return Launcher::the().handlers_with_details_for_url(url); } -OwnPtr<Messages::LaunchServer::AddAllowedURLResponse> ClientConnection::handle(const Messages::LaunchServer::AddAllowedURL& request) +Messages::LaunchServer::AddAllowedURLResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedURL& request) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -84,10 +81,10 @@ OwnPtr<Messages::LaunchServer::AddAllowedURLResponse> ClientConnection::handle(c m_allowlist.empend(String(), false, Vector<URL> { request.url() }); - return make<Messages::LaunchServer::AddAllowedURLResponse>(); + return {}; } -OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse> ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithAnyURL& request) +Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithAnyURL& request) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -101,10 +98,10 @@ OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse> ClientConnec m_allowlist.empend(request.handler_name(), true, Vector<URL>()); - return make<Messages::LaunchServer::AddAllowedHandlerWithAnyURLResponse>(); + return {}; } -OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse> ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs& request) +Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse ClientConnection::handle(const Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLs& request) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -123,17 +120,17 @@ OwnPtr<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse> Cl m_allowlist.empend(request.handler_name(), false, request.urls()); - return make<Messages::LaunchServer::AddAllowedHandlerWithOnlySpecificURLsResponse>(); + return {}; } -OwnPtr<Messages::LaunchServer::SealAllowlistResponse> ClientConnection::handle(const Messages::LaunchServer::SealAllowlist&) +Messages::LaunchServer::SealAllowlistResponse ClientConnection::handle(const Messages::LaunchServer::SealAllowlist&) { if (m_allowlist_is_sealed) { did_misbehave("Got more than one request to seal the allowed handlers list"); return {}; } - return make<Messages::LaunchServer::SealAllowlistResponse>(); + return {}; } } |