OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use the <code>chrome.tabCapture</code> API to interact with tab media | 5 // Use the <code>chrome.tabCapture</code> API to interact with tab media |
6 // streams. | 6 // streams. |
7 namespace tabCapture { | 7 namespace tabCapture { |
8 | 8 |
9 enum TabCaptureState { | 9 enum TabCaptureState { |
10 pending, | 10 pending, |
(...skipping 29 matching lines...) Expand all Loading... |
40 MediaStreamConstraint? audioConstraints; | 40 MediaStreamConstraint? audioConstraints; |
41 MediaStreamConstraint? videoConstraints; | 41 MediaStreamConstraint? videoConstraints; |
42 }; | 42 }; |
43 | 43 |
44 callback GetTabMediaCallback = | 44 callback GetTabMediaCallback = |
45 void ([instanceOf=LocalMediaStream] object stream); | 45 void ([instanceOf=LocalMediaStream] object stream); |
46 | 46 |
47 callback GetCapturedTabsCallback = void (CaptureInfo[] result); | 47 callback GetCapturedTabsCallback = void (CaptureInfo[] result); |
48 | 48 |
49 interface Functions { | 49 interface Functions { |
50 // Captures the visible area of the currently active tab. | 50 // Captures the visible area of the currently active tab. Capture can |
51 // This method can only be used on the currently active page after the | 51 // only be started on the currently active tab after the extension has been |
52 // extension has been <em>invoked</em>, similar to the way that | 52 // <em>invoked</em>. Capture is maintained across page navigations within |
53 // <a href="activeTab.html">activeTab</a> works. | 53 // the tab, and stops when the tab is closed, or the media stream is closed |
| 54 // by the extension. |
| 55 // |
54 // |options| : Configures the returned media stream. | 56 // |options| : Configures the returned media stream. |
55 // |callback| : Callback with either the stream returned or null. | 57 // |callback| : Callback with either the tab capture stream or |
| 58 // <code>null</code>. |
56 static void capture(CaptureOptions options, | 59 static void capture(CaptureOptions options, |
57 GetTabMediaCallback callback); | 60 GetTabMediaCallback callback); |
58 | 61 |
59 // Returns a list of tabs that have requested capture or are being | 62 // Returns a list of tabs that have requested capture or are being |
60 // captured, i.e. status != stopped and status != error. | 63 // captured, i.e. status != stopped and status != error. |
61 // This allows extensions to inform the user that there is an existing | 64 // This allows extensions to inform the user that there is an existing |
62 // tab capture that would prevent a new tab capture from succeeding (or | 65 // tab capture that would prevent a new tab capture from succeeding (or |
63 // to prevent redundant requests for the same tab). | 66 // to prevent redundant requests for the same tab). |
| 67 // |callback| : Callback invoked with CaptureInfo[] for captured tabs. |
64 static void getCapturedTabs(GetCapturedTabsCallback callback); | 68 static void getCapturedTabs(GetCapturedTabsCallback callback); |
65 }; | 69 }; |
66 | 70 |
67 interface Events { | 71 interface Events { |
68 // Event fired when the capture status of a tab changes. | 72 // Event fired when the capture status of a tab changes. |
69 // This allows extension authors to keep track of the capture status of | 73 // This allows extension authors to keep track of the capture status of |
70 // tabs to keep UI elements like page actions and infobars in sync. | 74 // tabs to keep UI elements like page actions and infobars in sync. |
| 75 // |info| : CaptureInfo with new capture status for the tab. |
71 static void onStatusChanged(CaptureInfo info); | 76 static void onStatusChanged(CaptureInfo info); |
72 }; | 77 }; |
73 | 78 |
74 }; | 79 }; |
OLD | NEW |