feat: add support for chrome.tabs.query (#39431)

* feat: add support for tabs.query

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* fix: scope to webContents in current session

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* test: add test for session behavior

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2023-08-14 10:05:59 +02:00
committed by GitHub
parent c709e04bed
commit ca899eb3cb
9 changed files with 336 additions and 2 deletions

View File

@@ -4443,6 +4443,16 @@ WebContents* WebContents::FromID(int32_t id) {
return GetAllWebContents().Lookup(id);
}
// static
std::list<WebContents*> WebContents::GetWebContentsList() {
std::list<WebContents*> list;
for (auto iter = base::IDMap<WebContents*>::iterator(&GetAllWebContents());
!iter.IsAtEnd(); iter.Advance()) {
list.push_back(iter.GetCurrentValue());
}
return list;
}
// static
gin::WrapperInfo WebContents::kWrapperInfo = {gin::kEmbedderNativeGin};

View File

@@ -137,6 +137,7 @@ class WebContents : public ExclusiveAccessContext,
// if there is no associated wrapper.
static WebContents* From(content::WebContents* web_contents);
static WebContents* FromID(int32_t id);
static std::list<WebContents*> GetWebContentsList();
// Get the V8 wrapper of the |web_contents|, or create one if not existed.
//