Chromium Code Reviews| Index: chrome/common/extensions/api/experimental_tab_capture.idl |
| diff --git a/chrome/common/extensions/api/experimental_tab_capture.idl b/chrome/common/extensions/api/experimental_tab_capture.idl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c1493a2715aec2047d003fc64c224b4c2350391e |
| --- /dev/null |
| +++ b/chrome/common/extensions/api/experimental_tab_capture.idl |
| @@ -0,0 +1,64 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// An API for tab media streams. |
| + |
| +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
|
| + |
| + enum TabCaptureState { |
| + requested, |
| + cancelled, |
| + pending, |
| + active, |
| + stopped, |
| + error |
| + }; |
| + |
| + dictionary CaptureInfo { |
| + // The id of the tab whose status changed. |
| + long tabId; |
| + |
| + // The new capture status of the tab. |
| + TabCaptureState status; |
| + }; |
| + |
| + dictionary CaptureOptions { |
| + boolean? audio; |
| + boolean? video; |
| + }; |
| + |
| + callback GetTabMediaCallback = |
| + void ([instanceOf=LocalMediaStream] optional object stream); |
| + |
| + callback GetCapturedTabsCallback = |
| + void (CaptureInfo[] result); |
| + |
| + interface Functions { |
| + // Captures the visible area of the tab with the given tabId. |
| + // Extensions must have the host permission for the given tab as well as |
| + // 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
|
| + // |tabId| : The tabId of the tab to capture. Defaults to the active tab. |
| + // |options| : Configures the returned media stream. |
| + // |callback| : Callback with either the stream returned or null. |
| + 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
|
| + optional CaptureOptions options, |
| + GetTabMediaCallback callback); |
| + |
| + // Returns a list of tabs that have requested capture or are being |
| + // captured, i.e. status != stopped and status != cancelled. |
| + // This allows extensions to inform the user that there is an existing |
| + // tab capture that would prevent a new tab capture from succeeding (or |
| + // to prevent redundant requests for the same tab). |
| + static void getCapturedTabs(GetCapturedTabsCallback callback); |
| + |
| + }; |
| + |
| + interface Events { |
| + // Event fired when the capture status of a tab changes. |
| + // This allows extension authors to keep track of the capture status of |
| + // tabs to keep UI elements like page actions and infobars in sync. |
| + 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.
|
| + }; |
| + |
| +}; |