Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8306)

Unified Diff: chrome/browser/ui/window_snapshot/window_snapshot_mac.mm

Issue 8523022: Change snasphotting API to take in a bounds Rect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/window_snapshot/window_snapshot_mac.mm
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot_mac.mm b/chrome/browser/ui/window_snapshot/window_snapshot_mac.mm
index ab790872e0db1c88dd5602bf31d0f384e2623306..134a0deeb53ea0aaa42006168ae6d879dbe16953 100644
--- a/chrome/browser/ui/window_snapshot/window_snapshot_mac.mm
+++ b/chrome/browser/ui/window_snapshot/window_snapshot_mac.mm
@@ -14,9 +14,19 @@
namespace browser {
gfx::Rect GrabWindowSnapshot(gfx::NativeWindow window,
- std::vector<unsigned char>* png_representation) {
+ std::vector<unsigned char>* png_representation,
+ gfx::Rect snapshot_bounds) {
png_representation->clear();
+ CGRect windowRect = CGRectNUll;
+ if (!snapshot_bounds.IsEmpty()) {
+ gfx::Rect window_bounds = gfx::Rect([window frame]);
+ snapshot_bounds.Offset(window_bounds.left(), window_bounds.top());
+ windowRect = snapshot_bounds.ToCGRect();
+ DCHECK(snapshot_bounds.right() <= window_bounds.right());
+ DCHECK(snapshot_bounds.bottom() <= window_bounds.bottom());
+ }
+
// Make sure to grab the "window frame" view so we get current tab +
// tabstrip.
NSView* view = [[window contentView] superview];

Powered by Google App Engine
This is Rietveld 408576698