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

Side by Side Diff: content/browser/window_util_aura.cc

Issue 11399002: Implemented GetWindowSnapshot on RenderViewImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 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 "content/public/browser/window_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/compositor/compositor.h" 10 #include "ui/compositor/compositor.h"
11 #include "ui/compositor/dip_util.h" 11 #include "ui/compositor/dip_util.h"
12 #include "ui/compositor/layer.h" 12 #include "ui/compositor/layer.h"
13 #include "ui/gfx/codec/png_codec.h" 13 #include "ui/gfx/codec/png_codec.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 15
16 namespace chrome { 16 namespace content {
17 namespace internal { 17
18 bool GrabViewSnapshot(gfx::NativeView view,
19 std::vector<unsigned char>* png_representation,
20 const gfx::Rect& snapshot_bounds) {
21 return GrabWindowSnapshot(view, png_representation, snapshot_bounds);
22 }
18 23
19 bool GrabWindowSnapshot(gfx::NativeWindow window, 24 bool GrabWindowSnapshot(gfx::NativeWindow window,
20 std::vector<unsigned char>* png_representation, 25 std::vector<unsigned char>* png_representation,
21 const gfx::Rect& snapshot_bounds) { 26 const gfx::Rect& snapshot_bounds) {
22 ui::Compositor* compositor = window->layer()->GetCompositor(); 27 ui::Compositor* compositor = window->layer()->GetCompositor();
23 28
24 gfx::Rect read_pixels_bounds = snapshot_bounds; 29 gfx::Rect read_pixels_bounds = snapshot_bounds;
25 30
26 // When not in compact mode we must take into account the window's position on 31 // When not in compact mode we must take into account the window's position on
27 // the desktop. 32 // the desktop.
(...skipping 14 matching lines...) Expand all
42 47
43 gfx::PNGCodec::Encode(pixels, gfx::PNGCodec::FORMAT_BGRA, 48 gfx::PNGCodec::Encode(pixels, gfx::PNGCodec::FORMAT_BGRA,
44 read_pixels_bounds_in_pixel.size(), 49 read_pixels_bounds_in_pixel.size(),
45 bitmap.rowBytes(), true, 50 bitmap.rowBytes(), true,
46 std::vector<gfx::PNGCodec::Comment>(), 51 std::vector<gfx::PNGCodec::Comment>(),
47 png_representation); 52 png_representation);
48 return true; 53 return true;
49 } 54 }
50 55
51 } // namespace internal 56 } // namespace internal
52 } // namespace chrome 57 } // namespace chrome
jam 2012/11/09 02:21:29 nit: update
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698