Extract SIGPIPE ignoring code to a common place.
[chromium-blink-merge.git] / chrome / common / extensions / api / tab_capture.idl
blob4771fefe1d72f75a0bcf6eeecf94b1f7fff1a680
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.
7 namespace tabCapture {
9 enum TabCaptureState {
10 requested,
11 pending,
12 active,
13 stopped,
14 error
17 dictionary CaptureInfo {
18 // The id of the tab whose status changed.
19 long tabId;
21 // The new capture status of the tab.
22 TabCaptureState status;
25 dictionary CaptureOptions {
26 boolean? audio;
27 boolean? video;
30 callback GetTabMediaCallback =
31 void ([instanceOf=LocalMediaStream] optional object stream);
33 callback GetCapturedTabsCallback =
34 void (CaptureInfo[] result);
36 interface Functions {
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);
55 interface Events {
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);