OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 // An API for tab media streams. |
| 6 |
| 7 namespace tabCapture { |
| 8 |
| 9 enum TabCaptureState { |
| 10 requested, |
| 11 pending, |
| 12 active, |
| 13 stopped, |
| 14 error |
| 15 }; |
| 16 |
| 17 dictionary CaptureInfo { |
| 18 // The id of the tab whose status changed. |
| 19 long tabId; |
| 20 |
| 21 // The new capture status of the tab. |
| 22 TabCaptureState status; |
| 23 }; |
| 24 |
| 25 dictionary CaptureOptions { |
| 26 boolean? audio; |
| 27 boolean? video; |
| 28 }; |
| 29 |
| 30 callback GetTabMediaCallback = |
| 31 void ([instanceOf=LocalMediaStream] optional object stream); |
| 32 |
| 33 callback GetCapturedTabsCallback = |
| 34 void (CaptureInfo[] result); |
| 35 |
| 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); |
| 45 |
| 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); |
| 52 |
| 53 }; |
| 54 |
| 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); |
| 60 }; |
| 61 |
| 62 }; |
OLD | NEW |