| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return GetDisplayManager()->displays(); | 228 return GetDisplayManager()->displays(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const { | 231 gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const { |
| 232 if (!window) | 232 if (!window) |
| 233 return GetPrimaryDisplay(); | 233 return GetPrimaryDisplay(); |
| 234 const aura::Window* root_window = window->GetRootWindow(); | 234 const aura::Window* root_window = window->GetRootWindow(); |
| 235 if (!root_window) | 235 if (!root_window) |
| 236 return GetPrimaryDisplay(); | 236 return GetPrimaryDisplay(); |
| 237 const RootWindowSettings* rws = GetRootWindowSettings(root_window); | 237 const RootWindowSettings* rws = GetRootWindowSettings(root_window); |
| 238 if (rws->shutdown) | |
| 239 return GetPrimaryDisplay(); | |
| 240 | |
| 241 int64 id = rws->display_id; | 238 int64 id = rws->display_id; |
| 242 // if id is |kInvaildDisplayID|, it's being deleted. | 239 // if id is |kInvaildDisplayID|, it's being deleted. |
| 243 DCHECK(id != gfx::Display::kInvalidDisplayID); | 240 DCHECK(id != gfx::Display::kInvalidDisplayID); |
| 241 if (id == gfx::Display::kInvalidDisplayID) |
| 242 return GetPrimaryDisplay(); |
| 244 | 243 |
| 245 DisplayManager* display_manager = GetDisplayManager(); | 244 DisplayManager* display_manager = GetDisplayManager(); |
| 246 // RootWindow needs Display to determine its device scale factor | 245 // RootWindow needs Display to determine its device scale factor |
| 247 // for non desktop display. | 246 // for non desktop display. |
| 248 if (display_manager->non_desktop_display().id() == id) | 247 if (display_manager->non_desktop_display().id() == id) |
| 249 return display_manager->non_desktop_display(); | 248 return display_manager->non_desktop_display(); |
| 250 return display_manager->GetDisplayForId(id); | 249 return display_manager->GetDisplayForId(id); |
| 251 } | 250 } |
| 252 | 251 |
| 253 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { | 252 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 281 | 280 |
| 282 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { | 281 void ScreenAsh::RemoveObserver(gfx::DisplayObserver* observer) { |
| 283 observers_.RemoveObserver(observer); | 282 observers_.RemoveObserver(observer); |
| 284 } | 283 } |
| 285 | 284 |
| 286 gfx::Screen* ScreenAsh::CloneForShutdown() { | 285 gfx::Screen* ScreenAsh::CloneForShutdown() { |
| 287 return new ScreenForShutdown(this); | 286 return new ScreenForShutdown(this); |
| 288 } | 287 } |
| 289 | 288 |
| 290 } // namespace ash | 289 } // namespace ash |
| OLD | NEW |