| 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/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shelf/shelf_widget.h" | 8 #include "ash/common/shelf/shelf_widget.h" |
| 9 #include "ash/common/wm/root_window_finder.h" | 9 #include "ash/common/wm/root_window_finder.h" |
| 10 #include "ash/display/window_tree_host_manager.h" | 10 #include "ash/display/window_tree_host_manager.h" |
| 11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
| 12 #include "ash/root_window_settings.h" | 12 #include "ash/root_window_settings.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "ui/aura/client/screen_position_client.h" | 15 #include "ui/aura/client/screen_position_client.h" |
| 16 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
| 17 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
| 18 #include "ui/display/display.h" | 18 #include "ui/display/display.h" |
| 19 #include "ui/display/display_finder.h" | 19 #include "ui/display/display_finder.h" |
| 20 #include "ui/display/manager/display_manager.h" | 20 #include "ui/display/manager/display_manager.h" |
| 21 #include "ui/display/screen.h" | 21 #include "ui/display/screen.h" |
| 22 #include "ui/display/types/display_constants.h" |
| 22 | 23 |
| 23 namespace ash { | 24 namespace ash { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 // We need to keep this in order for unittests to tell if | 28 // We need to keep this in order for unittests to tell if |
| 28 // the object in display::Screen::GetScreenByType is for shutdown. | 29 // the object in display::Screen::GetScreenByType is for shutdown. |
| 29 display::Screen* screen_for_shutdown = nullptr; | 30 display::Screen* screen_for_shutdown = nullptr; |
| 30 | 31 |
| 31 display::DisplayManager* GetDisplayManager() { | 32 display::DisplayManager* GetDisplayManager() { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 display::Display ScreenAsh::GetDisplayNearestWindow( | 118 display::Display ScreenAsh::GetDisplayNearestWindow( |
| 118 gfx::NativeView window) const { | 119 gfx::NativeView window) const { |
| 119 if (!window) | 120 if (!window) |
| 120 return GetPrimaryDisplay(); | 121 return GetPrimaryDisplay(); |
| 121 const aura::Window* root_window = window->GetRootWindow(); | 122 const aura::Window* root_window = window->GetRootWindow(); |
| 122 if (!root_window) | 123 if (!root_window) |
| 123 return GetPrimaryDisplay(); | 124 return GetPrimaryDisplay(); |
| 124 const RootWindowSettings* rws = GetRootWindowSettings(root_window); | 125 const RootWindowSettings* rws = GetRootWindowSettings(root_window); |
| 125 int64_t id = rws->display_id; | 126 int64_t id = rws->display_id; |
| 126 // if id is |kInvaildDisplayID|, it's being deleted. | 127 // if id is |kInvaildDisplayID|, it's being deleted. |
| 127 DCHECK(id != display::Display::kInvalidDisplayID); | 128 DCHECK(id != display::kInvalidDisplayId); |
| 128 if (id == display::Display::kInvalidDisplayID) | 129 if (id == display::kInvalidDisplayId) |
| 129 return GetPrimaryDisplay(); | 130 return GetPrimaryDisplay(); |
| 130 | 131 |
| 131 display::DisplayManager* display_manager = GetDisplayManager(); | 132 display::DisplayManager* display_manager = GetDisplayManager(); |
| 132 // RootWindow needs Display to determine its device scale factor | 133 // RootWindow needs Display to determine its device scale factor |
| 133 // for non desktop display. | 134 // for non desktop display. |
| 134 display::Display mirroring_display = | 135 display::Display mirroring_display = |
| 135 display_manager->GetMirroringDisplayById(id); | 136 display_manager->GetMirroringDisplayById(id); |
| 136 if (mirroring_display.is_valid()) | 137 if (mirroring_display.is_valid()) |
| 137 return mirroring_display; | 138 return mirroring_display; |
| 138 return display_manager->GetDisplayForId(id); | 139 return display_manager->GetDisplayForId(id); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 189 } |
| 189 | 190 |
| 190 // static | 191 // static |
| 191 void ScreenAsh::CreateScreenForShutdown() { | 192 void ScreenAsh::CreateScreenForShutdown() { |
| 192 delete screen_for_shutdown; | 193 delete screen_for_shutdown; |
| 193 screen_for_shutdown = new ScreenForShutdown(display::Screen::GetScreen()); | 194 screen_for_shutdown = new ScreenForShutdown(display::Screen::GetScreen()); |
| 194 display::Screen::SetScreenInstance(screen_for_shutdown); | 195 display::Screen::SetScreenInstance(screen_for_shutdown); |
| 195 } | 196 } |
| 196 | 197 |
| 197 } // namespace ash | 198 } // namespace ash |
| OLD | NEW |