OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.h" |
| 6 |
| 7 #include "chrome/browser/media/desktop_media_picker_model.h" |
| 8 |
| 9 @implementation DesktopMediaPickerItem |
| 10 |
| 11 - (id)initWithSourceId:(content::DesktopMediaID)sourceID |
| 12 imageUID:(int)imageUID |
| 13 imageTitle:(NSString*)imageTitle { |
| 14 if ((self = [super init])) { |
| 15 sourceID_ = sourceID; |
| 16 imageUID_.reset([[NSString stringWithFormat:@"%d", imageUID] retain]); |
| 17 imageTitle_.reset([imageTitle retain]); |
| 18 } |
| 19 return self; |
| 20 } |
| 21 |
| 22 - (content::DesktopMediaID)sourceID { |
| 23 return sourceID_; |
| 24 } |
| 25 |
| 26 - (void)setImageRepresentation:(NSImage*)image { |
| 27 image_.reset([image retain]); |
| 28 imageVersion_++; |
| 29 } |
| 30 |
| 31 - (void)setImageTitle:(NSString*)imageTitle { |
| 32 imageTitle_.reset([imageTitle copy]); |
| 33 } |
| 34 |
| 35 #pragma mark IKImageBrowserItem |
| 36 |
| 37 - (NSString*)imageUID { |
| 38 return imageUID_; |
| 39 } |
| 40 |
| 41 - (NSString*)imageRepresentationType { |
| 42 // N.B. using the string instead of the constant because the latter is not in |
| 43 // QuartzCore, and it would be the only thing in the project requiring the |
| 44 // Quartz framework. |
| 45 return @"IKImageBrowserNSImageRepresentationType"; |
| 46 } |
| 47 |
| 48 - (NSString*)imageTitle { |
| 49 return imageTitle_.get(); |
| 50 } |
| 51 |
| 52 - (NSUInteger)imageVersion { |
| 53 return imageVersion_; |
| 54 } |
| 55 |
| 56 - (id)imageRepresentation { |
| 57 return image_.get(); |
| 58 } |
| 59 |
| 60 @end // @interface DesktopMediaPickerItem |
OLD | NEW |