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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 [GTMUILocalizerAndLayoutTweaker sizeToFitView:button]; | 222 [GTMUILocalizerAndLayoutTweaker sizeToFitView:button]; |
223 return button.autorelease(); | 223 return button.autorelease(); |
224 } | 224 } |
225 | 225 |
226 #pragma mark NSWindowDelegate | 226 #pragma mark NSWindowDelegate |
227 | 227 |
228 - (void)windowWillClose:(NSNotification*)notification { | 228 - (void)windowWillClose:(NSNotification*)notification { |
229 // Report the result if it hasn't been reported yet. |reportResult:| ensures | 229 // Report the result if it hasn't been reported yet. |reportResult:| ensures |
230 // that the result is only reported once. | 230 // that the result is only reported once. |
231 [self reportResult:content::DesktopMediaID()]; | 231 [self reportResult:content::DesktopMediaID()]; |
| 232 |
| 233 // Remove self from the parent. |
| 234 NSWindow* window = [self window]; |
| 235 [[window parentWindow] removeChildWindow:window]; |
232 } | 236 } |
233 | 237 |
234 #pragma mark IKImageBrowserDataSource | 238 #pragma mark IKImageBrowserDataSource |
235 | 239 |
236 - (NSUInteger)numberOfItemsInImageBrowser:(IKImageBrowserView*)browser { | 240 - (NSUInteger)numberOfItemsInImageBrowser:(IKImageBrowserView*)browser { |
237 return [items_ count]; | 241 return [items_ count]; |
238 } | 242 } |
239 | 243 |
240 - (id)imageBrowser:(IKImageBrowserView *)browser | 244 - (id)imageBrowser:(IKImageBrowserView *)browser |
241 itemAtIndex:(NSUInteger)index { | 245 itemAtIndex:(NSUInteger)index { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 - (void)sourceThumbnailChangedAtIndex:(int)index { | 293 - (void)sourceThumbnailChangedAtIndex:(int)index { |
290 const DesktopMediaList::Source& source = media_list_->GetSource(index); | 294 const DesktopMediaList::Source& source = media_list_->GetSource(index); |
291 NSImage* image = gfx::NSImageFromImageSkia(source.thumbnail); | 295 NSImage* image = gfx::NSImageFromImageSkia(source.thumbnail); |
292 | 296 |
293 DesktopMediaPickerItem* item = [items_ objectAtIndex:index]; | 297 DesktopMediaPickerItem* item = [items_ objectAtIndex:index]; |
294 [item setImageRepresentation:image]; | 298 [item setImageRepresentation:image]; |
295 [sourceBrowser_ reloadData]; | 299 [sourceBrowser_ reloadData]; |
296 } | 300 } |
297 | 301 |
298 @end // @interface DesktopMediaPickerController | 302 @end // @interface DesktopMediaPickerController |
OLD | NEW |