| 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/callback.h" |
| 7 #include "ui/base/android/view_android.h" | 8 #include "ui/base/android/view_android.h" |
| 8 #include "ui/base/android/window_android.h" | 9 #include "ui/base/android/window_android.h" |
| 9 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
| 10 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 11 #include "ui/gfx/screen.h" | 12 #include "ui/gfx/screen.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 15 bool GrabViewSnapshot(gfx::NativeView view, | 16 bool GrabViewSnapshot(gfx::NativeView view, |
| 16 std::vector<unsigned char>* png_representation, | 17 std::vector<unsigned char>* png_representation, |
| 17 const gfx::Rect& snapshot_bounds) { | 18 const gfx::Rect& snapshot_bounds) { |
| 18 return GrabWindowSnapshot( | 19 return GrabWindowSnapshot( |
| 19 view->GetWindowAndroid(), png_representation, snapshot_bounds); | 20 view->GetWindowAndroid(), png_representation, snapshot_bounds); |
| 20 } | 21 } |
| 21 | 22 |
| 22 bool GrabWindowSnapshot(gfx::NativeWindow window, | 23 bool GrabWindowSnapshot(gfx::NativeWindow window, |
| 23 std::vector<unsigned char>* png_representation, | 24 std::vector<unsigned char>* png_representation, |
| 24 const gfx::Rect& snapshot_bounds) { | 25 const gfx::Rect& snapshot_bounds) { |
| 25 gfx::Display display = | 26 gfx::Display display = |
| 26 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 27 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| 27 gfx::Rect scaled_bounds = | 28 gfx::Rect scaled_bounds = |
| 28 gfx::ScaleToEnclosingRect(snapshot_bounds, | 29 gfx::ScaleToEnclosingRect(snapshot_bounds, |
| 29 display.device_scale_factor()); | 30 display.device_scale_factor()); |
| 30 return window->GrabSnapshot( | 31 return window->GrabSnapshot( |
| 31 scaled_bounds.x(), scaled_bounds.y(), scaled_bounds.width(), | 32 scaled_bounds.x(), scaled_bounds.y(), scaled_bounds.width(), |
| 32 scaled_bounds.height(), png_representation); | 33 scaled_bounds.height(), png_representation); |
| 33 } | 34 } |
| 34 | 35 |
| 36 SNAPSHOT_EXPORT void GrapWindowSnapshotAsync( |
| 37 gfx::NativeWindow window, |
| 38 const gfx::Rect& snapshot_bounds, |
| 39 const gfx::Size& target_size, |
| 40 scoped_refptr<base::TaskRunner> background_task_runner, |
| 41 GrapWindowSnapshotAsyncCallback callback) { |
| 42 NOTIMPLEMENTED(); |
| 43 } |
| 44 |
| 35 } // namespace ui | 45 } // namespace ui |
| OLD | NEW |