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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 static void capture(CaptureOptions options, | 59 static void capture(CaptureOptions options, |
60 GetTabMediaCallback callback); | 60 GetTabMediaCallback callback); |
61 | 61 |
62 // 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 |
63 // captured, i.e. status != stopped and status != error. | 63 // captured, i.e. status != stopped and status != error. |
64 // 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 |
65 // 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 |
66 // 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. | 67 // |callback| : Callback invoked with CaptureInfo[] for captured tabs. |
68 static void getCapturedTabs(GetCapturedTabsCallback callback); | 68 static void getCapturedTabs(GetCapturedTabsCallback callback); |
| 69 |
| 70 // Locates an off-screen presentation tab identified by a starting |
| 71 // |presentationUrl| and |presentationId|. If not found, one is |
| 72 // automatically created and navigated to |presentationUrl|. Then, capture |
| 73 // is started. |
| 74 // |
| 75 // Off-screen presentation tabs are used to simulate the rendering of a web |
| 76 // page on a remote device. This is accomplished by rendering the page |
| 77 // locally and capturing its audio and/or video output into a MediaStream. |
| 78 // Users of this API can then remote the MediaStream (e.g., via WebRTC or |
| 79 // Cast) to a remote playback device. |
| 80 // |
| 81 // Therefore, off-screen presentation tabs are isolated from the user's |
| 82 // normal browser experience. They do not show up in the browser window or |
| 83 // tab strip, nor are they visible to extensions (e.g., via the |
| 84 // chrome.tabs.* APIs). For security reasons, they are isolated in their |
| 85 // own non-shared incognito profile and cannot access any interactive |
| 86 // resources such as keyboard/mouse input, media recording devices (e.g., |
| 87 // web cams), copy/paste to/from the system clipboard, etc. |
| 88 // |
| 89 // An off-screen presentation tab remains alive until one of three events |
| 90 // occurs: 1. All MediaStreams providing its captured content are closed; |
| 91 // 2. the page being rendered calls window.close(); 3. the extension that |
| 92 // called capturePresentation() is unloaded. |
| 93 // |
| 94 // This is a new, experimental API and may change without notice. In |
| 95 // addition, it is only available when the browser is run with the |
| 96 // --enable-capture-presentation-api switch. |
| 97 // |
| 98 // |options| : Configures the capture and returned MediaStream. |
| 99 // |callback| : <code>null</code> on error. |
| 100 static void capturePresentation(DOMString presentationUrl, |
| 101 DOMString presentationId, |
| 102 CaptureOptions options, |
| 103 GetTabMediaCallback callback); |
69 }; | 104 }; |
70 | 105 |
71 interface Events { | 106 interface Events { |
72 // Event fired when the capture status of a tab changes. | 107 // Event fired when the capture status of a tab changes. |
73 // This allows extension authors to keep track of the capture status of | 108 // This allows extension authors to keep track of the capture status of |
74 // tabs to keep UI elements like page actions in sync. | 109 // tabs to keep UI elements like page actions in sync. |
75 // |info| : CaptureInfo with new capture status for the tab. | 110 // |info| : CaptureInfo with new capture status for the tab. |
76 static void onStatusChanged(CaptureInfo info); | 111 static void onStatusChanged(CaptureInfo info); |
77 }; | 112 }; |
78 | 113 |
79 }; | 114 }; |
OLD | NEW |