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

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

Issue 10692110: screenshot disabling policy (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed Android and Mac builds 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 11 matching lines...) Expand all
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 31
32 bool GrabWindowSnapshot(gfx::NativeWindow window_handle, 32 bool GrabWindowSnapshotImpl(gfx::NativeWindow window_handle,
33 std::vector<unsigned char>* png_representation, 33 std::vector<unsigned char>* png_representation,
34 const gfx::Rect& snapshot_bounds) { 34 const gfx::Rect& snapshot_bounds) {
35 GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window_handle)); 35 GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window_handle));
36 Display* display = GDK_WINDOW_XDISPLAY(gdk_window); 36 Display* display = GDK_WINDOW_XDISPLAY(gdk_window);
37 XID win = GDK_WINDOW_XID(gdk_window); 37 XID win = GDK_WINDOW_XID(gdk_window);
38 38
39 gfx::Rect window_bounds; 39 gfx::Rect window_bounds;
40 if (ui::GetWindowRect(win, &window_bounds) == 0) { 40 if (ui::GetWindowRect(win, &window_bounds) == 0) {
41 LOG(ERROR) << "Couldn't get window bounds"; 41 LOG(ERROR) << "Couldn't get window bounds";
42 return false; 42 return false;
43 } 43 }
44 44
(...skipping 24 matching lines...) Expand all
69 return false; 69 return false;
70 } 70 }
71 cairo_surface_write_to_png_stream( 71 cairo_surface_write_to_png_stream(
72 surface, SnapshotCallback, png_representation); 72 surface, SnapshotCallback, png_representation);
73 cairo_surface_destroy(surface); 73 cairo_surface_destroy(surface);
74 74
75 return true; 75 return true;
76 } 76 }
77 77
78 } // namespace chrome 78 } // 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