| 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/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "chrome/browser/ui/chrome_style.h" | 9 #include "chrome/browser/ui/chrome_style.h" |
| 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" | 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 prefId:(MediaGalleryPrefId)prefId { | 75 prefId:(MediaGalleryPrefId)prefId { |
| 76 if ((self = [super initWithFrame:frameRect])) { | 76 if ((self = [super initWithFrame:frameRect])) { |
| 77 dialog_ = dialog; | 77 dialog_ = dialog; |
| 78 prefId_ = prefId; | 78 prefId_ = prefId; |
| 79 } | 79 } |
| 80 return self; | 80 return self; |
| 81 } | 81 } |
| 82 | 82 |
| 83 - (NSMenu*)menuForEvent:(NSEvent*)theEvent { | 83 - (NSMenu*)menuForEvent:(NSEvent*)theEvent { |
| 84 menu_controller_.reset( | 84 menu_controller_.reset( |
| 85 [[MenuController alloc] initWithModel:dialog_->GetContextMenuModel(prefId_) | 85 [[MenuController alloc] initWithModel:dialog_->GetContextMenu(prefId_) |
| 86 useWithPopUpButtonCell:NO]); | 86 useWithPopUpButtonCell:NO]); |
| 87 return [menu_controller_ menu]; | 87 return [menu_controller_ menu]; |
| 88 } | 88 } |
| 89 | 89 |
| 90 @end | 90 @end |
| 91 | 91 |
| 92 namespace { | 92 namespace { |
| 93 | 93 |
| 94 const CGFloat kCheckboxMargin = 10; | 94 const CGFloat kCheckboxMargin = 10; |
| 95 const CGFloat kCheckboxMaxWidth = 440; | 95 const CGFloat kCheckboxMaxWidth = 440; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 381 |
| 382 void MediaGalleriesDialogCocoa::UpdateGalleries() { | 382 void MediaGalleriesDialogCocoa::UpdateGalleries() { |
| 383 InitDialogControls(); | 383 InitDialogControls(); |
| 384 } | 384 } |
| 385 | 385 |
| 386 void MediaGalleriesDialogCocoa::OnConstrainedWindowClosed( | 386 void MediaGalleriesDialogCocoa::OnConstrainedWindowClosed( |
| 387 ConstrainedWindowMac* window) { | 387 ConstrainedWindowMac* window) { |
| 388 controller_->DialogFinished(accepted_); | 388 controller_->DialogFinished(accepted_); |
| 389 } | 389 } |
| 390 | 390 |
| 391 ui::MenuModel* MediaGalleriesDialogCocoa::GetContextMenuModel( | 391 ui::MenuModel* MediaGalleriesDialogCocoa::GetContextMenu( |
| 392 MediaGalleryPrefId prefid) { | 392 MediaGalleryPrefId prefid) { |
| 393 return controller_->GetContextMenuModel(prefid); | 393 return controller_->GetContextMenu(prefid); |
| 394 } | 394 } |
| 395 | 395 |
| 396 // static | 396 // static |
| 397 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 397 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
| 398 MediaGalleriesDialogController* controller) { | 398 MediaGalleriesDialogController* controller) { |
| 399 base::scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( | 399 base::scoped_nsobject<MediaGalleriesCocoaController> cocoa_controller( |
| 400 [[MediaGalleriesCocoaController alloc] init]); | 400 [[MediaGalleriesCocoaController alloc] init]); |
| 401 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); | 401 return new MediaGalleriesDialogCocoa(controller, cocoa_controller); |
| 402 } | 402 } |
| OLD | NEW |