| OLD | NEW |
| 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 "ui/snapshot/snapshot.h" | 5 #include "ui/snapshot/snapshot.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/task_runner_util.h" | 11 #include "base/task_runner_util.h" |
| 10 #include "cc/output/copy_output_request.h" | 12 #include "cc/output/copy_output_request.h" |
| 11 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 13 #include "ui/compositor/compositor.h" | 15 #include "ui/compositor/compositor.h" |
| 14 #include "ui/compositor/dip_util.h" | 16 #include "ui/compositor/dip_util.h" |
| 15 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 16 #include "ui/snapshot/snapshot_async.h" | 18 #include "ui/snapshot/snapshot_async.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 return false; | 32 return false; |
| 31 } | 33 } |
| 32 | 34 |
| 33 static void MakeAsyncCopyRequest( | 35 static void MakeAsyncCopyRequest( |
| 34 gfx::NativeWindow window, | 36 gfx::NativeWindow window, |
| 35 const gfx::Rect& source_rect, | 37 const gfx::Rect& source_rect, |
| 36 const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { | 38 const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { |
| 37 scoped_ptr<cc::CopyOutputRequest> request = | 39 scoped_ptr<cc::CopyOutputRequest> request = |
| 38 cc::CopyOutputRequest::CreateBitmapRequest(callback); | 40 cc::CopyOutputRequest::CreateBitmapRequest(callback); |
| 39 request->set_area(source_rect); | 41 request->set_area(source_rect); |
| 40 window->layer()->RequestCopyOfOutput(request.Pass()); | 42 window->layer()->RequestCopyOfOutput(std::move(request)); |
| 41 } | 43 } |
| 42 | 44 |
| 43 void GrabWindowSnapshotAndScaleAsync( | 45 void GrabWindowSnapshotAndScaleAsync( |
| 44 gfx::NativeWindow window, | 46 gfx::NativeWindow window, |
| 45 const gfx::Rect& source_rect, | 47 const gfx::Rect& source_rect, |
| 46 const gfx::Size& target_size, | 48 const gfx::Size& target_size, |
| 47 scoped_refptr<base::TaskRunner> background_task_runner, | 49 scoped_refptr<base::TaskRunner> background_task_runner, |
| 48 const GrabWindowSnapshotAsyncCallback& callback) { | 50 const GrabWindowSnapshotAsyncCallback& callback) { |
| 49 MakeAsyncCopyRequest(window, | 51 MakeAsyncCopyRequest(window, |
| 50 source_rect, | 52 source_rect, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 69 void GrabViewSnapshotAsync( | 71 void GrabViewSnapshotAsync( |
| 70 gfx::NativeView view, | 72 gfx::NativeView view, |
| 71 const gfx::Rect& source_rect, | 73 const gfx::Rect& source_rect, |
| 72 scoped_refptr<base::TaskRunner> background_task_runner, | 74 scoped_refptr<base::TaskRunner> background_task_runner, |
| 73 const GrabWindowSnapshotAsyncPNGCallback& callback) { | 75 const GrabWindowSnapshotAsyncPNGCallback& callback) { |
| 74 GrabWindowSnapshotAsync(view, source_rect, background_task_runner, callback); | 76 GrabWindowSnapshotAsync(view, source_rect, background_task_runner, callback); |
| 75 } | 77 } |
| 76 | 78 |
| 77 | 79 |
| 78 } // namespace ui | 80 } // namespace ui |
| OLD | NEW |