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 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" |
6 | 6 |
7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
| 8 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
8 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
9 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
10 | 11 |
11 const CGFloat kCheckboxMargin = 5; | 12 const CGFloat kCheckboxMargin = 5; |
12 const CGFloat kCheckboxMaxWidth = 350; | 13 const CGFloat kCheckboxMaxWidth = 350; |
13 | 14 |
14 @interface MediaGalleriesCocoaController : NSObject { | 15 @interface MediaGalleriesCocoaController : NSObject { |
15 @private | 16 @private |
16 chrome::MediaGalleriesDialogCocoa* dialog_; | 17 chrome::MediaGalleriesDialogCocoa* dialog_; |
17 } | 18 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 [alert_ setAccessoryView:checkbox_container_]; | 88 [alert_ setAccessoryView:checkbox_container_]; |
88 | 89 |
89 // As a safeguard against the user skipping reading over the dialog and just | 90 // As a safeguard against the user skipping reading over the dialog and just |
90 // confirming, the button will be unavailable for dialogs without any checks | 91 // confirming, the button will be unavailable for dialogs without any checks |
91 // until the user toggles something. | 92 // until the user toggles something. |
92 [[[alert_ buttons] objectAtIndex:0] setEnabled: | 93 [[[alert_ buttons] objectAtIndex:0] setEnabled: |
93 controller_->HasPermittedGalleries()]; | 94 controller_->HasPermittedGalleries()]; |
94 | 95 |
95 set_sheet(alert_); | 96 set_sheet(alert_); |
96 // May be NULL during tests. | 97 // May be NULL during tests. |
97 if (controller->tab_contents()) | 98 if (controller->tab_contents()) { |
98 window_ = new ConstrainedWindowMac(controller->tab_contents(), this); | 99 window_ = new ConstrainedWindowMac( |
| 100 controller->tab_contents()->web_contents(), this); |
| 101 } |
99 } | 102 } |
100 | 103 |
101 MediaGalleriesDialogCocoa::~MediaGalleriesDialogCocoa() { | 104 MediaGalleriesDialogCocoa::~MediaGalleriesDialogCocoa() { |
102 } | 105 } |
103 | 106 |
104 void MediaGalleriesDialogCocoa::OnAddFolderClicked() { | 107 void MediaGalleriesDialogCocoa::OnAddFolderClicked() { |
105 controller_->OnAddFolderClicked(); | 108 controller_->OnAddFolderClicked(); |
106 } | 109 } |
107 | 110 |
108 void MediaGalleriesDialogCocoa::OnCheckboxToggled(NSButton* checkbox) { | 111 void MediaGalleriesDialogCocoa::OnCheckboxToggled(NSButton* checkbox) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 214 |
212 // static | 215 // static |
213 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 216 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
214 MediaGalleriesDialogController* controller) { | 217 MediaGalleriesDialogController* controller) { |
215 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( | 218 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( |
216 [[MediaGalleriesCocoaController alloc] init]); | 219 [[MediaGalleriesCocoaController alloc] init]); |
217 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); | 220 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); |
218 } | 221 } |
219 | 222 |
220 } // namespace chrome | 223 } // namespace chrome |
OLD | NEW |