browser_window/core/
cookie.rs1#[cfg(not(feature = "webkitgtk"))]
2mod c;
3#[cfg(feature = "webkitgtk")]
4mod unsupported;
5
6use std::{borrow::Cow, error::Error, fmt, time::SystemTime};
7
8#[cfg(not(feature = "webkitgtk"))]
9pub use c::*;
10#[cfg(feature = "webkitgtk")]
11pub use unsupported::*;
12
13pub type CookieStorageCallbackFn =
14 unsafe fn(cj: CookieJarImpl, data: *mut (), Result<(), CookieStorageError>);
15pub type CookieDeleteCallbackFn = unsafe fn(cj: CookieJarImpl, data: *mut (), deleted: usize);
16pub type CookieIteratorNextCallbackFn =
17 unsafe fn(cj: CookieIteratorImpl, data: *mut (), Option<CookieImpl>);
18
19pub trait CookieExt {
20 fn new(_name: &str, _value: &str) -> CookieImpl {
21 unimplemented!();
22 }
23
24 fn creation_time(&self) -> SystemTime {
25 unimplemented!();
26 }
27 fn expires(&self) -> Option<SystemTime> {
28 unimplemented!();
29 }
30 fn domain<'a>(&'a self) -> Cow<'a, str> {
31 unimplemented!();
32 }
33 fn free(&mut self) {}
34 fn is_http_only(&self) -> bool {
35 unimplemented!();
36 }
37 fn name<'a>(&'a self) -> Cow<'a, str> {
38 unimplemented!();
39 }
40 fn path<'a>(&'a self) -> Cow<'a, str> {
41 unimplemented!();
42 }
43 fn is_secure(&self) -> bool {
44 unimplemented!();
45 }
46 fn value<'a>(&'a self) -> Cow<'a, str> {
47 unimplemented!();
48 }
49
50 fn make_http_only(&mut self) {
51 unimplemented!();
52 }
53 fn make_secure(&mut self) {
54 unimplemented!();
55 }
56 fn set_creation_time(&mut self, _time: &SystemTime) {
57 unimplemented!();
58 }
59 fn set_expires(&mut self, _time: &SystemTime) {
60 unimplemented!();
61 }
62 fn set_domain(&mut self, _domain: &str) {
63 unimplemented!();
64 }
65 fn set_name(&mut self, _name: &str) {
66 unimplemented!();
67 }
68 fn set_path(&mut self, _path: &str) {
69 unimplemented!();
70 }
71 fn set_value(&mut self, _value: &str) {
72 unimplemented!();
73 }
74}
75
76pub trait CookieJarExt {
77 fn delete(
78 &mut self, _url: &str, _name: &str, _complete_cb: CookieDeleteCallbackFn, _cb_data: *mut (),
79 ) {
80 unimplemented!();
81 }
82 fn free(&mut self) {}
83 fn global() -> Option<CookieJarImpl> { None }
84 fn iterator<'a>(&'a self, _url: &str, _include_http_only: bool) -> CookieIteratorImpl {
85 unimplemented!();
86 }
87 fn iterator_all<'a>(&'a self) -> CookieIteratorImpl {
88 unimplemented!();
89 }
90 fn store(
91 &mut self, _url: &str, _cookie: &CookieImpl, _success_cb: Option<CookieStorageCallbackFn>,
92 _cb_data: *mut (),
93 ) {
94 unimplemented!();
95 }
96}
97
98pub trait CookieIteratorExt {
99 fn free(&mut self) {}
100 fn next(&mut self, _on_next: CookieIteratorNextCallbackFn, _cb_data: *mut ()) -> bool {
101 unimplemented!();
102 }
103}
104
105#[derive(Debug)]
106pub enum CookieStorageError {
107 Unknown,
108}
109
110impl fmt::Display for CookieStorageError {
111 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
112 write!(f, "unable to set cookie (url invalid?)")
113 }
114}
115
116impl Error for CookieStorageError {
117 fn source(&self) -> Option<&(dyn Error + 'static)> { None }
118}