Chromium Code Reviews| Index: chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.mm |
| diff --git a/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.mm b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8928d238083ff04c6babad9cc0508cee162c5846 |
| --- /dev/null |
| +++ b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.mm |
| @@ -0,0 +1,59 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.h" |
| + |
| +#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
|
| + |
| +#include "chrome/browser/media/desktop_media_picker_model.h" |
| + |
| +@implementation DesktopMediaPickerItem |
| + |
| +- (id)initWithSourceId:(content::DesktopMediaID)sourceId |
| + imageUID:(int)imageUID |
| + imageTitle:(NSString*)imageTitle { |
| + if ((self = [super init])) { |
| + sourceId_ = sourceId; |
| + imageUID_.reset([[NSString stringWithFormat:@"%d", imageUID] retain]); |
| + imageTitle_.reset([imageTitle retain]); |
| + } |
| + return self; |
| +} |
| + |
| +- (content::DesktopMediaID)sourceId { |
| + return sourceId_; |
| +} |
| + |
| +- (void)setImageRepresentation:(NSImage*)image { |
| + image_.reset([image retain]); |
| + imageVersion_++; |
| +} |
| + |
| +- (void)setImageTitle:(NSString*)imageTitle { |
| + imageTitle_.reset([imageTitle copy]); |
| +} |
| + |
| +#pragma mark IKImageBrowserItem |
| + |
| +- (NSString*)imageUID { |
| + return imageUID_; |
| +} |
| + |
| +- (NSString*)imageRepresentationType { |
| + 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
|
| +} |
| + |
| +- (NSString*)imageTitle { |
| + return imageTitle_.get(); |
| +} |
| + |
| +- (NSUInteger)imageVersion { |
| + return imageVersion_; |
| +} |
| + |
| +- (id)imageRepresentation { |
| + return image_.get(); |
| +} |
| + |
| +@end // @interface DesktopMediaPickerItem |