Chromium Code Reviews| 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 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" | 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" |
| 9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" | 9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" |
| 10 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" | 10 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 checkbox = button; | 208 checkbox = button; |
| 209 break; | 209 break; |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 UpdateGalleryCheckbox(checkbox, gallery, permitted); | 213 UpdateGalleryCheckbox(checkbox, gallery, permitted); |
| 214 UpdateCheckboxContainerFrame(); | 214 UpdateCheckboxContainerFrame(); |
| 215 [alert_ layout]; | 215 [alert_ layout]; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void MediaGalleriesDialogCocoa::ForgetGallery( | |
| 219 const MediaGalleryPrefInfo* gallery) { | |
| 220 NSUInteger index = 0; | |
| 221 NSString* unique_id = GetUniqueIDForGallery(gallery); | |
| 222 | |
| 223 for (NSButton* button in checkboxes_.get()) { | |
| 224 if ([[[button cell] representedObject] isEqual:unique_id]) { | |
| 225 [checkboxes_ removeObjectAtIndex:index]; | |
|
sail
2013/02/08 19:48:22
Hm.. is this ok to do while the iterator is still
Lei Zhang
2013/02/08 20:48:02
Done.
BTW, I changed the test to forget the galle
| |
| 226 UpdateCheckboxContainerFrame(); | |
| 227 [alert_ layout]; | |
| 228 return; | |
| 229 } | |
| 230 ++index; | |
| 231 } | |
| 232 | |
| 233 } | |
| 234 | |
| 218 void MediaGalleriesDialogCocoa::OnConstrainedWindowClosed( | 235 void MediaGalleriesDialogCocoa::OnConstrainedWindowClosed( |
| 219 ConstrainedWindowMac* window) { | 236 ConstrainedWindowMac* window) { |
| 220 controller_->DialogFinished(accepted_); | 237 controller_->DialogFinished(accepted_); |
| 221 } | 238 } |
| 222 | 239 |
| 223 // static | 240 // static |
| 224 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 241 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
| 225 MediaGalleriesDialogController* controller) { | 242 MediaGalleriesDialogController* controller) { |
| 226 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( | 243 scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( |
| 227 [[MediaGalleriesCocoaController alloc] init]); | 244 [[MediaGalleriesCocoaController alloc] init]); |
| 228 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); | 245 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); |
| 229 } | 246 } |
| 230 | 247 |
| 231 } // namespace chrome | 248 } // namespace chrome |
| OLD | NEW |