1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39

ash / wm / window_preview_view_test_api.cc [blame]

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/wm/window_preview_view_test_api.h"

#include "ash/wm/window_preview_view.h"
#include "base/memory/raw_ptr.h"
#include "ui/views/widget/widget.h"

namespace ash {

WindowPreviewViewTestApi::WindowPreviewViewTestApi(
    WindowPreviewView* preview_view)
    : preview_view_(preview_view) {
  DCHECK(preview_view);
}

WindowPreviewViewTestApi::~WindowPreviewViewTestApi() = default;

gfx::RectF WindowPreviewViewTestApi::GetUnionRect() const {
  return preview_view_->GetUnionRect();
}

const base::flat_map<aura::Window*, raw_ptr<WindowMirrorView, CtnExperimental>>&
WindowPreviewViewTestApi::GetMirrorViews() const {
  return preview_view_->mirror_views_;
}

WindowMirrorView* WindowPreviewViewTestApi::GetMirrorViewForWidget(
    views::Widget* widget) {
  auto it = preview_view_->mirror_views_.find(widget->GetNativeWindow());
  if (it != preview_view_->mirror_views_.end())
    return it->second;

  return nullptr;
}

}  // namespace ash