OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h" | 5 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #import "base/mac/bundle_locations.h" | 8 #import "base/mac/bundle_locations.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.h" | 10 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 bridge_.reset(new DesktopMediaPickerBridge(self)); | 78 bridge_.reset(new DesktopMediaPickerBridge(self)); |
79 } | 79 } |
80 return self; | 80 return self; |
81 } | 81 } |
82 | 82 |
83 - (void)dealloc { | 83 - (void)dealloc { |
84 [shareButton_ setTarget:nil]; | 84 [shareButton_ setTarget:nil]; |
85 [cancelButton_ setTarget:nil]; | 85 [cancelButton_ setTarget:nil]; |
86 [sourceBrowser_ setDelegate:nil]; | 86 [sourceBrowser_ setDelegate:nil]; |
87 [sourceBrowser_ setDataSource:nil]; | 87 [sourceBrowser_ setDataSource:nil]; |
| 88 [[self window] close]; |
88 [super dealloc]; | 89 [super dealloc]; |
89 } | 90 } |
90 | 91 |
91 - (void)initializeContentsWithAppName:(const base::string16&)appName | 92 - (void)initializeContentsWithAppName:(const base::string16&)appName |
92 targetName:(const base::string16&)targetName { | 93 targetName:(const base::string16&)targetName { |
93 // Use flipped coordinates to facilitate manual layout. | 94 // Use flipped coordinates to facilitate manual layout. |
94 const CGFloat kPaddedWidth = kInitialContentWidth - (kFramePadding * 2); | 95 const CGFloat kPaddedWidth = kInitialContentWidth - (kFramePadding * 2); |
95 base::scoped_nsobject<FlippedView> content( | 96 base::scoped_nsobject<FlippedView> content( |
96 [[FlippedView alloc] initWithFrame:NSZeroRect]); | 97 [[FlippedView alloc] initWithFrame:NSZeroRect]); |
97 [[self window] setContentView:content]; | 98 [[self window] setContentView:content]; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 - (void)sourceThumbnailChangedAtIndex:(int)index { | 313 - (void)sourceThumbnailChangedAtIndex:(int)index { |
313 const DesktopMediaList::Source& source = media_list_->GetSource(index); | 314 const DesktopMediaList::Source& source = media_list_->GetSource(index); |
314 NSImage* image = gfx::NSImageFromImageSkia(source.thumbnail); | 315 NSImage* image = gfx::NSImageFromImageSkia(source.thumbnail); |
315 | 316 |
316 DesktopMediaPickerItem* item = [items_ objectAtIndex:index]; | 317 DesktopMediaPickerItem* item = [items_ objectAtIndex:index]; |
317 [item setImageRepresentation:image]; | 318 [item setImageRepresentation:image]; |
318 [sourceBrowser_ reloadData]; | 319 [sourceBrowser_ reloadData]; |
319 } | 320 } |
320 | 321 |
321 @end // @interface DesktopMediaPickerController | 322 @end // @interface DesktopMediaPickerController |
OLD | NEW |