1#![allow(non_upper_case_globals)]
3
4use cbf_chrome_sys::ffi::{
5 CbfStopFindAction_kCbfStopFindActionActivateSelection,
6 CbfStopFindAction_kCbfStopFindActionClearSelection,
7 CbfStopFindAction_kCbfStopFindActionKeepSelection,
8};
9
10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum ChromeStopFindAction {
13 ClearSelection,
14 KeepSelection,
15 ActivateSelection,
16}
17
18impl ChromeStopFindAction {
19 pub(crate) fn to_ffi(self) -> u8 {
20 (match self {
21 Self::ClearSelection => CbfStopFindAction_kCbfStopFindActionClearSelection,
22 Self::KeepSelection => CbfStopFindAction_kCbfStopFindActionKeepSelection,
23 Self::ActivateSelection => CbfStopFindAction_kCbfStopFindActionActivateSelection,
24 }) as u8
25 }
26}
27
28#[derive(Debug, Clone, PartialEq, Eq)]
30pub struct ChromeFindInPageOptions {
31 pub query: String,
32 pub forward: bool,
33 pub match_case: bool,
34 pub new_session: bool,
35 pub find_match: bool,
36}
37
38impl ChromeFindInPageOptions {
39 pub fn new(query: impl Into<String>) -> Self {
40 Self {
41 query: query.into(),
42 forward: true,
43 match_case: false,
44 new_session: true,
45 find_match: true,
46 }
47 }
48}
49
50#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
52pub struct ChromeFindRect {
53 pub x: i32,
54 pub y: i32,
55 pub width: i32,
56 pub height: i32,
57}