Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: chrome/renderer/resources/extensions/experimental.tab_capture_custom_bindings.js

Issue 10928043: Media Related changes for TabCapture API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Custom bindings for the Tab Capture API.
6
7 var tabCaptureNatives = requireNative('experimental_tabCapture');
8 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
9
10 chromeHidden.registerCustomHook('experimental.tabCapture',
11 function(bindingsAPI, extensionId) {
12 var apiFunctions = bindingsAPI.apiFunctions;
13
14 apiFunctions.setCustomCallback('getTabMedia',
15 function(name, request, response) {
16 if (response && request.callback) {
17 var callback = request.callback;
18 var successFunc = function(stream) {
19 callback(stream);
20 };
21 var errorFunc = function() {
22 callback(null);
23 };
24 if (0 !== tabCaptureNatives.RequestDeviceMedia(
25 response.deviceId, response.options, successFunc, errorFunc))
26 errorFunc();
27 }
28 request.callback = null;
29 });
30 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698