Index: ui/views/mus/screen_mus.cc |
diff --git a/ui/views/mus/screen_mus.cc b/ui/views/mus/screen_mus.cc |
index 642c4b73bd3a473a8aced2780375b45b2dab2c20..84cf5b4dd8b015a1815177116048be224510098e 100644 |
--- a/ui/views/mus/screen_mus.cc |
+++ b/ui/views/mus/screen_mus.cc |
@@ -11,8 +11,6 @@ |
#include "services/shell/public/cpp/connection.h" |
#include "services/shell/public/cpp/connector.h" |
#include "ui/aura/window.h" |
-#include "ui/display/display_finder.h" |
-#include "ui/display/display_observer.h" |
#include "ui/views/mus/screen_mus_delegate.h" |
#include "ui/views/mus/window_manager_frame_values.h" |
@@ -40,14 +38,9 @@ ScreenMus::ScreenMus(ScreenMusDelegate* delegate) |
display_manager_observer_binding_(this) { |
} |
-ScreenMus::~ScreenMus() { |
- DCHECK_EQ(this, display::Screen::GetScreen()); |
- display::Screen::SetScreenInstance(nullptr); |
-} |
+ScreenMus::~ScreenMus() {} |
void ScreenMus::Init(shell::Connector* connector) { |
- display::Screen::SetScreenInstance(this); |
- |
connector->ConnectToInterface("mojo:ui", &display_manager_); |
display_manager_->AddObserver( |
@@ -62,28 +55,14 @@ void ScreenMus::Init(shell::Connector* connector) { |
// The WaitForIncomingMethodCall() should have supplied the set of Displays, |
// unless mus is going down, in which case encountered_error() is true, or the |
// call to WaitForIncomingMethodCall() failed. |
- if (display_list_.displays().empty()) { |
+ if (display_list()->displays().empty()) { |
DCHECK(display_manager_.encountered_error() || !success); |
// In this case we install a default display and assume the process is |
// going to exit shortly so that the real value doesn't matter. |
- display_list_.AddDisplay( |
+ display_list()->AddDisplay( |
display::Display(0xFFFFFFFF, gfx::Rect(0, 0, 801, 802)), |
- DisplayList::Type::PRIMARY); |
- } |
-} |
- |
-void ScreenMus::ProcessDisplayChanged(const display::Display& changed_display, |
- bool is_primary) { |
- if (display_list_.FindDisplayById(changed_display.id()) == |
- display_list_.displays().end()) { |
- display_list_.AddDisplay(changed_display, |
- is_primary ? DisplayList::Type::PRIMARY |
- : DisplayList::Type::NOT_PRIMARY); |
- return; |
+ display::DisplayList::Type::PRIMARY); |
} |
- display_list_.UpdateDisplay( |
- changed_display, |
- is_primary ? DisplayList::Type::PRIMARY : DisplayList::Type::NOT_PRIMARY); |
} |
gfx::Point ScreenMus::GetCursorScreenPoint() { |
@@ -98,65 +77,20 @@ gfx::Point ScreenMus::GetCursorScreenPoint() { |
} |
bool ScreenMus::IsWindowUnderCursor(gfx::NativeWindow window) { |
- if (!window) |
- return false; |
- |
- return window->IsVisible() && |
- window->GetBoundsInScreen().Contains(GetCursorScreenPoint()); |
-} |
- |
-gfx::NativeWindow ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) { |
- NOTIMPLEMENTED(); |
- return nullptr; |
-} |
- |
-display::Display ScreenMus::GetPrimaryDisplay() const { |
- return *display_list_.GetPrimaryDisplayIterator(); |
-} |
- |
-display::Display ScreenMus::GetDisplayNearestWindow( |
- gfx::NativeView view) const { |
- NOTIMPLEMENTED(); |
- return *display_list_.GetPrimaryDisplayIterator(); |
-} |
- |
-display::Display ScreenMus::GetDisplayNearestPoint( |
- const gfx::Point& point) const { |
- return *display::FindDisplayNearestPoint(display_list_.displays(), point); |
-} |
- |
-int ScreenMus::GetNumDisplays() const { |
- return static_cast<int>(display_list_.displays().size()); |
-} |
- |
-std::vector<display::Display> ScreenMus::GetAllDisplays() const { |
- return display_list_.displays(); |
-} |
- |
-display::Display ScreenMus::GetDisplayMatching( |
- const gfx::Rect& match_rect) const { |
- const display::Display* match = display::FindDisplayWithBiggestIntersection( |
- display_list_.displays(), match_rect); |
- return match ? *match : GetPrimaryDisplay(); |
-} |
- |
-void ScreenMus::AddObserver(display::DisplayObserver* observer) { |
- display_list_.AddObserver(observer); |
-} |
- |
-void ScreenMus::RemoveObserver(display::DisplayObserver* observer) { |
- display_list_.RemoveObserver(observer); |
+ return window && window->IsVisible() && |
+ window->GetBoundsInScreen().Contains(GetCursorScreenPoint()); |
} |
void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) { |
// This should only be called once from Init() before any observers have been |
// added. |
- DCHECK(display_list_.displays().empty()); |
+ DCHECK(display_list()->displays().empty()); |
for (size_t i = 0; i < ws_displays.size(); ++i) { |
const bool is_primary = ws_displays[i]->is_primary; |
- display_list_.AddDisplay(ws_displays[i]->display, |
- is_primary ? DisplayList::Type::PRIMARY |
- : DisplayList::Type::NOT_PRIMARY); |
+ display_list()->AddDisplay(ws_displays[i]->display, |
+ is_primary |
+ ? display::DisplayList::Type::PRIMARY |
+ : display::DisplayList::Type::NOT_PRIMARY); |
if (is_primary) { |
// TODO(sky): Make WindowManagerFrameValues per display. |
WindowManagerFrameValues frame_values = |
@@ -165,7 +99,7 @@ void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) { |
WindowManagerFrameValues::SetInstance(frame_values); |
} |
} |
- DCHECK(!display_list_.displays().empty()); |
+ DCHECK(!display_list()->displays().empty()); |
} |
void ScreenMus::OnDisplaysChanged( |
@@ -185,7 +119,7 @@ void ScreenMus::OnDisplaysChanged( |
} |
void ScreenMus::OnDisplayRemoved(int64_t id) { |
- display_list_.RemoveDisplay(id); |
+ display_list()->RemoveDisplay(id); |
} |
} // namespace views |