OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h" |
| 11 #import "chrome/browser/ui/cocoa/constrained_window_mac.h" |
| 12 |
| 13 @class MediaGalleriesCocoaController; |
| 14 |
| 15 namespace chrome { |
| 16 |
| 17 // This class displays an alert that can be used to grant permission for |
| 18 // extensions to access a gallery (media folders). |
| 19 class MediaGalleriesDialogCocoa : |
| 20 public ConstrainedWindowMacDelegateSystemSheet, |
| 21 public MediaGalleriesDialog { |
| 22 public: |
| 23 MediaGalleriesDialogCocoa( |
| 24 MediaGalleriesDialogController* controller, |
| 25 MediaGalleriesCocoaController* delegate); |
| 26 virtual ~MediaGalleriesDialogCocoa(); |
| 27 |
| 28 // Called when the user clicks the Add Gallery button. |
| 29 void OnAddFolderClicked(); |
| 30 // Called when the user toggles a gallery checkbox. |
| 31 void OnCheckboxToggled(NSButton* checkbox); |
| 32 // Called when the alert closes. |
| 33 void SheetDidEnd(NSInteger result); |
| 34 |
| 35 // MediaGalleriesDialog implementation: |
| 36 virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, |
| 37 bool permitted) OVERRIDE; |
| 38 |
| 39 // ConstrainedWindowMacDelegateSystemSheet implementation. |
| 40 virtual void DeleteDelegate() OVERRIDE; |
| 41 |
| 42 private: |
| 43 void UpdateGalleryCheckbox(NSButton* checkbox, |
| 44 const MediaGalleryPrefInfo* gallery, |
| 45 bool permitted); |
| 46 void UpdateCheckboxContainerFrame(); |
| 47 |
| 48 MediaGalleriesDialogController* controller_; // weak |
| 49 ConstrainedWindow* window_; // weak |
| 50 |
| 51 // True if the user has pressed accept. |
| 52 bool accepted_; |
| 53 |
| 54 // List of checkboxes ordered from bottom to top. |
| 55 scoped_nsobject<NSMutableArray> checkboxes_; |
| 56 |
| 57 // Container view for checkboxes. |
| 58 scoped_nsobject<NSView> checkbox_container_; |
| 59 |
| 60 // The alert that the dialog is being displayed as. |
| 61 scoped_nsobject<NSAlert> alert_; |
| 62 |
| 63 // An Objective-C class to route callbacks from Cocoa code. |
| 64 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); |
| 67 }; |
| 68 |
| 69 } // namespace chrome |
| 70 |
| 71 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
OLD | NEW |