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