| 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" |
| 11 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" | 11 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" |
| 12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 13 | 13 |
| 14 @class ConstrainedWindowAlert; | 14 @class ConstrainedWindowAlert; |
| 15 @class MediaGalleriesCocoaController; | 15 @class MediaGalleriesCocoaController; |
| 16 | 16 |
| 17 class MediaGalleriesDialogBrowserTest; | 17 class MediaGalleriesDialogBrowserTest; |
| 18 class MediaGalleriesDialogTest; | 18 class MediaGalleriesDialogTest; |
| 19 | 19 |
| 20 namespace ui { |
| 21 class MenuModel; |
| 22 } |
| 23 |
| 20 // This class displays an alert that can be used to grant permission for | 24 // This class displays an alert that can be used to grant permission for |
| 21 // extensions to access a gallery (media folders). | 25 // extensions to access a gallery (media folders). |
| 22 class MediaGalleriesDialogCocoa : public ConstrainedWindowMacDelegate, | 26 class MediaGalleriesDialogCocoa : public ConstrainedWindowMacDelegate, |
| 23 public MediaGalleriesDialog { | 27 public MediaGalleriesDialog { |
| 24 public: | 28 public: |
| 25 MediaGalleriesDialogCocoa( | 29 MediaGalleriesDialogCocoa( |
| 26 MediaGalleriesDialogController* controller, | 30 MediaGalleriesDialogController* controller, |
| 27 MediaGalleriesCocoaController* delegate); | 31 MediaGalleriesCocoaController* delegate); |
| 28 virtual ~MediaGalleriesDialogCocoa(); | 32 virtual ~MediaGalleriesDialogCocoa(); |
| 29 | 33 |
| 30 // Called when the user clicks the accept button. | 34 // Called when the user clicks the accept button. |
| 31 void OnAcceptClicked(); | 35 void OnAcceptClicked(); |
| 32 // Called when the user clicks the cancel button. | 36 // Called when the user clicks the cancel button. |
| 33 void OnCancelClicked(); | 37 void OnCancelClicked(); |
| 34 // Called when the user clicks the Add Gallery button. | 38 // Called when the user clicks the Add Gallery button. |
| 35 void OnAddFolderClicked(); | 39 void OnAddFolderClicked(); |
| 36 // Called when the user toggles a gallery checkbox. | 40 // Called when the user toggles a gallery checkbox. |
| 37 void OnCheckboxToggled(NSButton* checkbox); | 41 void OnCheckboxToggled(NSButton* checkbox); |
| 38 | 42 |
| 39 // MediaGalleriesDialog implementation: | 43 // MediaGalleriesDialog implementation: |
| 40 virtual void UpdateGalleries() OVERRIDE; | 44 virtual void UpdateGalleries() OVERRIDE; |
| 41 | 45 |
| 42 // ConstrainedWindowMacDelegate implementation. | 46 // ConstrainedWindowMacDelegate implementation. |
| 43 virtual void OnConstrainedWindowClosed( | 47 virtual void OnConstrainedWindowClosed( |
| 44 ConstrainedWindowMac* window) OVERRIDE; | 48 ConstrainedWindowMac* window) OVERRIDE; |
| 45 | 49 |
| 50 ui::MenuModel* GetContextMenuModel(MediaGalleryPrefId prefid); |
| 51 |
| 46 private: | 52 private: |
| 47 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogBrowserTest, Close); | 53 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogBrowserTest, Close); |
| 48 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); | 54 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); |
| 49 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); | 55 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); |
| 50 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); | 56 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); |
| 51 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes); | 57 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes); |
| 52 | 58 |
| 53 void UpdateGalleryCheckbox(const MediaGalleryPrefInfo& gallery, | 59 void UpdateGalleryCheckbox(const MediaGalleryPrefInfo& gallery, |
| 54 bool permitted, | 60 bool permitted, |
| 55 CGFloat y_pos); | 61 CGFloat y_pos); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 84 // Container view for the main dialog contents. | 90 // Container view for the main dialog contents. |
| 85 base::scoped_nsobject<NSBox> accessory_; | 91 base::scoped_nsobject<NSBox> accessory_; |
| 86 | 92 |
| 87 // An Objective-C class to route callbacks from Cocoa code. | 93 // An Objective-C class to route callbacks from Cocoa code. |
| 88 base::scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; | 94 base::scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; |
| 89 | 95 |
| 90 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); | 96 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); |
| 91 }; | 97 }; |
| 92 | 98 |
| 93 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ | 99 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
| OLD | NEW |