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..be5a8c53bb375f757316b9d979d210976ec6f2ac |
--- /dev/null |
+++ b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_item.mm |
@@ -0,0 +1,60 @@ |
+// 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" |
+ |
+#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 { |
+ // N.B. using the string instead of the constant because the latter is not in |
+ // QuartzCore, and it would be the only thing in the project requiring the |
+ // Quartz framework. |
+ return @"IKImageBrowserNSImageRepresentationType"; |
+} |
+ |
+- (NSString*)imageTitle { |
+ return imageTitle_.get(); |
+} |
+ |
+- (NSUInteger)imageVersion { |
+ return imageVersion_; |
+} |
+ |
+- (id)imageRepresentation { |
+ return image_.get(); |
+} |
+ |
+@end // @interface DesktopMediaPickerItem |