| 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/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 namespace chrome { | 17 namespace chrome { |
| 18 | 18 |
| 19 class MediaGalleriesDialogBrowserTest; | 19 class MediaGalleriesDialogBrowserTest; |
| 20 class MediaGalleriesDialogTest; | 20 class MediaGalleriesDialogTest; |
| 21 | 21 |
| 22 // This class displays an alert that can be used to grant permission for | 22 // This class displays an alert that can be used to grant permission for |
| 23 // extensions to access a gallery (media folders). | 23 // extensions to access a gallery (media folders). |
| 24 class MediaGalleriesDialogCocoa : | 24 class MediaGalleriesDialogCocoa : public ConstrainedWindowMacDelegate, |
| 25 public ConstrainedWindowMacDelegate, | 25 public MediaGalleriesDialog { |
| 26 public MediaGalleriesDialog { | |
| 27 public: | 26 public: |
| 28 MediaGalleriesDialogCocoa( | 27 MediaGalleriesDialogCocoa( |
| 29 MediaGalleriesDialogController* controller, | 28 MediaGalleriesDialogController* controller, |
| 30 MediaGalleriesCocoaController* delegate); | 29 MediaGalleriesCocoaController* delegate); |
| 31 virtual ~MediaGalleriesDialogCocoa(); | 30 virtual ~MediaGalleriesDialogCocoa(); |
| 32 | 31 |
| 33 // Called when the user clicks the accept button. | 32 // Called when the user clicks the accept button. |
| 34 void OnAcceptClicked(); | 33 void OnAcceptClicked(); |
| 35 // Called when the user clicks the cancel button. | 34 // Called when the user clicks the cancel button. |
| 36 void OnCancelClicked(); | 35 void OnCancelClicked(); |
| 37 // Called when the user clicks the Add Gallery button. | 36 // Called when the user clicks the Add Gallery button. |
| 38 void OnAddFolderClicked(); | 37 void OnAddFolderClicked(); |
| 39 // Called when the user toggles a gallery checkbox. | 38 // Called when the user toggles a gallery checkbox. |
| 40 void OnCheckboxToggled(NSButton* checkbox); | 39 void OnCheckboxToggled(NSButton* checkbox); |
| 41 | 40 |
| 42 // MediaGalleriesDialog implementation: | 41 // MediaGalleriesDialog implementation: |
| 43 virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, | 42 virtual void UpdateGallery(const MediaGalleryPrefInfo* gallery, |
| 44 bool permitted) OVERRIDE; | 43 bool permitted) OVERRIDE; |
| 44 virtual void ForgetGallery(const MediaGalleryPrefInfo* gallery) OVERRIDE; |
| 45 | 45 |
| 46 // ConstrainedWindowMacDelegate implementation. | 46 // ConstrainedWindowMacDelegate implementation. |
| 47 virtual void OnConstrainedWindowClosed( | 47 virtual void OnConstrainedWindowClosed( |
| 48 ConstrainedWindowMac* window) OVERRIDE; | 48 ConstrainedWindowMac* window) OVERRIDE; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogBrowserTest, Close); | 51 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogBrowserTest, Close); |
| 52 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); | 52 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, InitializeCheckboxes); |
| 53 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); | 53 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ToggleCheckboxes); |
| 54 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); | 54 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, UpdateAdds); |
| 55 FRIEND_TEST_ALL_PREFIXES(MediaGalleriesDialogTest, ForgetDeletes); |
| 56 |
| 57 NSButton* CheckboxForGallery(const MediaGalleryPrefInfo* gallery); |
| 55 | 58 |
| 56 void UpdateGalleryCheckbox(NSButton* checkbox, | 59 void UpdateGalleryCheckbox(NSButton* checkbox, |
| 57 const MediaGalleryPrefInfo* gallery, | 60 const MediaGalleryPrefInfo* gallery, |
| 58 bool permitted); | 61 bool permitted); |
| 59 void UpdateCheckboxContainerFrame(); | 62 void UpdateCheckboxContainerFrame(); |
| 60 | 63 |
| 61 MediaGalleriesDialogController* controller_; // weak | 64 MediaGalleriesDialogController* controller_; // weak |
| 62 scoped_ptr<ConstrainedWindowMac> window_; | 65 scoped_ptr<ConstrainedWindowMac> window_; |
| 63 | 66 |
| 64 // True if the user has pressed accept. | 67 // True if the user has pressed accept. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 | 78 |
| 76 // An Objective-C class to route callbacks from Cocoa code. | 79 // An Objective-C class to route callbacks from Cocoa code. |
| 77 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; | 80 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller_; |
| 78 | 81 |
| 79 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); | 82 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogCocoa); |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } // namespace chrome | 85 } // namespace chrome |
| 83 | 86 |
| 84 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ | 87 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_MEDIA_GALLERIES_DIALOG_COCOA_H_ |
| OLD | NEW |