| 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_gallery/media_galleries_dialog_controller.h" | 11 #include "chrome/browser/media_gallery/media_galleries_dialog_controller.h" |
| 12 #import "chrome/browser/ui/cocoa/constrained_window_mac.h" | 12 #import "chrome/browser/ui/cocoa/constrained_window_mac.h" |
| 13 | 13 |
| 14 @class MediaGalleriesCocoaController; | 14 @class MediaGalleriesCocoaController; |
| 15 | 15 |
| 16 namespace chrome { | 16 namespace chrome { |
| 17 | 17 |
| 18 class MediaGalleriesDialogBrowserTest; |
| 18 class MediaGalleriesDialogTest; | 19 class MediaGalleriesDialogTest; |
| 19 | 20 |
| 20 // This class displays an alert that can be used to grant permission for | 21 // This class displays an alert that can be used to grant permission for |
| 21 // extensions to access a gallery (media folders). | 22 // extensions to access a gallery (media folders). |
| 22 class MediaGalleriesDialogCocoa : | 23 class MediaGalleriesDialogCocoa : |
| 23 public ConstrainedWindowMacDelegateSystemSheet, | 24 public ConstrainedWindowMacDelegateSystemSheet, |
| 24 public MediaGalleriesDialog { | 25 public MediaGalleriesDialog { |
| 25 public: | 26 public: |
| 26 MediaGalleriesDialogCocoa( | 27 MediaGalleriesDialogCocoa( |
| 27 MediaGalleriesDialogController* controller, | 28 MediaGalleriesDialogController* controller, |
| 28 MediaGalleriesCocoaController* delegate); | 29 MediaGalleriesCocoaController* delegate); |
| 29 virtual ~MediaGalleriesDialogCocoa(); | 30 virtual ~MediaGalleriesDialogCocoa(); |
| 30 | 31 |
| 31 // Called when the user clicks the Add Gallery button. | 32 // Called when the user clicks the Add Gallery button. |
| 32 void OnAddFolderClicked(); | 33 void OnAddFolderClicked(); |
| 33 // Called when the user toggles a gallery checkbox. | 34 // Called when the user toggles a gallery checkbox. |
| 34 void OnCheckboxToggled(NSButton* checkbox); | 35 void OnCheckboxToggled(NSButton* checkbox); |
| 35 // Called when the alert closes. | 36 // Called when the alert closes. |
| 36 void SheetDidEnd(NSInteger result); | 37 void SheetDidEnd(NSInteger result); |
| 37 | 38 |
| 38 // MediaGalleriesDialog implementation: | 39 // MediaGalleriesDialog implementation: |
| 39 virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, | 40 virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, |
| 40 bool permitted) OVERRIDE; | 41 bool permitted) OVERRIDE; |
| 41 | 42 |
| 42 // ConstrainedWindowMacDelegateSystemSheet implementation. | 43 // ConstrainedWindowMacDelegateSystemSheet implementation. |
| 43 virtual void DeleteDelegate() OVERRIDE; | 44 virtual void DeleteDelegate() OVERRIDE; |
| 44 | 45 |
| 45 private: | 46 private: |
| 47 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogBrowserTest, Close); |
| 46 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); | 48 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); |
| 47 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); | 49 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); |
| 48 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); | 50 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); |
| 49 | 51 |
| 50 void UpdateGalleryCheckbox(NSButton* checkbox, | 52 void UpdateGalleryCheckbox(NSButton* checkbox, |
| 51 const MediaGalleryPrefInfo* gallery, | 53 const MediaGalleryPrefInfo* gallery, |
| 52 bool permitted); | 54 bool permitted); |
| 53 void UpdateCheckboxContainerFrame(); | 55 void UpdateCheckboxContainerFrame(); |
| 54 | 56 |
| 55 MediaGalleriesDialogController* controller_; // weak | 57 MediaGalleriesDialogController* controller_; // weak |
| (...skipping 13 matching lines...) Expand all Loading... |
| 69 | 71 |
| 70 // An Objective-C class to route callbacks from Cocoa code. | 72 // An Objective-C class to route callbacks from Cocoa code. |
| 71 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; | 73 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); | 75 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace chrome | 78 } // namespace chrome |
| 77 | 79 |
| 78 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ | 80 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
| OLD | NEW |