mirror of
https://github.com/black-ant/Ant-Browser.git
synced 2026-07-14 18:48:55 +08:00
channel: master
version: 1.2.0
source-ref: D:\code\open_source\ant-chrome master
source-commit: f3d7ec5
merged-public-base: 3d264eb
31 lines
831 B
Go
31 lines
831 B
Go
package backend
|
|
|
|
import "fmt"
|
|
|
|
func (a *App) BrowserInstanceStatus(profileId string) (*BrowserProfile, error) {
|
|
a.browserMgr.Mutex.Lock()
|
|
defer a.browserMgr.Mutex.Unlock()
|
|
profile, exists := a.browserMgr.Profiles[profileId]
|
|
if !exists {
|
|
return nil, fmt.Errorf("profile not found")
|
|
}
|
|
return profile, nil
|
|
}
|
|
|
|
func (a *App) BrowserInstanceOpenUrl(profileId string, targetUrl string) bool {
|
|
a.browserMgr.Mutex.Lock()
|
|
profile, exists := a.browserMgr.Profiles[profileId]
|
|
a.browserMgr.Mutex.Unlock()
|
|
if !exists || !profile.Running {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (a *App) BrowserInstanceGetTabs(profileId string) []BrowserTab {
|
|
return []BrowserTab{
|
|
{TabId: "tab-1", Title: "新标签页", Url: "about:blank", Active: true},
|
|
{TabId: "tab-2", Title: "示例站点", Url: "https://example.com", Active: false},
|
|
}
|
|
}
|