| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // This class displays an alert that can be used to manage lists of media | 26 // This class displays an alert that can be used to manage lists of media |
| 27 // galleries. | 27 // galleries. |
| 28 class MediaGalleriesDialogCocoa : public ConstrainedWindowMacDelegate, | 28 class MediaGalleriesDialogCocoa : public ConstrainedWindowMacDelegate, |
| 29 public MediaGalleriesDialog, | 29 public MediaGalleriesDialog, |
| 30 public MediaGalleryListEntryController { | 30 public MediaGalleryListEntryController { |
| 31 public: | 31 public: |
| 32 MediaGalleriesDialogCocoa( | 32 MediaGalleriesDialogCocoa( |
| 33 MediaGalleriesDialogController* controller, | 33 MediaGalleriesDialogController* controller, |
| 34 MediaGalleriesCocoaController* delegate); | 34 MediaGalleriesCocoaController* delegate); |
| 35 virtual ~MediaGalleriesDialogCocoa(); | 35 ~MediaGalleriesDialogCocoa() override; |
| 36 | 36 |
| 37 // Called when the user clicks the accept button. | 37 // Called when the user clicks the accept button. |
| 38 void OnAcceptClicked(); | 38 void OnAcceptClicked(); |
| 39 // Called when the user clicks the cancel button. | 39 // Called when the user clicks the cancel button. |
| 40 void OnCancelClicked(); | 40 void OnCancelClicked(); |
| 41 // Called when the user clicks the auxiliary button. | 41 // Called when the user clicks the auxiliary button. |
| 42 void OnAuxiliaryButtonClicked(); | 42 void OnAuxiliaryButtonClicked(); |
| 43 | 43 |
| 44 // MediaGalleriesDialog implementation: | 44 // MediaGalleriesDialog implementation: |
| 45 virtual void UpdateGalleries() override; | 45 void UpdateGalleries() override; |
| 46 | 46 |
| 47 // ConstrainedWindowMacDelegate implementation. | 47 // ConstrainedWindowMacDelegate implementation. |
| 48 virtual void OnConstrainedWindowClosed( | 48 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; |
| 49 ConstrainedWindowMac* window) override; | |
| 50 | 49 |
| 51 // MediaGalleryListEntryController implementation. | 50 // MediaGalleryListEntryController implementation. |
| 52 virtual void OnCheckboxToggled(MediaGalleryPrefId pref_id, | 51 void OnCheckboxToggled(MediaGalleryPrefId pref_id, bool checked) override; |
| 53 bool checked) override; | 52 void OnFolderViewerClicked(MediaGalleryPrefId prefId) override; |
| 54 virtual void OnFolderViewerClicked(MediaGalleryPrefId prefId) override; | 53 ui::MenuModel* GetContextMenu(MediaGalleryPrefId pref_id) override; |
| 55 virtual ui::MenuModel* GetContextMenu(MediaGalleryPrefId pref_id) override; | |
| 56 | 54 |
| 57 private: | 55 private: |
| 58 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogBrowserTest, Close); | 56 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogBrowserTest, Close); |
| 59 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); | 57 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); |
| 60 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); | 58 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); |
| 61 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); | 59 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); |
| 62 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes); | 60 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes); |
| 63 | 61 |
| 64 // MediaGalleriesDialog implementation: | 62 // MediaGalleriesDialog implementation: |
| 65 virtual void AcceptDialogForTesting() override; | 63 void AcceptDialogForTesting() override; |
| 66 | 64 |
| 67 void InitDialogControls(); | 65 void InitDialogControls(); |
| 68 CGFloat CreateCheckboxes( | 66 CGFloat CreateCheckboxes( |
| 69 CGFloat y_pos, | 67 CGFloat y_pos, |
| 70 const MediaGalleriesDialogController::Entries& entries); | 68 const MediaGalleriesDialogController::Entries& entries); |
| 71 CGFloat CreateCheckboxSeparator(CGFloat y_pos, NSString* header); | 69 CGFloat CreateCheckboxSeparator(CGFloat y_pos, NSString* header); |
| 72 | 70 |
| 73 MediaGalleriesDialogController* controller_; // weak | 71 MediaGalleriesDialogController* controller_; // weak |
| 74 scoped_ptr<ConstrainedWindowMac> window_; | 72 scoped_ptr<ConstrainedWindowMac> window_; |
| 75 | 73 |
| 76 // The alert that the dialog is being displayed as. | 74 // The alert that the dialog is being displayed as. |
| 77 base::scoped_nsobject<ConstrainedWindowAlert> alert_; | 75 base::scoped_nsobject<ConstrainedWindowAlert> alert_; |
| 78 | 76 |
| 79 // True if the user has pressed accept. | 77 // True if the user has pressed accept. |
| 80 bool accepted_; | 78 bool accepted_; |
| 81 | 79 |
| 82 // Container view for checkboxes. | 80 // Container view for checkboxes. |
| 83 base::scoped_nsobject<NSView> checkbox_container_; | 81 base::scoped_nsobject<NSView> checkbox_container_; |
| 84 | 82 |
| 85 // Container view for the main dialog contents. | 83 // Container view for the main dialog contents. |
| 86 base::scoped_nsobject<NSBox> main_container_; | 84 base::scoped_nsobject<NSBox> main_container_; |
| 87 | 85 |
| 88 // An Objective-C class to route callbacks from Cocoa code. | 86 // An Objective-C class to route callbacks from Cocoa code. |
| 89 base::scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; | 87 base::scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; |
| 90 | 88 |
| 91 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); | 89 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); |
| 92 }; | 90 }; |
| 93 | 91 |
| 94 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ | 92 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
| OLD | NEW |