| 1 | package edge |
| 2 | |
| 3 | import ( |
| 4 | "syscall" |
| 5 | "unsafe" |
| 6 | ) |
| 7 | |
| 8 | // ICoreWebView2CookieList vtable |
| 9 | type iCoreWebView2CookieListVtbl struct { |
| 10 | _IUnknownVtbl |
| 11 | GetCount ComProc |
| 12 | GetItem ComProc |
| 13 | } |
| 14 | |
| 15 | // ICoreWebView2CookieList represents a list of cookies |
| 16 | type ICoreWebView2CookieList struct { |
| 17 | vtbl *iCoreWebView2CookieListVtbl |
| 18 | } |
| 19 | |
| 20 | // AddRef increments reference count of the ICoreWebView2CookieList interface |
| 21 | func (i *ICoreWebView2CookieList) AddRef() uint32 { |
| 22 | ret, _, _ := i.vtbl.AddRef.Call(uintptr(unsafe.Pointer(i))) |
| 23 | |
| 24 | return uint32(ret) |
| 25 | } |
| 26 | |
| 27 | // Release decrements reference count of the ICoreWebView2CookieList interface |
| 28 | func (i *ICoreWebView2CookieList) Release() uint32 { |
| 29 | ret, _, _ := i.vtbl.Release.Call(uintptr(unsafe.Pointer(i))) |
| 30 | |
| 31 | return uint32(ret) |
| 32 | } |
| 33 | |
| 34 | // GetCount gets the number of cookies in the list |
| 35 | func (i *ICoreWebView2CookieList) GetCount() (uint32, error) { |
| 36 | var count uint32 |
| 37 | hr, _, _ := i.vtbl.GetCount.Call( |
| 38 | uintptr(unsafe.Pointer(i)), |
| 39 | uintptr(unsafe.Pointer(&count)), |
| 40 | ) |
| 41 | if hr != 0 { |
| 42 | return 0, syscall.Errno(hr) |
| 43 | } |
| 44 | return count, nil |
| 45 | } |
| 46 | |
| 47 | // GetItem gets the cookie at the specified index |
| 48 | func (i *ICoreWebView2CookieList) GetItem(index uint32) (*ICoreWebView2Cookie, error) { |
| 49 | var cookie *ICoreWebView2Cookie |
| 50 | hr, _, _ := i.vtbl.GetItem.Call( |
| 51 | uintptr(unsafe.Pointer(i)), |
| 52 | uintptr(index), |
| 53 | uintptr(unsafe.Pointer(&cookie)), |
| 54 | ) |
| 55 | if hr != 0 { |
| 56 | return nil, syscall.Errno(hr) |
| 57 | } |
| 58 | return cookie, nil |
| 59 | } |
| 60 |