| 1 | //go:build windows |
| 2 | |
| 3 | package edge |
| 4 | |
| 5 | import ( |
| 6 | "unsafe" |
| 7 | |
| 8 | "golang.org/x/sys/windows" |
| 9 | ) |
| 10 | |
| 11 | type _ICoreWebView2SettingsVtbl struct { |
| 12 | _IUnknownVtbl |
| 13 | GetIsScriptEnabled ComProc |
| 14 | PutIsScriptEnabled ComProc |
| 15 | GetIsWebMessageEnabled ComProc |
| 16 | PutIsWebMessageEnabled ComProc |
| 17 | GetAreDefaultScriptDialogsEnabled ComProc |
| 18 | PutAreDefaultScriptDialogsEnabled ComProc |
| 19 | GetIsStatusBarEnabled ComProc |
| 20 | PutIsStatusBarEnabled ComProc |
| 21 | GetAreDevToolsEnabled ComProc |
| 22 | PutAreDevToolsEnabled ComProc |
| 23 | GetAreDefaultContextMenusEnabled ComProc |
| 24 | PutAreDefaultContextMenusEnabled ComProc |
| 25 | GetAreHostObjectsAllowed ComProc |
| 26 | PutAreHostObjectsAllowed ComProc |
| 27 | GetIsZoomControlEnabled ComProc |
| 28 | PutIsZoomControlEnabled ComProc |
| 29 | GetIsBuiltInErrorPageEnabled ComProc |
| 30 | PutIsBuiltInErrorPageEnabled ComProc |
| 31 | } |
| 32 | |
| 33 | type ICoreWebView2Settings struct { |
| 34 | vtbl *_ICoreWebView2SettingsVtbl |
| 35 | } |
| 36 | |
| 37 | func (i *ICoreWebView2Settings) AddRef() uintptr { |
| 38 | ret, _, _ := i.vtbl.AddRef.Call(uintptr(unsafe.Pointer(i))) |
| 39 | |
| 40 | return ret |
| 41 | } |
| 42 | |
| 43 | func (i *ICoreWebView2Settings) GetIsScriptEnabled() (bool, error) { |
| 44 | |
| 45 | var isScriptEnabled bool |
| 46 | hr, _, _ := i.vtbl.GetIsScriptEnabled.Call( |
| 47 | uintptr(unsafe.Pointer(i)), |
| 48 | uintptr(unsafe.Pointer(&isScriptEnabled)), |
| 49 | ) |
| 50 | if windows.Handle(hr) != windows.S_OK { |
| 51 | return false, windows.Errno(hr) |
| 52 | } |
| 53 | return isScriptEnabled, nil |
| 54 | } |
| 55 | |
| 56 | func (i *ICoreWebView2Settings) PutIsScriptEnabled(isScriptEnabled bool) error { |
| 57 | |
| 58 | hr, _, _ := i.vtbl.PutIsScriptEnabled.Call( |
| 59 | uintptr(unsafe.Pointer(i)), |
| 60 | uintptr(boolToInt(isScriptEnabled)), |
| 61 | ) |
| 62 | if windows.Handle(hr) != windows.S_OK { |
| 63 | return windows.Errno(hr) |
| 64 | } |
| 65 | return nil |
| 66 | } |
| 67 | |
| 68 | func (i *ICoreWebView2Settings) GetIsWebMessageEnabled() (bool, error) { |
| 69 | |
| 70 | var isWebMessageEnabled bool |
| 71 | hr, _, _ := i.vtbl.GetIsWebMessageEnabled.Call( |
| 72 | uintptr(unsafe.Pointer(i)), |
| 73 | uintptr(unsafe.Pointer(&isWebMessageEnabled)), |
| 74 | ) |
| 75 | if windows.Handle(hr) != windows.S_OK { |
| 76 | return false, windows.Errno(hr) |
| 77 | } |
| 78 | return isWebMessageEnabled, nil |
| 79 | } |
| 80 | |
| 81 | func (i *ICoreWebView2Settings) PutIsWebMessageEnabled(isWebMessageEnabled bool) error { |
| 82 | |
| 83 | hr, _, _ := i.vtbl.PutIsWebMessageEnabled.Call( |
| 84 | uintptr(unsafe.Pointer(i)), |
| 85 | uintptr(boolToInt(isWebMessageEnabled)), |
| 86 | ) |
| 87 | if windows.Handle(hr) != windows.S_OK { |
| 88 | return windows.Errno(hr) |
| 89 | } |
| 90 | return nil |
| 91 | } |
| 92 | |
| 93 | func (i *ICoreWebView2Settings) GetAreDefaultScriptDialogsEnabled() (bool, error) { |
| 94 | |
| 95 | var areDefaultScriptDialogsEnabled bool |
| 96 | hr, _, _ := i.vtbl.GetAreDefaultScriptDialogsEnabled.Call( |
| 97 | uintptr(unsafe.Pointer(i)), |
| 98 | uintptr(unsafe.Pointer(&areDefaultScriptDialogsEnabled)), |
| 99 | ) |
| 100 | if windows.Handle(hr) != windows.S_OK { |
| 101 | return false, windows.Errno(hr) |
| 102 | } |
| 103 | return areDefaultScriptDialogsEnabled, nil |
| 104 | } |
| 105 | |
| 106 | func (i *ICoreWebView2Settings) PutAreDefaultScriptDialogsEnabled(areDefaultScriptDialogsEnabled bool) error { |
| 107 | |
| 108 | hr, _, _ := i.vtbl.PutAreDefaultScriptDialogsEnabled.Call( |
| 109 | uintptr(unsafe.Pointer(i)), |
| 110 | uintptr(boolToInt(areDefaultScriptDialogsEnabled)), |
| 111 | ) |
| 112 | if windows.Handle(hr) != windows.S_OK { |
| 113 | return windows.Errno(hr) |
| 114 | } |
| 115 | return nil |
| 116 | } |
| 117 | |
| 118 | func (i *ICoreWebView2Settings) GetIsStatusBarEnabled() (bool, error) { |
| 119 | |
| 120 | var isStatusBarEnabled bool |
| 121 | hr, _, _ := i.vtbl.GetIsStatusBarEnabled.Call( |
| 122 | uintptr(unsafe.Pointer(i)), |
| 123 | uintptr(unsafe.Pointer(&isStatusBarEnabled)), |
| 124 | ) |
| 125 | if windows.Handle(hr) != windows.S_OK { |
| 126 | return false, windows.Errno(hr) |
| 127 | } |
| 128 | return isStatusBarEnabled, nil |
| 129 | } |
| 130 | |
| 131 | func (i *ICoreWebView2Settings) PutIsStatusBarEnabled(isStatusBarEnabled bool) error { |
| 132 | |
| 133 | hr, _, _ := i.vtbl.PutIsStatusBarEnabled.Call( |
| 134 | uintptr(unsafe.Pointer(i)), |
| 135 | uintptr(boolToInt(isStatusBarEnabled)), |
| 136 | ) |
| 137 | if windows.Handle(hr) != windows.S_OK { |
| 138 | return windows.Errno(hr) |
| 139 | } |
| 140 | return nil |
| 141 | } |
| 142 | |
| 143 | func (i *ICoreWebView2Settings) GetAreDevToolsEnabled() (bool, error) { |
| 144 | |
| 145 | var areDevToolsEnabled bool |
| 146 | hr, _, _ := i.vtbl.GetAreDevToolsEnabled.Call( |
| 147 | uintptr(unsafe.Pointer(i)), |
| 148 | uintptr(unsafe.Pointer(&areDevToolsEnabled)), |
| 149 | ) |
| 150 | if windows.Handle(hr) != windows.S_OK { |
| 151 | return false, windows.Errno(hr) |
| 152 | } |
| 153 | return areDevToolsEnabled, nil |
| 154 | } |
| 155 | |
| 156 | func (i *ICoreWebView2Settings) PutAreDevToolsEnabled(areDevToolsEnabled bool) error { |
| 157 | |
| 158 | hr, _, _ := i.vtbl.PutAreDevToolsEnabled.Call( |
| 159 | uintptr(unsafe.Pointer(i)), |
| 160 | uintptr(boolToInt(areDevToolsEnabled)), |
| 161 | ) |
| 162 | if windows.Handle(hr) != windows.S_OK { |
| 163 | return windows.Errno(hr) |
| 164 | } |
| 165 | return nil |
| 166 | } |
| 167 | |
| 168 | func (i *ICoreWebView2Settings) GetAreDefaultContextMenusEnabled() (bool, error) { |
| 169 | |
| 170 | var enabled bool |
| 171 | hr, _, _ := i.vtbl.GetAreDefaultContextMenusEnabled.Call( |
| 172 | uintptr(unsafe.Pointer(i)), |
| 173 | uintptr(unsafe.Pointer(&enabled)), |
| 174 | ) |
| 175 | if windows.Handle(hr) != windows.S_OK { |
| 176 | return false, windows.Errno(hr) |
| 177 | } |
| 178 | return enabled, nil |
| 179 | } |
| 180 | |
| 181 | func (i *ICoreWebView2Settings) PutAreDefaultContextMenusEnabled(enabled bool) error { |
| 182 | |
| 183 | hr, _, _ := i.vtbl.PutAreDefaultContextMenusEnabled.Call( |
| 184 | uintptr(unsafe.Pointer(i)), |
| 185 | uintptr(boolToInt(enabled)), |
| 186 | ) |
| 187 | if windows.Handle(hr) != windows.S_OK { |
| 188 | return windows.Errno(hr) |
| 189 | } |
| 190 | return nil |
| 191 | } |
| 192 | |
| 193 | func (i *ICoreWebView2Settings) GetAreHostObjectsAllowed() (bool, error) { |
| 194 | |
| 195 | var allowed bool |
| 196 | hr, _, _ := i.vtbl.GetAreHostObjectsAllowed.Call( |
| 197 | uintptr(unsafe.Pointer(i)), |
| 198 | uintptr(unsafe.Pointer(&allowed)), |
| 199 | ) |
| 200 | if windows.Handle(hr) != windows.S_OK { |
| 201 | return false, windows.Errno(hr) |
| 202 | } |
| 203 | return allowed, nil |
| 204 | } |
| 205 | |
| 206 | func (i *ICoreWebView2Settings) PutAreHostObjectsAllowed(allowed bool) error { |
| 207 | |
| 208 | hr, _, _ := i.vtbl.PutAreHostObjectsAllowed.Call( |
| 209 | uintptr(unsafe.Pointer(i)), |
| 210 | uintptr(boolToInt(allowed)), |
| 211 | ) |
| 212 | if windows.Handle(hr) != windows.S_OK { |
| 213 | return windows.Errno(hr) |
| 214 | } |
| 215 | return nil |
| 216 | } |
| 217 | |
| 218 | func (i *ICoreWebView2Settings) GetIsZoomControlEnabled() (bool, error) { |
| 219 | |
| 220 | var enabled bool |
| 221 | hr, _, _ := i.vtbl.GetIsZoomControlEnabled.Call( |
| 222 | uintptr(unsafe.Pointer(i)), |
| 223 | uintptr(unsafe.Pointer(&enabled)), |
| 224 | ) |
| 225 | if windows.Handle(hr) != windows.S_OK { |
| 226 | return false, windows.Errno(hr) |
| 227 | } |
| 228 | return enabled, nil |
| 229 | } |
| 230 | |
| 231 | func (i *ICoreWebView2Settings) PutIsZoomControlEnabled(enabled bool) error { |
| 232 | |
| 233 | hr, _, _ := i.vtbl.PutIsZoomControlEnabled.Call( |
| 234 | uintptr(unsafe.Pointer(i)), |
| 235 | uintptr(boolToInt(enabled)), |
| 236 | ) |
| 237 | if windows.Handle(hr) != windows.S_OK { |
| 238 | return windows.Errno(hr) |
| 239 | } |
| 240 | return nil |
| 241 | } |
| 242 | |
| 243 | func (i *ICoreWebView2Settings) GetIsBuiltInErrorPageEnabled() (bool, error) { |
| 244 | |
| 245 | var enabled bool |
| 246 | hr, _, _ := i.vtbl.GetIsBuiltInErrorPageEnabled.Call( |
| 247 | uintptr(unsafe.Pointer(i)), |
| 248 | uintptr(unsafe.Pointer(&enabled)), |
| 249 | ) |
| 250 | if windows.Handle(hr) != windows.S_OK { |
| 251 | return false, windows.Errno(hr) |
| 252 | } |
| 253 | return enabled, nil |
| 254 | } |
| 255 | |
| 256 | func (i *ICoreWebView2Settings) PutIsBuiltInErrorPageEnabled(enabled bool) error { |
| 257 | |
| 258 | hr, _, _ := i.vtbl.PutIsBuiltInErrorPageEnabled.Call( |
| 259 | uintptr(unsafe.Pointer(i)), |
| 260 | uintptr(boolToInt(enabled)), |
| 261 | ) |
| 262 | if windows.Handle(hr) != windows.S_OK { |
| 263 | return windows.Errno(hr) |
| 264 | } |
| 265 | return nil |
| 266 | } |
| 267 |