Index: chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h |
diff --git a/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1b8dd450b10315b3ea5fc30d82cf2b7f58c9cbe8 |
--- /dev/null |
+++ b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h |
@@ -0,0 +1,72 @@ |
+// Copyright (c) 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 "base/callback.h" |
+#import "base/mac/scoped_nsobject.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/strings/string16.h" |
+#include "chrome/browser/media/desktop_media_picker.h" |
+#include "chrome/browser/media/desktop_media_picker_model.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> { |
+ @private |
+ // The dialog's label with instructions to the user. |
+ IBOutlet NSTextField* label_; |
+ |
+ // The image browser view to present sources to the user (thumbnails and |
+ // names). |
+ IBOutlet IKImageBrowserView* sourceBrowser_; |
+ |
+ // The button used to confirm the selection. |
+ IBOutlet NSButton* okButton_; |
+ |
+ // The button used to cancel and close the dialog. |
+ IBOutlet NSButton* cancelButton_; |
+ |
+ // Provides source information (including thumbnails) to fill up |items_| and |
+ // to render in |sourceBrowser_|. |
+ scoped_ptr<DesktopMediaPickerModel> model_; |
+ |
+ // To be called with the user selection. |
+ DesktopMediaPicker::DoneCallback doneCallback_; |
+ |
+ // App name invoking the service - used to format the dialog's title and |
+ // label. |
+ string16 appName_; |
+ |
+ // Array of |DesktopMediaPickerItem| used as data for |sourceBrowser_|. |
+ base::scoped_nsobject<NSMutableArray> items_; |
+ |
+ // C++ bridge to use as an observer to |model_|, that forwards obj-c |
+ // notifications to this object. |
+ scoped_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. |
+- (id)initWithModel:(scoped_ptr<DesktopMediaPickerModel>)model |
+ callback:(const DesktopMediaPicker::DoneCallback&)callback |
+ appName:(const string16&)appName; |
+ |
+- (IBAction)okPressed:(id)sender; |
+- (IBAction)cancelPressed:(id)sender; |
+ |
+@end |
+ |
+#endif // CHROME_BROWSER_UI_COCOA_MEDIA_PICKER_DESKTOP_MEDIA_PICKER_CONTROLLER_H_ |