| 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 // MediaTrackConstraints for the media streams that will be passed to WebRTC. |
| 26 // See section on MediaTrackConstraints: |
| 27 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html |
| 28 dictionary MediaStreamConstraint { |
| 29 object mandatory; |
| 30 }; |
| 31 |
| 32 // Whether we are requesting tab video and/or audio and the |
| 33 // MediaTrackConstraints that should be set for these streams. |
| 34 dictionary CaptureOptions { |
| 35 boolean? audio; |
| 36 boolean? video; |
| 37 MediaStreamConstraint? audioConstraints; |
| 38 MediaStreamConstraint? videoConstraints; |
| 39 }; |
| 40 |
| 41 callback GetTabMediaCallback = |
| 42 void ([instanceOf=LocalMediaStream] object stream); |
| 43 |
| 44 callback GetCapturedTabsCallback = void (CaptureInfo[] result); |
| 45 |
| 46 interface Functions { |
| 47 // Captures the visible area of the currently active tab. |
| 48 // Extensions must have the "tabCapture" permission to use this method. |
| 49 // |options| : Configures the returned media stream. |
| 50 // |callback| : Callback with either the stream returned or null. |
| 51 static void capture(CaptureOptions options, |
| 52 GetTabMediaCallback callback); |
| 53 |
| 54 // Returns a list of tabs that have requested capture or are being |
| 55 // captured, i.e. status != stopped and status != error. |
| 56 // This allows extensions to inform the user that there is an existing |
| 57 // tab capture that would prevent a new tab capture from succeeding (or |
| 58 // to prevent redundant requests for the same tab). |
| 59 static void getCapturedTabs(GetCapturedTabsCallback callback); |
| 60 }; |
| 61 |
| 62 interface Events { |
| 63 // Event fired when the capture status of a tab changes. |
| 64 // This allows extension authors to keep track of the capture status of |
| 65 // tabs to keep UI elements like page actions and infobars in sync. |
| 66 static void onStatusChanged(CaptureInfo info); |
| 67 }; |
| 68 |
| 69 }; |
| OLD | NEW |