ChromeTabs class

Properties

hashCode int
The hash code for this object.
no setterinherited
isAvailable bool
no setter
maxCaptureVisibleTabCallsPerSecond int
The maximum number of times that captureVisibleTab can be called per second. captureVisibleTab is expensive and should not be called too often.
no setter
onActivated EventStream<OnActivatedActiveInfo>
Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events so as to be notified when a URL is set.
no setter
onActiveChanged EventStream<OnActiveChangedEvent>
Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to tabs.onUpdated events so as to be notified when a URL is set.
no setter
onAttached EventStream<OnAttachedEvent>
Fired when a tab is attached to a window; for example, because it was moved between windows.
no setter
onCreated EventStream<Tab>
Fired when a tab is created. Note that the tab's URL and tab group membership may not be set at the time this event is fired, but you can listen to onUpdated events so as to be notified when a URL is set or the tab is added to a tab group.
no setter
onDetached EventStream<OnDetachedEvent>
Fired when a tab is detached from a window; for example, because it was moved between windows.
no setter
onHighlightChanged EventStream<OnHighlightChangedSelectInfo>
Fired when the highlighted or selected tabs in a window changes.
no setter
onHighlighted EventStream<OnHighlightedHighlightInfo>
Fired when the highlighted or selected tabs in a window changes.
no setter
onMoved EventStream<OnMovedEvent>
Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response to the manually-moved tab. This event is not fired when a tab is moved between windows; for details, see tabs.onDetached.
no setter
onRemoved EventStream<OnRemovedEvent>
Fired when a tab is closed.
no setter
onReplaced EventStream<OnReplacedEvent>
Fired when a tab is replaced with another tab due to prerendering or instant.
no setter
onSelectionChanged EventStream<OnSelectionChangedEvent>
Fires when the selected tab in a window changes.
no setter
onUpdated EventStream<OnUpdatedEvent>
Fired when a tab is updated.
no setter
onZoomChange EventStream<OnZoomChangeZoomChangeInfo>
Fired when a tab is zoomed.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tabIdNone int
An ID that represents the absence of a browser tab.
no setter

Methods

