[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / extensions / media_galleries_scan_result_dialog_cocoa.h
blobeada976a3ea872bc50a918fcd42b6969dcc46742
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.
5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_COCOA_H_
8 #import <Cocoa/Cocoa.h>
10 #include "chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.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"
14 @class ConstrainedWindowAlert;
15 @class MediaGalleriesScanResultCocoaController;
18 namespace ui {
19 class MenuModel;
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();
34 // Called when the user clicks the accept button.
35 void OnAcceptClicked();
36 // Called when the user clicks the cancel button.
37 void OnCancelClicked();
39 // MediaGalleriesScanResultDialog implementation:
40 virtual void UpdateResults() OVERRIDE;
42 // ConstrainedWindowMacDelegate implementation.
43 virtual void OnConstrainedWindowClosed(
44 ConstrainedWindowMac* window) OVERRIDE;
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;
52 private:
53 friend class MediaGalleriesScanResultDialogCocoaTest;
55 void InitDialogControls();
56 CGFloat CreateCheckboxes();
58 // MediaGalleriesScanResultDialog implementation:
59 virtual void AcceptDialogForTesting() OVERRIDE;
61 MediaGalleriesScanResultDialogController* controller_; // weak
62 scoped_ptr<ConstrainedWindowMac> window_;
64 // The alert that the dialog is being displayed as.
65 base::scoped_nsobject<ConstrainedWindowAlert> alert_;
67 // True if the user has pressed accept.
68 bool accepted_;
70 // Container view for checkboxes.
71 base::scoped_nsobject<NSView> checkbox_container_;
73 // Container view for the main dialog contents.
74 base::scoped_nsobject<NSBox> main_container_;
76 // An Objective-C class to route callbacks from Cocoa code.
77 base::scoped_nsobject<MediaGalleriesScanResultCocoaController>
78 cocoa_controller_;
80 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesScanResultDialogCocoa);
83 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_COCOA_H_