summaryrefslogtreecommitdiff
path: root/chromium/ui/snapshot/snapshot_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/snapshot/snapshot_mac.mm')
-rw-r--r--chromium/ui/snapshot/snapshot_mac.mm15
1 files changed, 9 insertions, 6 deletions
diff --git a/chromium/ui/snapshot/snapshot_mac.mm b/chromium/ui/snapshot/snapshot_mac.mm
index fab9c68172e..5eb36bce2b1 100644
--- a/chromium/ui/snapshot/snapshot_mac.mm
+++ b/chromium/ui/snapshot/snapshot_mac.mm
@@ -15,9 +15,10 @@
namespace ui {
-bool GrabViewSnapshot(gfx::NativeView view,
+bool GrabViewSnapshot(gfx::NativeView native_view,
const gfx::Rect& snapshot_bounds,
gfx::Image* image) {
+ NSView* view = native_view.GetNativeNSView();
NSWindow* window = [view window];
NSScreen* screen = [[NSScreen screens] firstObject];
gfx::Rect screen_bounds = gfx::Rect(NSRectToCGRect([screen frame]));
@@ -49,17 +50,18 @@ bool GrabViewSnapshot(gfx::NativeView view,
if (CGImageGetWidth(windowSnapshot) <= 0)
return false;
- NSImage* nsImage =
- [[NSImage alloc] initWithCGImage:windowSnapshot size:NSZeroSize];
- *image = gfx::Image(nsImage);
+ *image =
+ gfx::Image([[[NSImage alloc] initWithCGImage:windowSnapshot
+ size:NSZeroSize] autorelease]);
return true;
}
-bool GrabWindowSnapshot(gfx::NativeWindow window,
+bool GrabWindowSnapshot(gfx::NativeWindow native_window,
const gfx::Rect& snapshot_bounds,
gfx::Image* image) {
// Make sure to grab the "window frame" view so we get current tab +
// tabstrip.
+ NSWindow* window = native_window.GetNativeNSWindow();
return GrabViewSnapshot([[window contentView] superview], snapshot_bounds,
image);
}
@@ -78,9 +80,10 @@ void GrabViewSnapshotAsync(gfx::NativeView view,
callback.Run(gfx::Image());
}
-void GrabWindowSnapshotAsync(gfx::NativeWindow window,
+void GrabWindowSnapshotAsync(gfx::NativeWindow native_window,
const gfx::Rect& source_rect,
const GrabWindowSnapshotAsyncCallback& callback) {
+ NSWindow* window = native_window.GetNativeNSWindow();
return GrabViewSnapshotAsync([[window contentView] superview], source_rect,
callback);
}