OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 #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_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 #import <Quartz/Quartz.h> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #import "base/mac/scoped_nsobject.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/strings/string16.h" |
| 15 #include "chrome/browser/media/desktop_media_picker.h" |
| 16 #include "chrome/browser/media/desktop_media_picker_model.h" |
| 17 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_bridge.h" |
| 18 |
| 19 // 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 @interface DesktopMediaPickerController |
| 22 : NSWindowController<NSWindowDelegate, DesktopMediaPickerObserver> { |
| 23 @private |
| 24 // The image browser view to present sources to the user (thumbnails and |
| 25 // names). |
| 26 base::scoped_nsobject<IKImageBrowserView> sourceBrowser_; |
| 27 |
| 28 // The button used to confirm the selection. |
| 29 NSButton* okButton_; // weak; owned by contentView |
| 30 |
| 31 // The button used to cancel and close the dialog. |
| 32 NSButton* cancelButton_; // weak; owned by contentView |
| 33 |
| 34 // Provides source information (including thumbnails) to fill up |items_| and |
| 35 // to render in |sourceBrowser_|. |
| 36 scoped_ptr<DesktopMediaPickerModel> model_; |
| 37 |
| 38 // To be called with the user selection. |
| 39 DesktopMediaPicker::DoneCallback doneCallback_; |
| 40 |
| 41 // Array of |DesktopMediaPickerItem| used as data for |sourceBrowser_|. |
| 42 base::scoped_nsobject<NSMutableArray> items_; |
| 43 |
| 44 // C++ bridge to use as an observer to |model_|, that forwards obj-c |
| 45 // notifications to this object. |
| 46 scoped_ptr<DesktopMediaPickerBridge> bridge_; |
| 47 |
| 48 // Used to create |DesktopMediaPickerItem|s with unique IDs. |
| 49 int lastImageUID_; |
| 50 } |
| 51 |
| 52 // Designated initializer. |
| 53 // To show the dialog, use |NSWindowController|'s |showWindow:|. |
| 54 // |callback| will be called to report the user's selection. |
| 55 // |appName| will be used to format the dialog's title and the label. |
| 56 - (id)initWithModel:(scoped_ptr<DesktopMediaPickerModel>)model |
| 57 callback:(const DesktopMediaPicker::DoneCallback&)callback |
| 58 appName:(const string16&)appName; |
| 59 |
| 60 @end |
| 61 |
| 62 #endif // CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_
H_ |
OLD | NEW |