| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.h" | 5 #include "services/ui/ws/display.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback_helpers.h" |
| 11 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "services/service_manager/public/interfaces/connector.mojom.h" | 14 #include "services/service_manager/public/interfaces/connector.mojom.h" |
| 14 #include "services/ui/common/types.h" | 15 #include "services/ui/common/types.h" |
| 15 #include "services/ui/display/viewport_metrics.h" | 16 #include "services/ui/display/viewport_metrics.h" |
| 16 #include "services/ui/public/interfaces/cursor.mojom.h" | 17 #include "services/ui/public/interfaces/cursor.mojom.h" |
| 17 #include "services/ui/ws/display_binding.h" | 18 #include "services/ui/ws/display_binding.h" |
| 18 #include "services/ui/ws/display_manager.h" | 19 #include "services/ui/ws/display_manager.h" |
| 19 #include "services/ui/ws/focus_controller.h" | 20 #include "services/ui/ws/focus_controller.h" |
| 20 #include "services/ui/ws/platform_display.h" | 21 #include "services/ui/ws/platform_display.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 root_->SetBounds(gfx::Rect(size), allocator_.GenerateId()); | 254 root_->SetBounds(gfx::Rect(size), allocator_.GenerateId()); |
| 254 root_->SetVisible(true); | 255 root_->SetVisible(true); |
| 255 focus_controller_ = base::MakeUnique<FocusController>(this, root_.get()); | 256 focus_controller_ = base::MakeUnique<FocusController>(this, root_.get()); |
| 256 focus_controller_->AddObserver(this); | 257 focus_controller_->AddObserver(this); |
| 257 } | 258 } |
| 258 | 259 |
| 259 ServerWindow* Display::GetRootWindow() { | 260 ServerWindow* Display::GetRootWindow() { |
| 260 return root_.get(); | 261 return root_.get(); |
| 261 } | 262 } |
| 262 | 263 |
| 264 EventSink* Display::GetEventSink() { |
| 265 return this; |
| 266 } |
| 267 |
| 263 void Display::OnAcceleratedWidgetAvailable() { | 268 void Display::OnAcceleratedWidgetAvailable() { |
| 264 display_manager()->OnDisplayAcceleratedWidgetAvailable(this); | 269 display_manager()->OnDisplayAcceleratedWidgetAvailable(this); |
| 265 InitWindowManagerDisplayRoots(); | 270 InitWindowManagerDisplayRoots(); |
| 266 } | 271 } |
| 267 | 272 |
| 268 bool Display::IsInHighContrastMode() { | 273 bool Display::IsInHighContrastMode() { |
| 269 return window_server_->IsActiveUserInHighContrastMode(); | 274 return window_server_->IsActiveUserInHighContrastMode(); |
| 270 } | 275 } |
| 271 | 276 |
| 272 void Display::OnEvent(const ui::Event& event) { | |
| 273 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); | |
| 274 if (display_root) | |
| 275 display_root->window_manager_state()->ProcessEvent(event, GetId()); | |
| 276 window_server_ | |
| 277 ->GetUserActivityMonitorForUser( | |
| 278 window_server_->user_id_tracker()->active_id()) | |
| 279 ->OnUserActivity(); | |
| 280 } | |
| 281 | |
| 282 void Display::OnNativeCaptureLost() { | 277 void Display::OnNativeCaptureLost() { |
| 283 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); | 278 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); |
| 284 if (display_root) | 279 if (display_root) |
| 285 display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId); | 280 display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId); |
| 286 } | 281 } |
| 287 | 282 |
| 288 void Display::OnViewportMetricsChanged( | 283 void Display::OnViewportMetricsChanged( |
| 289 const display::ViewportMetrics& metrics) { | 284 const display::ViewportMetrics& metrics) { |
| 290 if (root_->bounds().size() == metrics.bounds_in_pixels.size()) | 285 if (root_->bounds().size() == metrics.bounds_in_pixels.size()) |
| 291 return; | 286 return; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 void Display::OnUserIdRemoved(const UserId& id) { | 374 void Display::OnUserIdRemoved(const UserId& id) { |
| 380 window_manager_display_root_map_.erase(id); | 375 window_manager_display_root_map_.erase(id); |
| 381 } | 376 } |
| 382 | 377 |
| 383 void Display::OnWindowManagerWindowTreeFactoryReady( | 378 void Display::OnWindowManagerWindowTreeFactoryReady( |
| 384 WindowManagerWindowTreeFactory* factory) { | 379 WindowManagerWindowTreeFactory* factory) { |
| 385 if (!binding_) | 380 if (!binding_) |
| 386 CreateWindowManagerDisplayRootFromFactory(factory); | 381 CreateWindowManagerDisplayRootFromFactory(factory); |
| 387 } | 382 } |
| 388 | 383 |
| 384 EventDispatchDetails Display::OnEventFromSource(Event* event) { |
| 385 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); |
| 386 if (display_root) { |
| 387 WindowManagerState* wm_state = display_root->window_manager_state(); |
| 388 wm_state->ProcessEvent(*event, GetId()); |
| 389 } |
| 390 |
| 391 UserActivityMonitor* activity_monitor = |
| 392 window_server_->GetUserActivityMonitorForUser( |
| 393 window_server_->user_id_tracker()->active_id()); |
| 394 activity_monitor->OnUserActivity(); |
| 395 return EventDispatchDetails(); |
| 396 } |
| 397 |
| 389 } // namespace ws | 398 } // namespace ws |
| 390 } // namespace ui | 399 } // namespace ui |
| OLD | NEW |