Chromium Code Reviews| Index: ui/snapshot/snapshot_aura.cc |
| diff --git a/ui/snapshot/snapshot_aura.cc b/ui/snapshot/snapshot_aura.cc |
| index 0ff547c1240a597f075ac2a78e1ec795e733d9ef..368da4986ca2c8abd287e5d9a5ae073447de0008 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,15 +21,15 @@ |
| namespace ui { |
| -bool GrabViewSnapshot(gfx::NativeView view, |
| - const gfx::Rect& snapshot_bounds, |
| - gfx::Image* image) { |
| +bool GrabViewSnapshotAura(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(gfx::NativeWindow window, |
|
sky
2017/03/23 03:29:13
If we are adding aura specific functions, what is
|
| + const gfx::Rect& snapshot_bounds, |
| + gfx::Image* image) { |
| // Not supported in Aura. Callers should fall back to the async version. |
| return false; |
| } |
| @@ -82,7 +82,7 @@ static void MakeInitialAsyncCopyRequest( |
| callback, 0)); |
| } |
| -void GrabWindowSnapshotAndScaleAsync( |
| +void GrabWindowSnapshotAndScaleAsyncAura( |
| gfx::NativeWindow window, |
| const gfx::Rect& source_rect, |
| const gfx::Size& target_size, |
| @@ -94,19 +94,57 @@ void GrabWindowSnapshotAndScaleAsync( |
| background_task_runner)); |
| } |
| -void GrabWindowSnapshotAsync(gfx::NativeWindow window, |
| - const gfx::Rect& source_rect, |
| - const GrabWindowSnapshotAsyncCallback& callback) { |
| +void GrabWindowSnapshotAsyncAura( |
| + gfx::NativeWindow window, |
| + const gfx::Rect& source_rect, |
| + const GrabWindowSnapshotAsyncCallback& callback) { |
| MakeInitialAsyncCopyRequest( |
| window, source_rect, |
| base::Bind(&SnapshotAsync::RunCallbackWithCopyOutputResult, callback)); |
| } |
| +void GrabViewSnapshotAsyncAura( |
| + gfx::NativeView view, |
| + const gfx::Rect& source_rect, |
| + const GrabWindowSnapshotAsyncCallback& callback) { |
| + GrabWindowSnapshotAsyncAura(view, source_rect, callback); |
| +} |
| + |
| +#if !defined(OS_WIN) |
| +bool GrabWindowSnapshot(gfx::NativeWindow window, |
| + const gfx::Rect& snapshot_bounds, |
| + gfx::Image* image) { |
| + return GrabWindowSnapshotAura(window, snapshot_bounds, image); |
| +} |
| + |
| +bool GrabViewSnapshot(gfx::NativeView view, |
| + const gfx::Rect& snapshot_bounds, |
| + gfx::Image* image) { |
| + return GrabViewSnapshotAura(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); |
| + GrabViewSnapshotAsyncAura(view, source_rect, callback); |
| } |
| +#endif |
| } // namespace ui |