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

Unified Diff: ui/window_snapshot/window_snapshot_aura.cc

Issue 10830135: Revert 149604 - Support calling GrabWindowSnapshot when no BrowserProcess instance is avaliable (eg… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/window_snapshot/window_snapshot.h ('k') | ui/window_snapshot/window_snapshot_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/window_snapshot/window_snapshot_aura.cc
===================================================================
--- ui/window_snapshot/window_snapshot_aura.cc (revision 149605)
+++ ui/window_snapshot/window_snapshot_aura.cc (working copy)
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/window_snapshot/window_snapshot.h"
-
-#include "base/logging.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/aura/window.h"
-#include "ui/compositor/compositor.h"
-#include "ui/compositor/dip_util.h"
-#include "ui/compositor/layer.h"
-#include "ui/gfx/codec/png_codec.h"
-#include "ui/gfx/rect.h"
-
-namespace ui {
-
-bool GrabWindowSnapshot(gfx::NativeWindow window,
- std::vector<unsigned char>* png_representation,
- const gfx::Rect& snapshot_bounds) {
- ui::Compositor* compositor = window->layer()->GetCompositor();
-
- gfx::Rect read_pixels_bounds = snapshot_bounds;
-
- // When not in compact mode we must take into account the window's position on
- // the desktop.
- read_pixels_bounds.set_origin(
- snapshot_bounds.origin().Add(window->bounds().origin()));
- gfx::Rect read_pixels_bounds_in_pixel =
- ui::ConvertRectToPixel(window->layer(), read_pixels_bounds);
-
- DCHECK_GE(compositor->size().width(), read_pixels_bounds_in_pixel.right());
- DCHECK_GE(compositor->size().height(), read_pixels_bounds_in_pixel.bottom());
- DCHECK_LE(0, read_pixels_bounds.x());
- DCHECK_LE(0, read_pixels_bounds.y());
-
- SkBitmap bitmap;
- if (!compositor->ReadPixels(&bitmap, read_pixels_bounds_in_pixel))
- return false;
-
- unsigned char* pixels = reinterpret_cast<unsigned char*>(bitmap.getPixels());
-
- gfx::PNGCodec::Encode(pixels, gfx::PNGCodec::FORMAT_BGRA,
- read_pixels_bounds_in_pixel.size(),
- bitmap.rowBytes(), true,
- std::vector<gfx::PNGCodec::Comment>(),
- png_representation);
- return true;
-}
-
-} // namespace ui
« no previous file with comments | « ui/window_snapshot/window_snapshot.h ('k') | ui/window_snapshot/window_snapshot_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698