Chromium Code Reviews| 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, or creates on-demand, an off-screen tab identified by a | |
| 71 // |startUrl| and |id|. When created, the off-screen tab is automatically | |
|
not at google - send to devlin
2015/09/25 16:56:03
Where does the id come from?
miu
2015/09/25 17:35:32
This is explained a few sentences later in this pa
not at google - send to devlin
2015/09/25 17:42:04
Yeah I didn't read on, but my follow-up was, it do
miu
2015/09/25 18:47:54
See line 268 in tab_capture_api.cc. It is passed
not at google - send to devlin
2015/09/25 19:13:24
ok, 3rd question: can the API generate one itself?
miu
2015/09/25 21:59:17
As I was answering your question, I'm now thinking
not at google - send to devlin
2015/09/25 22:29:55
Yes I'd like to avoid having an ID here. If you wa
miu
2015/09/26 20:40:14
Done.
However, I forgot to mention there is a sec
not at google - send to devlin
2015/09/30 01:32:11
I'll reply there.
miu
2015/09/30 19:46:38
Didn't see a comment there. Does that mean this i
| |
| 72 // navigated to the given |startUrl|. Then, capture is started and a | |
| 73 // MediaStream is returned via |callback|. |id| can be any client-provided | |
| 74 // string. It is used only to disambiguate off-screen tabs with the same | |
| 75 // |startUrl|. | |
| 76 // | |
| 77 // Off-screen tabs are isolated from the user's normal browser experience. | |
| 78 // They do not show up in the browser window or tab strip, nor are they | |
| 79 // visible to extensions (e.g., via the chrome.tabs.* APIs). | |
| 80 // | |
| 81 // An off-screen tab remains alive until one of three events occurs: 1. All | |
| 82 // MediaStreams providing its captured content are closed; 2. the page | |
| 83 // self-closes (e.g., via window.close()); 3. the extension that called | |
| 84 // captureOffscreenTab() is unloaded. | |
| 85 // | |
| 86 // Sandboxing: The off-screen tab does not have any access whatsoever to the | |
| 87 // local user profile (including cookies, HTTP auth, etc.). Instead, it is | |
| 88 // provided its own dedicated, non-shared off-the-record profile. Also, it | |
|
not at google - send to devlin
2015/09/25 22:29:55
Can we say "sandboxed" instead of "off-the-record"
miu
2015/09/26 20:40:14
Done.
| |
| 89 // cannot access any interactive resources such as keyboard/mouse input, | |
| 90 // media recording devices (e.g., web cams), copy/paste to/from the system | |
| 91 // clipboard, etc. | |
| 92 // | |
| 93 // Note: This is a new API, currently only available via whitelisting, and | |
|
not at google - send to devlin
2015/09/25 22:29:55
whitelisting? This is dev channel now right? The d
miu
2015/09/26 20:40:14
I wasn't sure we were ready for dev-channel yet, g
not at google - send to devlin
2015/09/30 01:32:11
Makes sense. Just double checking.
| |
| 94 // may change without notice. | |
| 95 // | |
| 96 // |options| : Constraints for the capture and returned MediaStream. | |
| 97 // |callback| : <code>null</code> on error. | |
| 98 static void captureOffscreenTab(DOMString startUrl, | |
| 99 DOMString id, | |
| 100 CaptureOptions options, | |
| 101 GetTabMediaCallback callback); | |
| 69 }; | 102 }; |
| 70 | 103 |
| 71 interface Events { | 104 interface Events { |
| 72 // Event fired when the capture status of a tab changes. | 105 // Event fired when the capture status of a tab changes. |
| 73 // This allows extension authors to keep track of the capture status of | 106 // This allows extension authors to keep track of the capture status of |
| 74 // tabs to keep UI elements like page actions in sync. | 107 // tabs to keep UI elements like page actions in sync. |
| 75 // |info| : CaptureInfo with new capture status for the tab. | 108 // |info| : CaptureInfo with new capture status for the tab. |
| 76 static void onStatusChanged(CaptureInfo info); | 109 static void onStatusChanged(CaptureInfo info); |
| 77 }; | 110 }; |
| 78 | 111 |
| 79 }; | 112 }; |
| OLD | NEW |