snapshot_async.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_SNAPSHOT_SNAPSHOT_ASYNC_H_
  5. #define UI_SNAPSHOT_SNAPSHOT_ASYNC_H_
  6. #include <memory>
  7. #include "components/viz/common/frame_sinks/copy_output_result.h"
  8. #include "ui/snapshot/snapshot.h"
  9. namespace gfx {
  10. class Size;
  11. }
  12. namespace ui {
  13. // Helper methods for async snapshots to convert a viz::CopyOutputResult into a
  14. // ui::GrabWindowSnapshot callback.
  15. class SnapshotAsync {
  16. public:
  17. SnapshotAsync() = delete;
  18. SnapshotAsync(const SnapshotAsync&) = delete;
  19. SnapshotAsync& operator=(const SnapshotAsync&) = delete;
  20. static void ScaleCopyOutputResult(
  21. GrabWindowSnapshotAsyncCallback callback,
  22. const gfx::Size& target_size,
  23. std::unique_ptr<viz::CopyOutputResult> result);
  24. static void RunCallbackWithCopyOutputResult(
  25. GrabWindowSnapshotAsyncCallback callback,
  26. std::unique_ptr<viz::CopyOutputResult> result);
  27. };
  28. } // namespace ui
  29. #endif // UI_SNAPSHOT_SNAPSHOT_ASYNC_H_