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 experimental.tabCapture { |
| 8 |
| 9 enum TabCaptureState { |
| 10 requested, |
| 11 cancelled, |
| 12 pending, |
| 13 active, |
| 14 stopped, |
| 15 error |
| 16 }; |
| 17 |
| 18 dictionary CaptureInfo { |
| 19 // The id of the tab whose status changed. |
| 20 long tabId; |
| 21 |
| 22 // The new capture status of the tab. |
| 23 TabCaptureState status; |
| 24 }; |
| 25 |
| 26 dictionary CaptureOptions { |
| 27 boolean? audio; |
| 28 boolean? video; |
| 29 }; |
| 30 |
| 31 callback GetTabMediaCallback = |
| 32 void ([instanceOf=LocalMediaStream] optional object stream); |
| 33 |
| 34 callback GetCapturedTabsCallback = |
| 35 void (CaptureInfo[] result); |
| 36 |
| 37 interface Functions { |
| 38 // Captures the visible area of the tab with the given tabId. |
| 39 // Extensions must have the host permission for the given tab as well as |
| 40 // the "tabs" permission to use this method. |
| 41 // |tabId| : The tabId of the tab to capture. Defaults to the active tab. |
| 42 // |options| : Configures the returned media stream. |
| 43 // |callback| : Callback with either the stream returned or null. |
| 44 static void getTabMedia(optional long tabId, |
| 45 optional CaptureOptions options, |
| 46 GetTabMediaCallback callback); |
| 47 |
| 48 // Returns a list of tabs that have requested capture or are being |
| 49 // captured, i.e. status != stopped and status != cancelled. |
| 50 // This allows extensions to inform the user that there is an existing |
| 51 // tab capture that would prevent a new tab capture from succeeding (or |
| 52 // to prevent redundant requests for the same tab). |
| 53 static void getCapturedTabs(GetCapturedTabsCallback callback); |
| 54 |
| 55 }; |
| 56 |
| 57 interface Events { |
| 58 // Event fired when the capture status of a tab changes. |
| 59 // This allows extension authors to keep track of the capture status of |
| 60 // tabs to keep UI elements like page actions and infobars in sync. |
| 61 static void onTabCaptured(CaptureInfo info); |
| 62 }; |
| 63 |
| 64 }; |
OLD | NEW |