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 "chrome/browser/ui/tab_contents/tab_contents.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 [alert_ setAccessoryView:checkbox_container_]; | 88 [alert_ setAccessoryView:checkbox_container_]; |
89 | 89 |
90 // 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 |
91 // confirming, the button will be unavailable for dialogs without any checks | 91 // confirming, the button will be unavailable for dialogs without any checks |
92 // until the user toggles something. | 92 // until the user toggles something. |
93 [[[alert_ buttons] objectAtIndex:0] setEnabled: | 93 [[[alert_ buttons] objectAtIndex:0] setEnabled: |
94 controller_->HasPermittedGalleries()]; | 94 controller_->HasPermittedGalleries()]; |
95 | 95 |
96 set_sheet(alert_); | 96 set_sheet(alert_); |
97 // May be NULL during tests. | 97 // May be NULL during tests. |
98 if (controller->tab_contents()) { | 98 if (controller->web_contents()) |
99 window_ = new ConstrainedWindowMac( | 99 window_ = new ConstrainedWindowMac(controller->web_contents(), this); |
100 controller->tab_contents()->web_contents(), this); | |
101 } | |
102 } | 100 } |
103 | 101 |
104 MediaGalleriesDialogCocoa::~MediaGalleriesDialogCocoa() { | 102 MediaGalleriesDialogCocoa::~MediaGalleriesDialogCocoa() { |
105 } | 103 } |
106 | 104 |
107 void MediaGalleriesDialogCocoa::OnAddFolderClicked() { | 105 void MediaGalleriesDialogCocoa::OnAddFolderClicked() { |
108 controller_->OnAddFolderClicked(); | 106 controller_->OnAddFolderClicked(); |
109 } | 107 } |
110 | 108 |
111 void MediaGalleriesDialogCocoa::OnCheckboxToggled(NSButton* checkbox) { | 109 void MediaGalleriesDialogCocoa::OnCheckboxToggled(NSButton* checkbox) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 212 |
215 // static | 213 // static |
216 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 214 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
217 MediaGalleriesDialogController* controller) { | 215 MediaGalleriesDialogController* controller) { |
218 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( | 216 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( |
219 [[MediaGalleriesCocoaController alloc] init]); | 217 [[MediaGalleriesCocoaController alloc] init]); |
220 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); | 218 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); |
221 } | 219 } |
222 | 220 |
223 } // namespace chrome | 221 } // namespace chrome |
OLD | NEW |