Chromium Code Reviews| 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 { | |
|
Aaron Boodman
2012/10/04 07:21:43
Don't make this experimental. Make it a real API,
justinlin
2012/10/08 09:58:31
Done. By command-line do you mean like one of the
| |
| 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. | |
|
Aaron Boodman
2012/10/04 07:21:43
Why do they need the 'tabs' permission? The tabs p
justinlin
2012/10/08 09:58:31
It does persist across navigations. Added this per
| |
| 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, | |
|
Aaron Boodman
2012/10/04 07:21:43
Maybe just name this begin()? or capture()?
justinlin
2012/10/11 07:30:13
Done. I think I prefer capture() because begin() s
| |
| 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); | |
|
Aaron Boodman
2012/10/04 07:21:43
Seems like name should be something like onStatusC
justinlin
2012/10/11 07:30:13
Done.
| |
| 62 }; | |
| 63 | |
| 64 }; | |
| OLD | NEW |