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 dialog's label with instructions to the user. |
| 25 IBOutlet NSTextField* label_; |
| 26 |
| 27 // The image browser view to present sources to the user (thumbnails and |
| 28 // names). |
| 29 IBOutlet IKImageBrowserView* sourceBrowser_; |
| 30 |
| 31 // The button used to confirm the selection. |
| 32 IBOutlet NSButton* okButton_; |
| 33 |
| 34 // The button used to cancel and close the dialog. |
| 35 IBOutlet NSButton* cancelButton_; |
| 36 |
| 37 // Provides source information (including thumbnails) to fill up |items_| and |
| 38 // to render in |sourceBrowser_|. |
| 39 scoped_ptr<DesktopMediaPickerModel> model_; |
| 40 |
| 41 // To be called with the user selection. |
| 42 DesktopMediaPicker::DoneCallback doneCallback_; |
| 43 |
| 44 // App name invoking the service - used to format the dialog's title and |
| 45 // label. |
| 46 string16 appName_; |
| 47 |
| 48 // Array of |DesktopMediaPickerItem| used as data for |sourceBrowser_|. |
| 49 base::scoped_nsobject<NSMutableArray> items_; |
| 50 |
| 51 // C++ bridge to use as an observer to |model_|, that forwards obj-c |
| 52 // notifications to this object. |
| 53 scoped_ptr<DesktopMediaPickerBridge> bridge_; |
| 54 |
| 55 // Used to create |DesktopMediaPickerItem|s with unique IDs. |
| 56 int lastImageUID_; |
| 57 } |
| 58 |
| 59 // Designated initializer. |
| 60 // To show the dialog, use |NSWindowController|'s |showWindow:|. |
| 61 // |callback| will be called to report the user's selection. |
| 62 // |appName| will be used to format the dialog's title and the label. |
| 63 - (id)initWithModel:(scoped_ptr<DesktopMediaPickerModel>)model |
| 64 callback:(const DesktopMediaPicker::DoneCallback&)callback |
| 65 appName:(const string16&)appName; |
| 66 |
| 67 - (IBAction)okPressed:(id)sender; |
| 68 - (IBAction)cancelPressed:(id)sender; |
| 69 |
| 70 @end |
| 71 |
| 72 #endif // CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_
H_ |
OLD | NEW |