Skip to content

Commit c30de2b

Browse files
authored
Merge pull request #1224 from lightpanda-io/accessibility-domain
cdp: add accessibility domain
2 parents 5e43f76 + cf7bddd commit c30de2b

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/cdp/cdp.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ pub fn CDPT(comptime TypeProvider: type) type {
230230
asUint(u88, "Performance") => return @import("domains/performance.zig").processMessage(command),
231231
else => {},
232232
},
233+
13 => switch (@as(u104, @bitCast(domain[0..13].*))) {
234+
asUint(u104, "Accessibility") => return @import("domains/accessibility.zig").processMessage(command),
235+
else => {},
236+
},
237+
233238
else => {},
234239
}
235240

src/cdp/domains/accessibility.zig

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (C) 2023-2024 Lightpanda (Selecy SAS)
2+
//
3+
// Francis Bouvier <francis@lightpanda.io>
4+
// Pierre Tachoire <pierre@lightpanda.io>
5+
//
6+
// This program is free software: you can redistribute it and/or modify
7+
// it under the terms of the GNU Affero General Public License as
8+
// published by the Free Software Foundation, either version 3 of the
9+
// License, or (at your option) any later version.
10+
//
11+
// This program is distributed in the hope that it will be useful,
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU Affero General Public License for more details.
15+
//
16+
// You should have received a copy of the GNU Affero General Public License
17+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
19+
const std = @import("std");
20+
21+
pub fn processMessage(cmd: anytype) !void {
22+
const action = std.meta.stringToEnum(enum {
23+
enable,
24+
disable,
25+
}, cmd.input.action) orelse return error.UnknownMethod;
26+
27+
switch (action) {
28+
.enable => return enable(cmd),
29+
.disable => return disable(cmd),
30+
}
31+
}
32+
fn enable(cmd: anytype) !void {
33+
return cmd.sendResult(null, .{});
34+
}
35+
36+
fn disable(cmd: anytype) !void {
37+
return cmd.sendResult(null, .{});
38+
}

0 commit comments

Comments
 (0)