engine_popup_bridge.go RawHistoryFolder

1package cef
2
3import (
4	purecef "github.com/bnema/purego-cef/cef"
5
6	"github.com/bnema/dumber/internal/logging"
7)
8
9func (e *Engine) webViewForBrowser(browser purecef.Browser) *WebView {
10	if e == nil || browser == nil {
11		return nil
12	}
13
14	browserID := browser.GetIdentifier()
15	if current, ok := e.browserWebViews.Load(browserID); ok {
16		if wv, ok := current.(*WebView); ok && wv != nil {
17			wv.mu.RLock()
18			wvBrowser := wv.browser
19			wv.mu.RUnlock()
20			if wvBrowser != nil && wvBrowser.GetIdentifier() == browserID {
21				return wv
22			}
23			e.unbindBrowserWebView(browserID, wv)
24		}
25	}
26
27	var matched *WebView
28	e.activeWebViews.Range(func(_, value any) bool {
29		wv, ok := value.(*WebView)
30		if !ok || wv == nil {
31			return true
32		}
33		wv.mu.RLock()
34		wvBrowser := wv.browser
35		wv.mu.RUnlock()
36		if wvBrowser == nil || wvBrowser.GetIdentifier() != browserID {
37			return true
38		}
39		matched = wv
40		e.bindBrowserWebView(browser, wv)
41		return false
42	})
43	return matched
44}
45
46func (e *Engine) withBridgeSourceWebView(browser purecef.Browser, proxyID, action string, fn func(*WebView)) {
47	if e == nil || browser == nil {
48		return
49	}
50	wv := e.webViewForBrowser(browser)
51	if wv == nil {
52		logging.FromContext(e.currentContext()).Warn().
53			Int32("browser_id", browser.GetIdentifier()).
54			Str("proxy_id", proxyID).
55			Msg("cef: " + action + " bridge could not resolve source webview")
56		return
57	}
58	fn(wv)
59}
60
61func (e *Engine) handlePopupBridgeOpen(browser purecef.Browser, payload rendererBridgePopupOpenPayload) {
62	e.withBridgeSourceWebView(browser, payload.ProxyID, "popup-open", func(wv *WebView) {
63		wv.handleSyntheticPopupOpen(payload.URL, payload.FrameName, payload.ProxyID, payload.UserGesture, payload.NoJavaScriptAccess)
64	})
65}
66
67func (e *Engine) handlePopupBridgeNavigate(browser purecef.Browser, payload rendererBridgePopupNavigatePayload) {
68	e.withBridgeSourceWebView(browser, payload.ProxyID, "popup-navigate", func(wv *WebView) {
69		wv.handleSyntheticPopupNavigate(payload.ProxyID, payload.URL)
70	})
71}
72
73func (e *Engine) handlePopupBridgeClose(browser purecef.Browser, payload rendererBridgePopupClosePayload) {
74	e.withBridgeSourceWebView(browser, payload.ProxyID, "popup-close", func(wv *WebView) {
75		wv.handleSyntheticPopupClose(payload.ProxyID)
76	})
77}
78
79func (e *Engine) handlePopupOpenerNavigate(browser purecef.Browser, payload popupOpenerNavigatePayload) {
80	e.withBridgeSourceWebView(browser, "", "popup-opener-navigate", func(wv *WebView) {
81		wv.handlePopupOpenerNavigate(payload.URL)
82	})
83}
84
85func (e *Engine) handlePopupOpenerPostMessage(browser purecef.Browser, payload popupOpenerPostMessagePayload) {
86	e.withBridgeSourceWebView(browser, "", "popup-opener-post-message", func(wv *WebView) {
87		wv.handlePopupOpenerPostMessage(payload)
88	})
89}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close