File: desktop_media_picker_controller.h

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (89 lines) | stat: -rw-r--r-- 3,759 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// 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.

#ifndef CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_H_
#define CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_H_

#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>

#include <memory>

#include "base/callback.h"
#import "base/mac/scoped_nsobject.h"
#include "base/strings/string16.h"
#include "chrome/browser/media/webrtc/desktop_media_list.h"
#include "chrome/browser/media/webrtc/desktop_media_picker.h"
#import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_bridge.h"

// A controller for the Desktop Media Picker. Presents the user with a list of
// media sources for screen-capturing, and reports the result.
@interface DesktopMediaPickerController
    : NSWindowController<NSWindowDelegate,
                         DesktopMediaPickerObserver,
                         NSTableViewDataSource,
                         NSTableViewDelegate> {
 @private
  // The image browser view or table view to present sources to the user
  // (thumbnails and names).
  base::scoped_nsobject<IKImageBrowserView> screenBrowser_;
  base::scoped_nsobject<IKImageBrowserView> windowBrowser_;
  base::scoped_nsobject<NSTableView> tabBrowser_;

  base::scoped_nsobject<NSScrollView> imageBrowserScroll_;

  base::scoped_nsobject<NSSegmentedControl> sourceTypeControl_;

  // The button used to confirm the selection.
  NSButton* shareButton_;  // weak; owned by contentView

  // The button used to cancel and close the dialog.
  NSButton* cancelButton_;  // weak; owned by contentView

  // The checkbox for audio share.
  base::scoped_nsobject<NSButton> audioShareCheckbox_;

  // Provides source information (including thumbnails) to fill up the array of
  // |screenItems_|, |windowItems_| and |tabItems_|, and to render in
  // |screenBrowser_|, |windowBrowser_| and |tabBrowser_|.
  std::unique_ptr<DesktopMediaList> screenList_;
  std::unique_ptr<DesktopMediaList> windowList_;
  std::unique_ptr<DesktopMediaList> tabList_;

  // To be called with the user selection.
  DesktopMediaPicker::DoneCallback doneCallback_;

  // Arrays of |DesktopMediaPickerItem| used as data for |screenBrowser_|,
  // |windowBrowser_| and |tabBrowser_|.
  base::scoped_nsobject<NSMutableArray> screenItems_;
  base::scoped_nsobject<NSMutableArray> windowItems_;
  base::scoped_nsobject<NSMutableArray> tabItems_;

  // C++ bridge to use as an observer to |screenList_|, |windowList_| and
  // |tabList_|, that forwards obj-c notifications to this object.
  std::unique_ptr<DesktopMediaPickerBridge> bridge_;

  // Used to create |DesktopMediaPickerItem|s with unique IDs.
  int lastImageUID_;
}

// Designated initializer.
// To show the dialog, use |NSWindowController|'s |showWindow:|.
// |callback| will be called to report the user's selection.
// |appName| will be used to format the dialog's title and the label, where it
// appears as the initiator of the request.
// |targetName| will be used to format the dialog's label and appear as the
// consumer of the requested stream.
- (id)initWithScreenList:(std::unique_ptr<DesktopMediaList>)screenList
              windowList:(std::unique_ptr<DesktopMediaList>)windowList
                 tabList:(std::unique_ptr<DesktopMediaList>)tabList
                  parent:(NSWindow*)parent
                callback:(const DesktopMediaPicker::DoneCallback&)callback
                 appName:(const base::string16&)appName
              targetName:(const base::string16&)targetName
            requestAudio:(bool)requestAudio;

@end

#endif  // CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_H_