Index: ash/mus/screen_mus.cc |
diff --git a/ash/mus/screen_mus.cc b/ash/mus/screen_mus.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..312eb9d6505ed29473565263396008d7b88e35f9 |
--- /dev/null |
+++ b/ash/mus/screen_mus.cc |
@@ -0,0 +1,26 @@ |
+// 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 |