Chromium Code Reviews| 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 #import <Quartz/Quartz.h> | |
|
Robert Sesek
2013/09/04 20:23:19
What's Quartzy in this file?
dcaiafa
2013/09/04 21:39:35
The IKImageBrowserNSImageRepresentationType consta
| |
| 8 | |
| 9 #include "chrome/browser/media/desktop_media_picker_model.h" | |
| 10 | |
| 11 @implementation DesktopMediaPickerItem | |
| 12 | |
| 13 - (id)initWithSourceId:(content::DesktopMediaID)sourceId | |
| 14 imageUID:(int)imageUID | |
| 15 imageTitle:(NSString*)imageTitle { | |
| 16 if ((self = [super init])) { | |
| 17 sourceId_ = sourceId; | |
| 18 imageUID_.reset([[NSString stringWithFormat:@"%d", imageUID] retain]); | |
| 19 imageTitle_.reset([imageTitle retain]); | |
| 20 } | |
| 21 return self; | |
| 22 } | |
| 23 | |
| 24 - (content::DesktopMediaID)sourceId { | |
| 25 return sourceId_; | |
| 26 } | |
| 27 | |
| 28 - (void)setImageRepresentation:(NSImage*)image { | |
| 29 image_.reset([image retain]); | |
| 30 imageVersion_++; | |
| 31 } | |
| 32 | |
| 33 - (void)setImageTitle:(NSString*)imageTitle { | |
| 34 imageTitle_.reset([imageTitle copy]); | |
| 35 } | |
| 36 | |
| 37 #pragma mark IKImageBrowserItem | |
| 38 | |
| 39 - (NSString*)imageUID { | |
| 40 return imageUID_; | |
| 41 } | |
| 42 | |
| 43 - (NSString*)imageRepresentationType { | |
| 44 return @"IKImageBrowserNSImageRepresentationType"; | |
|
Robert Sesek
2013/09/04 20:23:19
Is there not a constant for this?
dcaiafa
2013/09/04 21:39:35
Yes. But unfortunately, it requires the Quartz fra
| |
| 45 } | |
| 46 | |
| 47 - (NSString*)imageTitle { | |
| 48 return imageTitle_.get(); | |
| 49 } | |
| 50 | |
| 51 - (NSUInteger)imageVersion { | |
| 52 return imageVersion_; | |
| 53 } | |
| 54 | |
| 55 - (id)imageRepresentation { | |
| 56 return image_.get(); | |
| 57 } | |
| 58 | |
| 59 @end // @interface DesktopMediaPickerItem | |
| OLD | NEW |