OLD | NEW |
| (Empty) |
1 // Copyright 2014 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_SCAN_RESULT_DIALOG_CO
COA_H_ | |
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CO
COA_H_ | |
7 | |
8 #import <Cocoa/Cocoa.h> | |
9 | |
10 #include "chrome/browser/media_galleries/media_galleries_scan_result_dialog_cont
roller.h" | |
11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | |
12 #import "chrome/browser/ui/cocoa/extensions/media_gallery_list_entry_view.h" | |
13 | |
14 @class ConstrainedWindowAlert; | |
15 @class MediaGalleriesScanResultCocoaController; | |
16 | |
17 | |
18 namespace ui { | |
19 class MenuModel; | |
20 } | |
21 | |
22 // This class displays an alert where the user selects which scan results | |
23 // (media folders) the app (extension) should have access to. | |
24 class MediaGalleriesScanResultDialogCocoa | |
25 : public ConstrainedWindowMacDelegate, | |
26 public MediaGalleriesScanResultDialog, | |
27 public MediaGalleryListEntryController { | |
28 public: | |
29 MediaGalleriesScanResultDialogCocoa( | |
30 MediaGalleriesScanResultDialogController* controller, | |
31 MediaGalleriesScanResultCocoaController* delegate); | |
32 virtual ~MediaGalleriesScanResultDialogCocoa(); | |
33 | |
34 // Called when the user clicks the accept button. | |
35 void OnAcceptClicked(); | |
36 // Called when the user clicks the cancel button. | |
37 void OnCancelClicked(); | |
38 | |
39 // MediaGalleriesScanResultDialog implementation: | |
40 virtual void UpdateResults() OVERRIDE; | |
41 | |
42 // ConstrainedWindowMacDelegate implementation. | |
43 virtual void OnConstrainedWindowClosed( | |
44 ConstrainedWindowMac* window) OVERRIDE; | |
45 | |
46 // MediaGalleryListEntryController implementation. | |
47 virtual void OnCheckboxToggled(MediaGalleryPrefId prefId, | |
48 bool checked) OVERRIDE; | |
49 virtual void OnFolderViewerClicked(MediaGalleryPrefId prefId) OVERRIDE; | |
50 virtual ui::MenuModel* GetContextMenu(MediaGalleryPrefId prefid) OVERRIDE; | |
51 | |
52 private: | |
53 friend class MediaGalleriesScanResultDialogCocoaTest; | |
54 | |
55 void InitDialogControls(); | |
56 CGFloat CreateCheckboxes(); | |
57 | |
58 // MediaGalleriesScanResultDialog implementation: | |
59 virtual void AcceptDialogForTesting() OVERRIDE; | |
60 | |
61 MediaGalleriesScanResultDialogController* controller_; // weak | |
62 scoped_ptr<ConstrainedWindowMac> window_; | |
63 | |
64 // The alert that the dialog is being displayed as. | |
65 base::scoped_nsobject<ConstrainedWindowAlert> alert_; | |
66 | |
67 // True if the user has pressed accept. | |
68 bool accepted_; | |
69 | |
70 // Container view for checkboxes. | |
71 base::scoped_nsobject<NSView> checkbox_container_; | |
72 | |
73 // Container view for the main dialog contents. | |
74 base::scoped_nsobject<NSBox> main_container_; | |
75 | |
76 // An Objective-C class to route callbacks from Cocoa code. | |
77 base::scoped_nsobject<MediaGalleriesScanResultCocoaController> | |
78 cocoa_controller_; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesScanResultDialogCocoa); | |
81 }; | |
82 | |
83 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG
_COCOA_H_ | |
OLD | NEW |