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 "services/ui/ws/display_manager.h" | 5 #include "services/ui/ws/display_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
11 #include "services/ui/display/viewport_metrics.h" | 11 #include "services/ui/display/viewport_metrics.h" |
12 #include "services/ui/ws/cursor_location_manager.h" | 12 #include "services/ui/ws/cursor_location_manager.h" |
13 #include "services/ui/ws/display.h" | 13 #include "services/ui/ws/display.h" |
14 #include "services/ui/ws/display_binding.h" | 14 #include "services/ui/ws/display_binding.h" |
15 #include "services/ui/ws/event_dispatcher.h" | 15 #include "services/ui/ws/event_dispatcher.h" |
| 16 #include "services/ui/ws/frame_generator.h" |
16 #include "services/ui/ws/server_window.h" | 17 #include "services/ui/ws/server_window.h" |
17 #include "services/ui/ws/user_display_manager.h" | 18 #include "services/ui/ws/user_display_manager.h" |
18 #include "services/ui/ws/user_display_manager_delegate.h" | 19 #include "services/ui/ws/user_display_manager_delegate.h" |
19 #include "services/ui/ws/user_id_tracker.h" | 20 #include "services/ui/ws/user_id_tracker.h" |
20 #include "services/ui/ws/window_manager_state.h" | 21 #include "services/ui/ws/window_manager_state.h" |
21 #include "services/ui/ws/window_manager_window_tree_factory.h" | 22 #include "services/ui/ws/window_manager_window_tree_factory.h" |
22 #include "services/ui/ws/window_server_delegate.h" | 23 #include "services/ui/ws/window_server_delegate.h" |
23 #include "services/ui/ws/window_tree.h" | 24 #include "services/ui/ws/window_tree.h" |
24 | 25 |
25 namespace ui { | 26 namespace ui { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 158 |
158 void DisplayManager::OnDisplayAcceleratedWidgetAvailable(Display* display) { | 159 void DisplayManager::OnDisplayAcceleratedWidgetAvailable(Display* display) { |
159 DCHECK_NE(0u, pending_displays_.count(display)); | 160 DCHECK_NE(0u, pending_displays_.count(display)); |
160 DCHECK_EQ(0u, displays_.count(display)); | 161 DCHECK_EQ(0u, displays_.count(display)); |
161 const bool is_first_display = displays_.empty(); | 162 const bool is_first_display = displays_.empty(); |
162 displays_.insert(display); | 163 displays_.insert(display); |
163 pending_displays_.erase(display); | 164 pending_displays_.erase(display); |
164 window_server_->OnDisplayReady(display, is_first_display); | 165 window_server_->OnDisplayReady(display, is_first_display); |
165 } | 166 } |
166 | 167 |
| 168 void DisplayManager::SetHighContrastMode(bool enabled) { |
| 169 for (Display* display : displays_) { |
| 170 display->platform_display()->GetFrameGenerator()->SetHighContrastMode( |
| 171 enabled); |
| 172 } |
| 173 } |
| 174 |
167 void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id, | 175 void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id, |
168 const UserId& active_id) { | 176 const UserId& active_id) { |
169 WindowManagerState* previous_window_manager_state = | 177 WindowManagerState* previous_window_manager_state = |
170 window_server_->GetWindowManagerStateForUser(previously_active_id); | 178 window_server_->GetWindowManagerStateForUser(previously_active_id); |
171 gfx::Point mouse_location_on_screen; | 179 gfx::Point mouse_location_on_screen; |
172 if (previous_window_manager_state) { | 180 if (previous_window_manager_state) { |
173 mouse_location_on_screen = previous_window_manager_state->event_dispatcher() | 181 mouse_location_on_screen = previous_window_manager_state->event_dispatcher() |
174 ->mouse_pointer_last_location(); | 182 ->mouse_pointer_last_location(); |
175 previous_window_manager_state->Deactivate(); | 183 previous_window_manager_state->Deactivate(); |
176 } | 184 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id; | 235 DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id; |
228 // TODO(kylechar): Send IPCs to WM clients first. | 236 // TODO(kylechar): Send IPCs to WM clients first. |
229 | 237 |
230 // Send IPCs to any DisplayManagerObservers. | 238 // Send IPCs to any DisplayManagerObservers. |
231 for (const auto& pair : user_display_managers_) | 239 for (const auto& pair : user_display_managers_) |
232 pair.second->OnPrimaryDisplayChanged(primary_display_id); | 240 pair.second->OnPrimaryDisplayChanged(primary_display_id); |
233 } | 241 } |
234 | 242 |
235 } // namespace ws | 243 } // namespace ws |
236 } // namespace ui | 244 } // namespace ui |
OLD | NEW |