| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/mus/screen_mus.h" | 5 #include "ui/views/mus/screen_mus.h" |
| 6 | 6 |
| 7 #include "mojo/converters/geometry/geometry_type_converters.h" | 7 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 8 #include "services/shell/public/cpp/connection.h" | 8 #include "services/shell/public/cpp/connection.h" |
| 9 #include "services/shell/public/cpp/connector.h" | 9 #include "services/shell/public/cpp/connector.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/display/display_finder.h" |
| 11 #include "ui/display/display_observer.h" | 12 #include "ui/display/display_observer.h" |
| 12 #include "ui/gfx/display_finder.h" | |
| 13 #include "ui/mojo/display/display_type_converters.h" | 13 #include "ui/mojo/display/display_type_converters.h" |
| 14 #include "ui/views/mus/screen_mus_delegate.h" | 14 #include "ui/views/mus/screen_mus_delegate.h" |
| 15 #include "ui/views/mus/window_manager_frame_values.h" | 15 #include "ui/views/mus/window_manager_frame_values.h" |
| 16 | 16 |
| 17 namespace mojo { | 17 namespace mojo { |
| 18 | 18 |
| 19 template <> | 19 template <> |
| 20 struct TypeConverter<views::WindowManagerFrameValues, | 20 struct TypeConverter<views::WindowManagerFrameValues, |
| 21 mus::mojom::FrameDecorationValuesPtr> { | 21 mus::mojom::FrameDecorationValuesPtr> { |
| 22 static views::WindowManagerFrameValues Convert( | 22 static views::WindowManagerFrameValues Convert( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 display::Display ScreenMus::GetDisplayNearestWindow( | 150 display::Display ScreenMus::GetDisplayNearestWindow( |
| 151 gfx::NativeView view) const { | 151 gfx::NativeView view) const { |
| 152 //NOTIMPLEMENTED(); | 152 //NOTIMPLEMENTED(); |
| 153 return GetPrimaryDisplay(); | 153 return GetPrimaryDisplay(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 display::Display ScreenMus::GetDisplayNearestPoint( | 156 display::Display ScreenMus::GetDisplayNearestPoint( |
| 157 const gfx::Point& point) const { | 157 const gfx::Point& point) const { |
| 158 return *gfx::FindDisplayNearestPoint(displays_, point); | 158 return *display::FindDisplayNearestPoint(displays_, point); |
| 159 } | 159 } |
| 160 | 160 |
| 161 int ScreenMus::GetNumDisplays() const { | 161 int ScreenMus::GetNumDisplays() const { |
| 162 return static_cast<int>(displays_.size()); | 162 return static_cast<int>(displays_.size()); |
| 163 } | 163 } |
| 164 | 164 |
| 165 std::vector<display::Display> ScreenMus::GetAllDisplays() const { | 165 std::vector<display::Display> ScreenMus::GetAllDisplays() const { |
| 166 return displays_; | 166 return displays_; |
| 167 } | 167 } |
| 168 | 168 |
| 169 display::Display ScreenMus::GetDisplayMatching( | 169 display::Display ScreenMus::GetDisplayMatching( |
| 170 const gfx::Rect& match_rect) const { | 170 const gfx::Rect& match_rect) const { |
| 171 const display::Display* match = | 171 const display::Display* match = |
| 172 gfx::FindDisplayWithBiggestIntersection(displays_, match_rect); | 172 display::FindDisplayWithBiggestIntersection(displays_, match_rect); |
| 173 return match ? *match : GetPrimaryDisplay(); | 173 return match ? *match : GetPrimaryDisplay(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ScreenMus::AddObserver(display::DisplayObserver* observer) { | 176 void ScreenMus::AddObserver(display::DisplayObserver* observer) { |
| 177 observers_.AddObserver(observer); | 177 observers_.AddObserver(observer); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void ScreenMus::RemoveObserver(display::DisplayObserver* observer) { | 180 void ScreenMus::RemoveObserver(display::DisplayObserver* observer) { |
| 181 observers_.RemoveObserver(observer); | 181 observers_.RemoveObserver(observer); |
| 182 } | 182 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 DCHECK_NE(-1, index); | 220 DCHECK_NE(-1, index); |
| 221 // Another display must become primary before the existing primary is | 221 // Another display must become primary before the existing primary is |
| 222 // removed. | 222 // removed. |
| 223 DCHECK_NE(index, primary_display_index_); | 223 DCHECK_NE(index, primary_display_index_); |
| 224 const display::Display display = displays_[index]; | 224 const display::Display display = displays_[index]; |
| 225 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, | 225 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, |
| 226 OnDisplayRemoved(display)); | 226 OnDisplayRemoved(display)); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace views | 229 } // namespace views |
| OLD | NEW |