mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
67 lines
2.2 KiB
Zig
67 lines
2.2 KiB
Zig
// Copyright (C) 2023-2024 Lightpanda (Selecy SAS)
|
|
//
|
|
// Francis Bouvier <francis@lightpanda.io>
|
|
// Pierre Tachoire <pierre@lightpanda.io>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
// License, or (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
const std = @import("std");
|
|
|
|
pub fn processMessage(cmd: anytype) !void {
|
|
const action = std.meta.stringToEnum(enum {
|
|
setEmulatedMedia,
|
|
setFocusEmulationEnabled,
|
|
setDeviceMetricsOverride,
|
|
setTouchEmulationEnabled,
|
|
}, cmd.input.action) orelse return error.UnknownMethod;
|
|
|
|
switch (action) {
|
|
.setEmulatedMedia => return setEmulatedMedia(cmd),
|
|
.setFocusEmulationEnabled => return setFocusEmulationEnabled(cmd),
|
|
.setDeviceMetricsOverride => return setDeviceMetricsOverride(cmd),
|
|
.setTouchEmulationEnabled => return setTouchEmulationEnabled(cmd),
|
|
}
|
|
}
|
|
|
|
// TODO: noop method
|
|
fn setEmulatedMedia(cmd: anytype) !void {
|
|
// const input = (try const incoming.params(struct {
|
|
// media: ?[]const u8 = null,
|
|
// features: ?[]struct{
|
|
// name: []const u8,
|
|
// value: [] const u8
|
|
// } = null,
|
|
// })) orelse return error.InvalidParams;
|
|
|
|
return cmd.sendResult(null, .{});
|
|
}
|
|
|
|
// TODO: noop method
|
|
fn setFocusEmulationEnabled(cmd: anytype) !void {
|
|
// const input = (try const incoming.params(struct {
|
|
// enabled: bool,
|
|
// })) orelse return error.InvalidParams;
|
|
return cmd.sendResult(null, .{});
|
|
}
|
|
|
|
// TODO: noop method
|
|
fn setDeviceMetricsOverride(cmd: anytype) !void {
|
|
return cmd.sendResult(null, .{});
|
|
}
|
|
|
|
// TODO: noop method
|
|
fn setTouchEmulationEnabled(cmd: anytype) !void {
|
|
return cmd.sendResult(null, .{});
|
|
}
|