OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #import <Quartz/Quartz.h> | 9 #import <Quartz/Quartz.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #import "base/mac/scoped_nsobject.h" | 14 #import "base/mac/scoped_nsobject.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "chrome/browser/media/desktop_media_list.h" | 16 #include "chrome/browser/media/desktop_media_list.h" |
17 #include "chrome/browser/media/desktop_media_picker.h" | 17 #include "chrome/browser/media/desktop_media_picker.h" |
18 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_bridge.h" | 18 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_bridge.h" |
19 | 19 |
20 // A controller for the Desktop Media Picker. Presents the user with a list of | 20 // A controller for the Desktop Media Picker. Presents the user with a list of |
21 // media sources for screen-capturing, and reports the result. | 21 // media sources for screen-capturing, and reports the result. |
22 @interface DesktopMediaPickerController | 22 @interface DesktopMediaPickerController |
23 : NSWindowController<NSWindowDelegate, DesktopMediaPickerObserver> { | 23 : NSWindowController<NSWindowDelegate, |
24 DesktopMediaPickerObserver, | |
25 NSTableViewDataSource, | |
26 NSTableViewDelegate> { | |
24 @private | 27 @private |
25 // The image browser view to present sources to the user (thumbnails and | 28 // The image browser view or table view to present sources to the user |
26 // names). | 29 // (thumbnails and names). |
27 base::scoped_nsobject<IKImageBrowserView> sourceBrowser_; | 30 base::scoped_nsobject<IKImageBrowserView> screenBrowser_; |
31 base::scoped_nsobject<IKImageBrowserView> windowBrowser_; | |
32 base::scoped_nsobject<NSTableView> tabBrowser_; | |
33 | |
34 base::scoped_nsobject<NSScrollView> imageBrowserScroll_; | |
35 | |
36 base::scoped_nsobject<NSSegmentedControl> sourceTypeControl_; | |
28 | 37 |
29 // The button used to confirm the selection. | 38 // The button used to confirm the selection. |
30 NSButton* shareButton_; // weak; owned by contentView | 39 NSButton* shareButton_; // weak; owned by contentView |
31 | 40 |
32 // The button used to cancel and close the dialog. | 41 // The button used to cancel and close the dialog. |
33 NSButton* cancelButton_; // weak; owned by contentView | 42 NSButton* cancelButton_; // weak; owned by contentView |
34 | 43 |
35 // The checkbox for audio share. | 44 // The checkbox for audio share. |
36 // |audioShareState_| records the state when check box is disabled. | 45 // |audioShareState_| records the state when check box is disabled. |
37 base::scoped_nsobject<NSButton> audioShareCheckbox_; | 46 base::scoped_nsobject<NSButton> audioShareCheckbox_; |
38 NSCellStateValue audioShareState_; | 47 NSCellStateValue audioShareState_; |
39 | 48 |
40 // Provides source information (including thumbnails) to fill up |items_| and | 49 // Provides source information (including thumbnails) to fill up the array of |
41 // to render in |sourceBrowser_|. | 50 // |screen_items_|, |window_items_| and |tab_items_|, and to render in |
42 std::unique_ptr<DesktopMediaList> media_list_; | 51 // |screenBrowser_|, |windowBrowser_| and |tabBrowser_|. |
52 std::unique_ptr<DesktopMediaList> screen_list_; | |
tapted
2016/06/20 12:18:34
These need to be screenList_ naming style. Same wi
qiangchen
2016/06/21 23:31:26
Done.
| |
53 std::unique_ptr<DesktopMediaList> window_list_; | |
54 std::unique_ptr<DesktopMediaList> tab_list_; | |
43 | 55 |
44 // To be called with the user selection. | 56 // To be called with the user selection. |
45 DesktopMediaPicker::DoneCallback doneCallback_; | 57 DesktopMediaPicker::DoneCallback doneCallback_; |
46 | 58 |
47 // Array of |DesktopMediaPickerItem| used as data for |sourceBrowser_|. | 59 // Arrays of |DesktopMediaPickerItem| used as data for |screenBrowser|, |
48 base::scoped_nsobject<NSMutableArray> items_; | 60 // |windowBrowser_| and |tabBrowser|. |
61 base::scoped_nsobject<NSMutableArray> screen_items_; | |
62 base::scoped_nsobject<NSMutableArray> window_items_; | |
63 base::scoped_nsobject<NSMutableArray> tab_items_; | |
49 | 64 |
50 // C++ bridge to use as an observer to |media_list_|, that forwards obj-c | 65 // C++ bridge to use as an observer to |screen_list_|, |window_list_| and |
51 // notifications to this object. | 66 // |tab_list_|, that forwards obj-c notifications to this object. |
52 std::unique_ptr<DesktopMediaPickerBridge> bridge_; | 67 std::unique_ptr<DesktopMediaPickerBridge> bridge_; |
53 | 68 |
54 // Used to create |DesktopMediaPickerItem|s with unique IDs. | 69 // Used to create |DesktopMediaPickerItem|s with unique IDs. |
55 int lastImageUID_; | 70 int lastImageUID_; |
56 } | 71 } |
57 | 72 |
58 // Designated initializer. | 73 // Designated initializer. |
59 // To show the dialog, use |NSWindowController|'s |showWindow:|. | 74 // To show the dialog, use |NSWindowController|'s |showWindow:|. |
60 // |callback| will be called to report the user's selection. | 75 // |callback| will be called to report the user's selection. |
61 // |appName| will be used to format the dialog's title and the label, where it | 76 // |appName| will be used to format the dialog's title and the label, where it |
62 // appears as the initiator of the request. | 77 // appears as the initiator of the request. |
63 // |targetName| will be used to format the dialog's label and appear as the | 78 // |targetName| will be used to format the dialog's label and appear as the |
64 // consumer of the requested stream. | 79 // consumer of the requested stream. |
65 - (id)initWithScreenList:(std::unique_ptr<DesktopMediaList>)screen_list | 80 - (id)initWithScreenList:(std::unique_ptr<DesktopMediaList>)screen_list |
tapted
2016/06/20 12:18:34
arguments should be screenList style too
qiangchen
2016/06/21 23:31:26
Done.
| |
66 windowList:(std::unique_ptr<DesktopMediaList>)window_list | 81 windowList:(std::unique_ptr<DesktopMediaList>)window_list |
67 tabList:(std::unique_ptr<DesktopMediaList>)tab_list | 82 tabList:(std::unique_ptr<DesktopMediaList>)tab_list |
68 parent:(NSWindow*)parent | 83 parent:(NSWindow*)parent |
69 callback:(const DesktopMediaPicker::DoneCallback&)callback | 84 callback:(const DesktopMediaPicker::DoneCallback&)callback |
70 appName:(const base::string16&)appName | 85 appName:(const base::string16&)appName |
71 targetName:(const base::string16&)targetName | 86 targetName:(const base::string16&)targetName |
72 requestAudio:(bool)requestAudio; | 87 requestAudio:(bool)requestAudio; |
73 | 88 |
74 @end | 89 @end |
75 | 90 |
76 #endif // CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_ H_ | 91 #endif // CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_ H_ |
OLD | NEW |