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> |
| 12 |
11 #include "base/callback.h" | 13 #include "base/callback.h" |
12 #import "base/mac/scoped_nsobject.h" | 14 #import "base/mac/scoped_nsobject.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
15 #include "chrome/browser/media/desktop_media_list.h" | 16 #include "chrome/browser/media/desktop_media_list.h" |
16 #include "chrome/browser/media/desktop_media_picker.h" | 17 #include "chrome/browser/media/desktop_media_picker.h" |
17 #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" |
18 | 19 |
19 // 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 |
20 // media sources for screen-capturing, and reports the result. | 21 // media sources for screen-capturing, and reports the result. |
21 @interface DesktopMediaPickerController | 22 @interface DesktopMediaPickerController |
22 : NSWindowController<NSWindowDelegate, DesktopMediaPickerObserver> { | 23 : NSWindowController<NSWindowDelegate, DesktopMediaPickerObserver> { |
23 @private | 24 @private |
24 // The image browser view to present sources to the user (thumbnails and | 25 // The image browser view to present sources to the user (thumbnails and |
25 // names). | 26 // names). |
26 base::scoped_nsobject<IKImageBrowserView> sourceBrowser_; | 27 base::scoped_nsobject<IKImageBrowserView> sourceBrowser_; |
27 | 28 |
28 // The button used to confirm the selection. | 29 // The button used to confirm the selection. |
29 NSButton* shareButton_; // weak; owned by contentView | 30 NSButton* shareButton_; // weak; owned by contentView |
30 | 31 |
31 // The button used to cancel and close the dialog. | 32 // The button used to cancel and close the dialog. |
32 NSButton* cancelButton_; // weak; owned by contentView | 33 NSButton* cancelButton_; // weak; owned by contentView |
33 | 34 |
34 // The checkbox for audio share. | 35 // The checkbox for audio share. |
35 base::scoped_nsobject<NSButton> audioShareCheckbox_; | 36 base::scoped_nsobject<NSButton> audioShareCheckbox_; |
36 | 37 |
37 // Provides source information (including thumbnails) to fill up |items_| and | 38 // Provides source information (including thumbnails) to fill up |items_| and |
38 // to render in |sourceBrowser_|. | 39 // to render in |sourceBrowser_|. |
39 scoped_ptr<DesktopMediaList> media_list_; | 40 std::unique_ptr<DesktopMediaList> media_list_; |
40 | 41 |
41 // To be called with the user selection. | 42 // To be called with the user selection. |
42 DesktopMediaPicker::DoneCallback doneCallback_; | 43 DesktopMediaPicker::DoneCallback doneCallback_; |
43 | 44 |
44 // Array of |DesktopMediaPickerItem| used as data for |sourceBrowser_|. | 45 // Array of |DesktopMediaPickerItem| used as data for |sourceBrowser_|. |
45 base::scoped_nsobject<NSMutableArray> items_; | 46 base::scoped_nsobject<NSMutableArray> items_; |
46 | 47 |
47 // C++ bridge to use as an observer to |media_list_|, that forwards obj-c | 48 // C++ bridge to use as an observer to |media_list_|, that forwards obj-c |
48 // notifications to this object. | 49 // notifications to this object. |
49 scoped_ptr<DesktopMediaPickerBridge> bridge_; | 50 std::unique_ptr<DesktopMediaPickerBridge> bridge_; |
50 | 51 |
51 // Used to create |DesktopMediaPickerItem|s with unique IDs. | 52 // Used to create |DesktopMediaPickerItem|s with unique IDs. |
52 int lastImageUID_; | 53 int lastImageUID_; |
53 } | 54 } |
54 | 55 |
55 // Designated initializer. | 56 // Designated initializer. |
56 // To show the dialog, use |NSWindowController|'s |showWindow:|. | 57 // To show the dialog, use |NSWindowController|'s |showWindow:|. |
57 // |callback| will be called to report the user's selection. | 58 // |callback| will be called to report the user's selection. |
58 // |appName| will be used to format the dialog's title and the label, where it | 59 // |appName| will be used to format the dialog's title and the label, where it |
59 // appears as the initiator of the request. | 60 // appears as the initiator of the request. |
60 // |targetName| will be used to format the dialog's label and appear as the | 61 // |targetName| will be used to format the dialog's label and appear as the |
61 // consumer of the requested stream. | 62 // consumer of the requested stream. |
62 - (id)initWithMediaList:(scoped_ptr<DesktopMediaList>)media_list | 63 - (id)initWithMediaList:(std::unique_ptr<DesktopMediaList>)media_list |
63 parent:(NSWindow*)parent | 64 parent:(NSWindow*)parent |
64 callback:(const DesktopMediaPicker::DoneCallback&)callback | 65 callback:(const DesktopMediaPicker::DoneCallback&)callback |
65 appName:(const base::string16&)appName | 66 appName:(const base::string16&)appName |
66 targetName:(const base::string16&)targetName | 67 targetName:(const base::string16&)targetName |
67 requestAudio:(bool)requestAudio; | 68 requestAudio:(bool)requestAudio; |
68 | 69 |
69 @end | 70 @end |
70 | 71 |
71 #endif // CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_
H_ | 72 #endif // CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_
H_ |
OLD | NEW |