OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/display/screen_ash.h" | 5 #include "ash/display/screen_ash.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/root_window_settings.h" | 10 #include "ash/root_window_settings.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const RootWindowSettings* rws = GetRootWindowSettings(root_window); | 158 const RootWindowSettings* rws = GetRootWindowSettings(root_window); |
159 int64 id = rws->display_id; | 159 int64 id = rws->display_id; |
160 // if id is |kInvaildDisplayID|, it's being deleted. | 160 // if id is |kInvaildDisplayID|, it's being deleted. |
161 DCHECK(id != gfx::Display::kInvalidDisplayID); | 161 DCHECK(id != gfx::Display::kInvalidDisplayID); |
162 if (id == gfx::Display::kInvalidDisplayID) | 162 if (id == gfx::Display::kInvalidDisplayID) |
163 return GetPrimaryDisplay(); | 163 return GetPrimaryDisplay(); |
164 | 164 |
165 DisplayManager* display_manager = GetDisplayManager(); | 165 DisplayManager* display_manager = GetDisplayManager(); |
166 // RootWindow needs Display to determine its device scale factor | 166 // RootWindow needs Display to determine its device scale factor |
167 // for non desktop display. | 167 // for non desktop display. |
168 if (display_manager->software_mirroring_display().id() == id) | 168 gfx::Display mirroring_display = display_manager->GetMirroringDisplayById(id); |
169 return display_manager->software_mirroring_display(); | 169 if (mirroring_display.is_valid()) |
| 170 return mirroring_display; |
170 return display_manager->GetDisplayForId(id); | 171 return display_manager->GetDisplayForId(id); |
171 } | 172 } |
172 | 173 |
173 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { | 174 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { |
174 const gfx::Display& display = | 175 const gfx::Display& display = |
175 GetDisplayManager()->FindDisplayContainingPoint(point); | 176 GetDisplayManager()->FindDisplayContainingPoint(point); |
176 if (display.is_valid()) | 177 if (display.is_valid()) |
177 return display; | 178 return display; |
178 // Fallback to the display that has the shortest Manhattan distance from | 179 // Fallback to the display that has the shortest Manhattan distance from |
179 // the |point|. This is correct in the only areas that matter, namely in the | 180 // the |point|. This is correct in the only areas that matter, namely in the |
(...skipping 22 matching lines...) Expand all Loading... |
202 | 203 |
203 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { | 204 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { |
204 observers_.RemoveObserver(observer); | 205 observers_.RemoveObserver(observer); |
205 } | 206 } |
206 | 207 |
207 gfx::Screen* ScreenAsh::CloneForShutdown() { | 208 gfx::Screen* ScreenAsh::CloneForShutdown() { |
208 return new ScreenForShutdown(this); | 209 return new ScreenForShutdown(this); |
209 } | 210 } |
210 | 211 |
211 } // namespace ash | 212 } // namespace ash |
OLD | NEW |