| Index: chrome/browser/ui/window_snapshot/window_snapshot_gtk.cc
|
| diff --git a/chrome/browser/ui/window_snapshot/window_snapshot_gtk.cc b/chrome/browser/ui/window_snapshot/window_snapshot_gtk.cc
|
| index 4507996ad5264b6ab7102f84d2648e8b98d2de3a..a0eb05a2853b1a9795c3a2964567dcead04f2b7e 100644
|
| --- a/chrome/browser/ui/window_snapshot/window_snapshot_gtk.cc
|
| +++ b/chrome/browser/ui/window_snapshot/window_snapshot_gtk.cc
|
| @@ -25,7 +25,8 @@ static cairo_status_t SnapshotCallback(
|
| }
|
|
|
| gfx::Rect GrabWindowSnapshot(gfx::NativeWindow gtk_window,
|
| - std::vector<unsigned char>* png_representation) {
|
| + std::vector<unsigned char>* png_representation,
|
| + gfx::Rect snapshot_bounds) {
|
| GdkWindow* gdk_window = GTK_WIDGET(gtk_window)->window;
|
| Display* display = GDK_WINDOW_XDISPLAY(gdk_window);
|
| XID win = GDK_WINDOW_XID(gdk_window);
|
| @@ -34,8 +35,17 @@ gfx::Rect GrabWindowSnapshot(gfx::NativeWindow gtk_window,
|
| LOG(ERROR) << "Couldn't get window attributes";
|
| return gfx::Rect();
|
| }
|
| +
|
| + if (snapshot_bounds.IsEmpty()) {
|
| + snapshot_bounds = gfx::Rect(0, 0, attr.width, attr.height);
|
| + }
|
| +
|
| + DCHECK(snapshot_bounds.right() <= attr.width);
|
| + DCHECK(snapshot_bounds.bottom() <= attr.height);
|
| +
|
| XImage* image = XGetImage(
|
| - display, win, 0, 0, attr.width, attr.height, AllPlanes, ZPixmap);
|
| + display, win, snapshot_bounds.x(), snapshot_bounds.y(),
|
| + snapshot_bounds.width(), snapshot_bounds.height(), AllPlanes, ZPixmap);
|
| if (!image) {
|
| LOG(ERROR) << "Couldn't get image";
|
| return gfx::Rect();
|
|
|