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 // An API for tab media streams. | 5 // An API for tab media streams. |
6 | 6 |
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? videoConstraints; | 40 MediaStreamConstraint? videoConstraints; |
41 }; | 41 }; |
42 | 42 |
43 callback GetTabMediaCallback = | 43 callback GetTabMediaCallback = |
44 void ([instanceOf=LocalMediaStream] object stream); | 44 void ([instanceOf=LocalMediaStream] object stream); |
45 | 45 |
46 callback GetCapturedTabsCallback = void (CaptureInfo[] result); | 46 callback GetCapturedTabsCallback = void (CaptureInfo[] result); |
47 | 47 |
48 interface Functions { | 48 interface Functions { |
49 // Captures the visible area of the currently active tab. | 49 // Captures the visible area of the currently active tab. |
50 // Extensions must have the "tabCapture" permission to use this method. | 50 // This method can only be used on the currently active page after the |
| 51 // extension has been <em>invoked</em>, similar to the way that |
| 52 // <a href="activeTab.html">activeTab</a> works. |
| 53 // Note that Chrome internal pages cannot be captured. |
51 // |options| : Configures the returned media stream. | 54 // |options| : Configures the returned media stream. |
52 // |callback| : Callback with either the stream returned or null. | 55 // |callback| : Callback with either the stream returned or null. |
53 static void capture(CaptureOptions options, | 56 static void capture(CaptureOptions options, |
54 GetTabMediaCallback callback); | 57 GetTabMediaCallback callback); |
55 | 58 |
56 // Returns a list of tabs that have requested capture or are being | 59 // Returns a list of tabs that have requested capture or are being |
57 // captured, i.e. status != stopped and status != error. | 60 // captured, i.e. status != stopped and status != error. |
58 // This allows extensions to inform the user that there is an existing | 61 // This allows extensions to inform the user that there is an existing |
59 // tab capture that would prevent a new tab capture from succeeding (or | 62 // tab capture that would prevent a new tab capture from succeeding (or |
60 // to prevent redundant requests for the same tab). | 63 // to prevent redundant requests for the same tab). |
61 static void getCapturedTabs(GetCapturedTabsCallback callback); | 64 static void getCapturedTabs(GetCapturedTabsCallback callback); |
62 }; | 65 }; |
63 | 66 |
64 interface Events { | 67 interface Events { |
65 // Event fired when the capture status of a tab changes. | 68 // Event fired when the capture status of a tab changes. |
66 // This allows extension authors to keep track of the capture status of | 69 // This allows extension authors to keep track of the capture status of |
67 // tabs to keep UI elements like page actions and infobars in sync. | 70 // tabs to keep UI elements like page actions and infobars in sync. |
68 static void onStatusChanged(CaptureInfo info); | 71 static void onStatusChanged(CaptureInfo info); |
69 }; | 72 }; |
70 | 73 |
71 }; | 74 }; |
OLD | NEW |