blob: 312eb9d6505ed29473565263396008d7b88e35f9 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/mus/screen_mus.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
namespace ash {
ScreenMus::ScreenMus() = default;
ScreenMus::~ScreenMus() = default;
display::Display ScreenMus::GetDisplayNearestWindow(
aura::Window* window) const {
const aura::WindowTreeHost* host = window->GetHost();
if (!host)
return GetPrimaryDisplay();
auto iter = display_list().FindDisplayById(
static_cast<const aura::WindowTreeHostMus*>(host)->display_id());
return iter == display_list().displays().end() ? GetPrimaryDisplay() : *iter;
} // namespace ash