window_preview_view_test_api.cc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2018 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. #include "ash/wm/window_preview_view_test_api.h"
  5. #include "ash/wm/window_preview_view.h"
  6. #include "ui/views/widget/widget.h"
  7. namespace ash {
  8. WindowPreviewViewTestApi::WindowPreviewViewTestApi(
  9. WindowPreviewView* preview_view)
  10. : preview_view_(preview_view) {
  11. DCHECK(preview_view);
  12. }
  13. WindowPreviewViewTestApi::~WindowPreviewViewTestApi() = default;
  14. gfx::RectF WindowPreviewViewTestApi::GetUnionRect() const {
  15. return preview_view_->GetUnionRect();
  16. }
  17. const base::flat_map<aura::Window*, WindowMirrorView*>&
  18. WindowPreviewViewTestApi::GetMirrorViews() const {
  19. return preview_view_->mirror_views_;
  20. }
  21. WindowMirrorView* WindowPreviewViewTestApi::GetMirrorViewForWidget(
  22. views::Widget* widget) {
  23. auto it = preview_view_->mirror_views_.find(widget->GetNativeWindow());
  24. if (it != preview_view_->mirror_views_.end())
  25. return it->second;
  26. return nullptr;
  27. }
  28. } // namespace ash