| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 switch (result) { | 127 switch (result) { |
| 128 case NSAlertFirstButtonReturn: | 128 case NSAlertFirstButtonReturn: |
| 129 accepted_ = true; | 129 accepted_ = true; |
| 130 if (window_) | 130 if (window_) |
| 131 window_->CloseConstrainedWindow(); | 131 window_->CloseConstrainedWindow(); |
| 132 break; | 132 break; |
| 133 case NSAlertSecondButtonReturn: | 133 case NSAlertSecondButtonReturn: |
| 134 if (window_) | 134 if (window_) |
| 135 window_->CloseConstrainedWindow(); | 135 window_->CloseConstrainedWindow(); |
| 136 break; | 136 break; |
| 137 case NSRunStoppedResponse: |
| 138 break; |
| 137 default: | 139 default: |
| 138 NOTREACHED(); | 140 NOTREACHED(); |
| 139 break; | 141 break; |
| 140 } | 142 } |
| 141 } | 143 } |
| 142 | 144 |
| 143 void MediaGalleriesDialogCocoa::UpdateGalleryCheckbox( | 145 void MediaGalleriesDialogCocoa::UpdateGalleryCheckbox( |
| 144 NSButton* checkbox, | 146 NSButton* checkbox, |
| 145 const MediaGalleryPrefInfo* gallery, | 147 const MediaGalleryPrefInfo* gallery, |
| 146 bool permitted) { | 148 bool permitted) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 200 |
| 199 UpdateGalleryCheckbox(checkbox, gallery, permitted); | 201 UpdateGalleryCheckbox(checkbox, gallery, permitted); |
| 200 UpdateCheckboxContainerFrame(); | 202 UpdateCheckboxContainerFrame(); |
| 201 [alert_ layout]; | 203 [alert_ layout]; |
| 202 } | 204 } |
| 203 | 205 |
| 204 void MediaGalleriesDialogCocoa::DeleteDelegate() { | 206 void MediaGalleriesDialogCocoa::DeleteDelegate() { |
| 205 // As required by ConstrainedWindowMacDelegate, close the sheet if | 207 // As required by ConstrainedWindowMacDelegate, close the sheet if |
| 206 // it's still open. | 208 // it's still open. |
| 207 if (is_sheet_open()) | 209 if (is_sheet_open()) |
| 208 [NSApp endSheet:sheet()]; | 210 [NSApp endSheet:[alert_ window]]; |
| 209 | 211 |
| 210 controller_->DialogFinished(accepted_); | 212 controller_->DialogFinished(accepted_); |
| 211 } | 213 } |
| 212 | 214 |
| 213 // static | 215 // static |
| 214 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 216 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
| 215 MediaGalleriesDialogController* controller) { | 217 MediaGalleriesDialogController* controller) { |
| 216 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( | 218 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( |
| 217 [[MediaGalleriesCocoaController alloc] init]); | 219 [[MediaGalleriesCocoaController alloc] init]); |
| 218 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); | 220 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); |
| 219 } | 221 } |
| 220 | 222 |
| 221 } // namespace chrome | 223 } // namespace chrome |
| OLD | NEW |