summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/desktop_capture.idl
blob: 7a62207626289aea7f7fee189564c3b3e11372c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Desktop Capture API that can be used to capture content of screen or
// individual windows or tabs.
namespace desktopCapture {
  // Enum used to define set of desktop media sources used in
  // chooseDesktopMedia().
  enum DesktopCaptureSourceType {
    screen,
    window,
    tab
  };

  // |streamId|: An opaque string that can be passed to
  // <code>getUserMedia()</code> API to generate media stream that corresponds
  // to the source selected by the user. If user didn't select any source
  // (i.e. canceled the prompt) then the callback is called with an empty
  // <code>streamId</code>.
  callback ChooseDesktopMediaCallback = void (DOMString streamId);

  interface Functions {
    // Shows desktop media picker UI with the specified set of sources. Returns
    // an id that can be passed to cancelChooseDesktopMedia() in case the prompt
    // need to be canceled.
    //
    // |sources|: Set of sources that should be shown to the user.
    //
    // |origin|: Optional origin of the page for which the stream is created. If
    // not specified then the resulting stream can be used only the calling
    // extension, otherwise the stream can be used only by a page with the
    // specified origin.
    static long chooseDesktopMedia(DesktopCaptureSourceType[] sources,
                                   optional DOMString origin,
                                   ChooseDesktopMediaCallback callback);

    // Hides desktop media picker dialog shown by chooseDesktopMedia().
    //
    // |desktopMediaRequestId|: Id returned by chooseDesktopMedia()
    static void cancelChooseDesktopMedia(long desktopMediaRequestId);
  };
};