captureVisibleTab(int? windowId, ImageDetails? options) Future<String>
Captures the visible area of the currently active tab in the specified window. In order to call this method, the extension must have either the <all_urls> permission or the activeTab permission. In addition to sites that extensions can normally access, this method allows extensions to capture sensitive sites that are otherwise restricted, including chrome:-scheme pages, other extensions' pages, and data: URLs. These sensitive sites can only be captured with the activeTab permission. File URLs may be captured only if the extension has been granted file access. windowId The target window. Defaults to the current window.
connect(int tabId, ConnectInfo? connectInfo) Port
Connects to the content script(s) in the specified tab. The runtime.onConnect event is fired in each content script running in the specified tab for the current extension. For more details, see Content Script Messaging. returns A port that can be used to communicate with the content scripts running in the specified tab. The port's runtime.Port event is fired if the tab closes or does not exist.
create(CreateProperties createProperties) Future<Tab>
Creates a new tab.
detectLanguage(int? tabId) Future<String>
Detects the primary language of the content in a tab. tabId Defaults to the active tab of the current window.
discard(int? tabId) Future<Tab?>
Discards a tab from memory. Discarded tabs are still visible on the tab strip and are reloaded when activated. tabId The ID of the tab to be discarded. If specified, the tab is discarded unless it is active or already discarded. If omitted, the browser discards the least important tab. This can fail if no discardable tabs exist. returns Called after the operation is completed.
duplicate(int tabId) Future<Tab?>
Duplicates a tab. tabId The ID of the tab to duplicate.
executeScript(int? tabId, InjectDetails details) Future<List<Object>?>
Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc. tabId The ID of the tab in which to run the script; defaults to the active tab of the current window. details Details of the script to run. Either the code or the file property must be set, but both may not be set at the same time. returns Called after all the JavaScript has been executed.
get(int tabId) Future<Tab>
Retrieves details about the specified tab.
getAllInWindow(int? windowId) Future<List<Tab>>
Gets details about all tabs in the specified window. windowId Defaults to the current window.
getCurrent() Future<Tab?>
Gets the tab that this script call is being made from. Returns undefined if called from a non-tab context (for example, a background page or popup view).
getSelected(int? windowId) Future<Tab>
Gets the tab that is selected in the specified window. windowId Defaults to the current window.
getZoom(int? tabId) Future<double>
Gets the current zoom factor of a specified tab. tabId The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window. returns Called with the tab's current zoom factor after it has been fetched.
getZoomSettings(int? tabId) Future<ZoomSettings>
Gets the current zoom settings of a specified tab. tabId The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window. returns Called with the tab's current zoom settings.
goBack(int? tabId) Future<void>
Go back to the previous page, if one is available. tabId The ID of the tab to navigate back; defaults to the selected tab of the current window.
goForward(int? tabId) Future<void>
Go foward to the next page, if one is available. tabId The ID of the tab to navigate forward; defaults to the selected tab of the current window.
group(GroupOptions options) Future<int>
Adds one or more tabs to a specified group, or if no group is specified, adds the given tabs to a newly created group.
highlight(HighlightInfo highlightInfo) Future<Window>
Highlights the given tabs and focuses on the first of group. Will appear to do nothing if the specified tab is currently active.
insertCSS(int? tabId, InjectDetails details) Future<void>
Injects CSS into a page. Styles inserted with this method can be removed with scripting.removeCSS. For details, see the programmatic injection section of the content scripts doc. tabId The ID of the tab in which to insert the CSS; defaults to the active tab of the current window. details Details of the CSS text to insert. Either the code or the file property must be set, but both may not be set at the same time. returns Called when all the CSS has been inserted.
move(Object tabIds, MoveProperties moveProperties) Future<Object>
Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows. tabIds The tab ID or list of tab IDs to move.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query(QueryInfo queryInfo) Future<List<Tab>>
Gets all tabs that have the specified properties, or all tabs if no properties are specified.
reload(int? tabId, ReloadProperties? reloadProperties) Future<void>
Reload a tab. tabId The ID of the tab to reload; defaults to the selected tab of the current window.
remove(Object tabIds) Future<void>
Closes one or more tabs. tabIds The tab ID or list of tab IDs to close.
removeCSS(int? tabId, DeleteInjectionDetails details) Future<void>
Removes from a page CSS that was previously injected by a call to scripting.insertCSS. tabId The ID of the tab from which to remove the CSS; defaults to the active tab of the current window. details Details of the CSS text to remove. Either the code or the file property must be set, but both may not be set at the same time. returns Called when all the CSS has been removed.
sendMessage(int tabId, Object message, SendMessageOptions? options) Future<Object>
Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension. message The message to send. This message should be a JSON-ifiable object.
sendRequest(int tabId, Object request) Future<Object>
Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The extension.onRequest event is fired in each content script running in the specified tab for the current extension.
setZoom(int? tabId, double zoomFactor) Future<void>
Zooms a specified tab. tabId The ID of the tab to zoom; defaults to the active tab of the current window. zoomFactor The new zoom factor. A value of 0 sets the tab to its current default zoom factor. Values greater than 0 specify a (possibly non-default) zoom factor for the tab. returns Called after the zoom factor has been changed.
setZoomSettings(int? tabId, ZoomSettings zoomSettings) Future<void>
Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab. tabId The ID of the tab to change the zoom settings for; defaults to the active tab of the current window. zoomSettings Defines how zoom changes are handled and at what scope. returns Called after the zoom settings are changed.
toString() String
A string representation of this object.
inherited
ungroup(Object tabIds) Future<void>
Removes one or more tabs from their respective groups. If any groups become empty, they are deleted. tabIds The tab ID or list of tab IDs to remove from their respective groups.
update(int? tabId, UpdateProperties updateProperties) Future<Tab?>
Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified. tabId Defaults to the selected tab of the current window.

Operators

operator ==(Object other) bool
The equality operator.
inherited