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

Side by Side Diff: chrome/browser/ui/window_snapshot/window_snapshot_gtk.cc

Issue 10830158: Refactor GrabWindowSnapshot and GrabWindowSnapshotImpl names to GrabWindowSnapshotForUser and GrabW… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed compiling tests, fixed indent Created 8 years, 4 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" 5 #include "chrome/browser/ui/window_snapshot/window_snapshot.h"
6 6
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
21 21
22 size_t old_size = png_representation->size(); 22 size_t old_size = png_representation->size();
23 png_representation->resize(old_size + length); 23 png_representation->resize(old_size + length);
24 memcpy(&(*png_representation)[old_size], data, length); 24 memcpy(&(*png_representation)[old_size], data, length);
25 return CAIRO_STATUS_SUCCESS; 25 return CAIRO_STATUS_SUCCESS;
26 } 26 }
27 27
28 } // namespace 28 } // namespace
29 29
30 namespace chrome { 30 namespace chrome {
31 namespace internal {
31 32
32 bool GrabWindowSnapshotImpl(gfx::NativeWindow window_handle, 33 bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
33 std::vector<unsigned char>* png_representation, 34 std::vector<unsigned char>* png_representation,
34 const gfx::Rect& snapshot_bounds) { 35 const gfx::Rect& snapshot_bounds) {
35 GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window_handle)); 36 GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window_handle));
36 Display* display = GDK_WINDOW_XDISPLAY(gdk_window); 37 Display* display = GDK_WINDOW_XDISPLAY(gdk_window);
37 XID win = GDK_WINDOW_XID(gdk_window); 38 XID win = GDK_WINDOW_XID(gdk_window);
38 39
39 gfx::Rect window_bounds; 40 gfx::Rect window_bounds;
40 if (ui::GetWindowRect(win, &window_bounds) == 0) { 41 if (ui::GetWindowRect(win, &window_bounds) == 0) {
41 LOG(ERROR) << "Couldn't get window bounds"; 42 LOG(ERROR) << "Couldn't get window bounds";
42 return false; 43 return false;
43 } 44 }
44 45
(...skipping 23 matching lines...) Expand all
68 LOG(ERROR) << "Unable to create Cairo surface from XImage data"; 69 LOG(ERROR) << "Unable to create Cairo surface from XImage data";
69 return false; 70 return false;
70 } 71 }
71 cairo_surface_write_to_png_stream( 72 cairo_surface_write_to_png_stream(
72 surface, SnapshotCallback, png_representation); 73 surface, SnapshotCallback, png_representation);
73 cairo_surface_destroy(surface); 74 cairo_surface_destroy(surface);
74 75
75 return true; 76 return true;
76 } 77 }
77 78
79 } // namespace internal
78 } // namespace chrome 80 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_snapshot/window_snapshot_aura.cc ('k') | chrome/browser/ui/window_snapshot/window_snapshot_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698