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

Unified Diff: ui/snapshot/snapshot_aura.cc

Issue 2752373002: Use PrintWindow() to implement snapshots on windows 8.1+ (Closed)
Patch Set: rebase Created 3 years, 8 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/snapshot/snapshot_aura.h ('k') | ui/snapshot/snapshot_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/snapshot/snapshot_aura.cc
diff --git a/ui/snapshot/snapshot_aura.cc b/ui/snapshot/snapshot_aura.cc
index 0ff547c1240a597f075ac2a78e1ec795e733d9ef..44b136eb6fd61a59b22ce9aec01a51104f97c19b 100644
--- a/ui/snapshot/snapshot_aura.cc
+++ b/ui/snapshot/snapshot_aura.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/snapshot/snapshot.h"
+#include "ui/snapshot/snapshot_aura.h"
#include <utility>
@@ -21,21 +21,15 @@
namespace ui {
-bool GrabViewSnapshot(gfx::NativeView view,
- const gfx::Rect& snapshot_bounds,
- gfx::Image* image) {
- return GrabWindowSnapshot(view, snapshot_bounds, image);
-}
-
-bool GrabWindowSnapshot(gfx::NativeWindow window,
- const gfx::Rect& snapshot_bounds,
- gfx::Image* image) {
+bool GrabWindowSnapshotAura(aura::Window* window,
+ const gfx::Rect& snapshot_bounds,
+ gfx::Image* image) {
// Not supported in Aura. Callers should fall back to the async version.
return false;
}
static void MakeAsyncCopyRequest(
- gfx::NativeWindow window,
+ aura::Window* window,
const gfx::Rect& source_rect,
const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) {
std::unique_ptr<cc::CopyOutputRequest> request =
@@ -59,7 +53,7 @@ static void FinishedAsyncCopyRequest(
// order, the tracker might have been passed and set to NULL
// before the window is looked up which results in a NULL pointer
// dereference.
- gfx::NativeWindow window = tracker->windows()[0];
+ aura::Window* window = tracker->windows()[0];
MakeAsyncCopyRequest(
window, source_rect,
base::Bind(&FinishedAsyncCopyRequest, base::Passed(&tracker),
@@ -71,7 +65,7 @@ static void FinishedAsyncCopyRequest(
}
static void MakeInitialAsyncCopyRequest(
- gfx::NativeWindow window,
+ aura::Window* window,
const gfx::Rect& source_rect,
const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) {
auto tracker = base::MakeUnique<aura::WindowTracker>();
@@ -82,8 +76,8 @@ static void MakeInitialAsyncCopyRequest(
callback, 0));
}
-void GrabWindowSnapshotAndScaleAsync(
- gfx::NativeWindow window,
+void GrabWindowSnapshotAndScaleAsyncAura(
+ aura::Window* window,
const gfx::Rect& source_rect,
const gfx::Size& target_size,
scoped_refptr<base::TaskRunner> background_task_runner,
@@ -94,19 +88,51 @@ void GrabWindowSnapshotAndScaleAsync(
background_task_runner));
}
-void GrabWindowSnapshotAsync(gfx::NativeWindow window,
- const gfx::Rect& source_rect,
- const GrabWindowSnapshotAsyncCallback& callback) {
+void GrabWindowSnapshotAsyncAura(
+ aura::Window* window,
+ const gfx::Rect& source_rect,
+ const GrabWindowSnapshotAsyncCallback& callback) {
MakeInitialAsyncCopyRequest(
window, source_rect,
base::Bind(&SnapshotAsync::RunCallbackWithCopyOutputResult, callback));
}
+#if !defined(OS_WIN)
+bool GrabWindowSnapshot(gfx::NativeWindow window,
+ const gfx::Rect& snapshot_bounds,
+ gfx::Image* image) {
+ // Not supported in Aura. Callers should fall back to the async version.
+ return false;
+}
+
+bool GrabViewSnapshot(gfx::NativeView view,
+ const gfx::Rect& snapshot_bounds,
+ gfx::Image* image) {
+ return GrabWindowSnapshot(view, snapshot_bounds, image);
+}
+
+void GrabWindowSnapshotAndScaleAsync(
+ gfx::NativeWindow window,
+ const gfx::Rect& source_rect,
+ const gfx::Size& target_size,
+ scoped_refptr<base::TaskRunner> background_task_runner,
+ const GrabWindowSnapshotAsyncCallback& callback) {
+ GrabWindowSnapshotAndScaleAsyncAura(window, source_rect, target_size,
+ background_task_runner, callback);
+}
+
+void GrabWindowSnapshotAsync(gfx::NativeWindow window,
+ const gfx::Rect& source_rect,
+ const GrabWindowSnapshotAsyncCallback& callback) {
+ GrabWindowSnapshotAsyncAura(window, source_rect, callback);
+}
+
void GrabViewSnapshotAsync(gfx::NativeView view,
const gfx::Rect& source_rect,
const GrabWindowSnapshotAsyncCallback& callback) {
- GrabWindowSnapshotAsync(view, source_rect, callback);
+ GrabWindowSnapshotAsyncAura(view, source_rect, callback);
}
+#endif
} // namespace ui
« no previous file with comments | « ui/snapshot/snapshot_aura.h ('k') | ui/snapshot/snapshot_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698