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 |