Files
Ant-Browser/backend/app_instance_start.go
T
ant-black 70132417ad publish: 1.2.0 snapshot (f3d7ec5)
channel: master

version: 1.2.0

source-ref: D:\code\open_source\ant-chrome master

source-commit: f3d7ec5

merged-public-base: 3d264eb
2026-05-05 18:08:10 +08:00

35 lines
1.4 KiB
Go

package backend
func (a *App) BrowserInstanceStart(profileId string) (*BrowserProfile, error) {
return a.browserInstanceStartInternal(profileId, nil, nil, false, false)
}
func shouldPreferVisibleWindowForStartWithParams(startURLs []string) bool {
return len(normalizeNonEmptyStrings(startURLs)) > 0
}
// BrowserInstanceStartWithParams 通过额外参数启动实例(仅本次启动生效,不落库)
func (a *App) BrowserInstanceStartWithParams(profileId string, extraLaunchArgs []string, startURLs []string, skipDefaultStartURLs bool) (*BrowserProfile, error) {
preferVisibleWindow := shouldPreferVisibleWindowForStartWithParams(startURLs)
return a.browserInstanceStartInternal(profileId, extraLaunchArgs, startURLs, skipDefaultStartURLs, preferVisibleWindow)
}
func (a *App) browserInstanceStartInternal(profileId string, extraLaunchArgs []string, startURLs []string, skipDefaultStartURLs bool, preferVisibleWindow bool) (*BrowserProfile, error) {
input := newBrowserStartInput(profileId, extraLaunchArgs, startURLs, skipDefaultStartURLs, preferVisibleWindow)
a.browserMgr.Mutex.Lock()
defer a.browserMgr.Mutex.Unlock()
profile, handled, err := a.resolveBrowserStartProfile(input)
if err != nil || handled {
return profile, err
}
plan, err := a.prepareBrowserStartPlan(input, profile)
if err != nil {
return profile, err
}
defer plan.releaseBridgeIfNeeded(a)
return a.startBrowserProfileWithPlan(input, plan)
}