1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // An API for tab media streams.
17 dictionary CaptureInfo
{
18 // The id of the tab whose status changed.
21 // The new capture status of the tab.
22 TabCaptureState status
;
25 dictionary CaptureOptions
{
30 callback GetTabMediaCallback
=
31 void ([instanceOf
=LocalMediaStream
] optional object stream
);
33 callback GetCapturedTabsCallback
=
34 void (CaptureInfo
[] result
);
37 // Captures the visible area of the tab with the given tabId.
38 // Extensions must have the "tabCapture" permission to use this method.
39 // |tabId| : The tabId of the tab to capture. Defaults to the active tab.
40 // |options| : Configures the returned media stream.
41 // |callback| : Callback with either the stream returned or null.
42 static
void capture
(optional long tabId
,
43 optional CaptureOptions options
,
44 GetTabMediaCallback
callback);
46 // Returns a list of tabs that have requested capture or are being
47 // captured, i.e. status != stopped and status != error.
48 // This allows extensions to inform the user that there is an existing
49 // tab capture that would prevent a new tab capture from succeeding (or
50 // to prevent redundant requests for the same tab).
51 static
void getCapturedTabs
(GetCapturedTabsCallback
callback);
56 // Event fired when the capture status of a tab changes.
57 // This allows extension authors to keep track of the capture status of
58 // tabs to keep UI elements like page actions and infobars in sync.
59 static
void onStatusChanged
(CaptureInfo info
);