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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Not supported in Aura. Callers should fall back to the async version. | 29 // Not supported in Aura. Callers should fall back to the async version. |
30 return false; | 30 return false; |
31 } | 31 } |
32 | 32 |
33 static void MakeAsyncCopyRequest( | 33 static void MakeAsyncCopyRequest( |
34 gfx::NativeWindow window, | 34 gfx::NativeWindow window, |
35 const gfx::Rect& source_rect, | 35 const gfx::Rect& source_rect, |
36 const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { | 36 const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { |
37 scoped_ptr<cc::CopyOutputRequest> request = | 37 scoped_ptr<cc::CopyOutputRequest> request = |
38 cc::CopyOutputRequest::CreateBitmapRequest(callback); | 38 cc::CopyOutputRequest::CreateBitmapRequest(callback); |
39 request->set_area(ui::ConvertRectToPixel(window->layer(), source_rect)); | 39 request->set_area(source_rect); |
40 window->layer()->RequestCopyOfOutput(request.Pass()); | 40 window->layer()->RequestCopyOfOutput(request.Pass()); |
41 } | 41 } |
42 | 42 |
43 void GrabWindowSnapshotAndScaleAsync( | 43 void GrabWindowSnapshotAndScaleAsync( |
44 gfx::NativeWindow window, | 44 gfx::NativeWindow window, |
45 const gfx::Rect& source_rect, | 45 const gfx::Rect& source_rect, |
46 const gfx::Size& target_size, | 46 const gfx::Size& target_size, |
47 scoped_refptr<base::TaskRunner> background_task_runner, | 47 scoped_refptr<base::TaskRunner> background_task_runner, |
48 const GrabWindowSnapshotAsyncCallback& callback) { | 48 const GrabWindowSnapshotAsyncCallback& callback) { |
49 MakeAsyncCopyRequest(window, | 49 MakeAsyncCopyRequest(window, |
(...skipping 19 matching lines...) Expand all Loading... |
69 void GrabViewSnapshotAsync( | 69 void GrabViewSnapshotAsync( |
70 gfx::NativeView view, | 70 gfx::NativeView view, |
71 const gfx::Rect& source_rect, | 71 const gfx::Rect& source_rect, |
72 scoped_refptr<base::TaskRunner> background_task_runner, | 72 scoped_refptr<base::TaskRunner> background_task_runner, |
73 const GrabWindowSnapshotAsyncPNGCallback& callback) { | 73 const GrabWindowSnapshotAsyncPNGCallback& callback) { |
74 GrabWindowSnapshotAsync(view, source_rect, background_task_runner, callback); | 74 GrabWindowSnapshotAsync(view, source_rect, background_task_runner, callback); |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 } // namespace ui | 78 } // namespace ui |
OLD | NEW |