| 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 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 root_->SetBounds(gfx::Rect(size), allocator_.GenerateId()); | 253 root_->SetBounds(gfx::Rect(size), allocator_.GenerateId()); |
| 254 root_->SetVisible(true); | 254 root_->SetVisible(true); |
| 255 focus_controller_ = base::MakeUnique<FocusController>(this, root_.get()); | 255 focus_controller_ = base::MakeUnique<FocusController>(this, root_.get()); |
| 256 focus_controller_->AddObserver(this); | 256 focus_controller_->AddObserver(this); |
| 257 } | 257 } |
| 258 | 258 |
| 259 ServerWindow* Display::GetRootWindow() { | 259 ServerWindow* Display::GetRootWindow() { |
| 260 return root_.get(); | 260 return root_.get(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 EventSink* Display::GetEventSink() { |
| 264 return this; |
| 265 } |
| 266 |
| 263 void Display::OnAcceleratedWidgetAvailable() { | 267 void Display::OnAcceleratedWidgetAvailable() { |
| 264 display_manager()->OnDisplayAcceleratedWidgetAvailable(this); | 268 display_manager()->OnDisplayAcceleratedWidgetAvailable(this); |
| 265 InitWindowManagerDisplayRoots(); | 269 InitWindowManagerDisplayRoots(); |
| 266 } | 270 } |
| 267 | 271 |
| 268 void Display::OnEvent(const ui::Event& event) { | |
| 269 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); | |
| 270 if (display_root) | |
| 271 display_root->window_manager_state()->ProcessEvent(event, GetId()); | |
| 272 window_server_ | |
| 273 ->GetUserActivityMonitorForUser( | |
| 274 window_server_->user_id_tracker()->active_id()) | |
| 275 ->OnUserActivity(); | |
| 276 } | |
| 277 | |
| 278 void Display::OnNativeCaptureLost() { | 272 void Display::OnNativeCaptureLost() { |
| 279 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); | 273 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); |
| 280 if (display_root) | 274 if (display_root) |
| 281 display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId); | 275 display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId); |
| 282 } | 276 } |
| 283 | 277 |
| 284 void Display::OnViewportMetricsChanged( | 278 void Display::OnViewportMetricsChanged( |
| 285 const display::ViewportMetrics& metrics) { | 279 const display::ViewportMetrics& metrics) { |
| 286 if (root_->bounds().size() == metrics.bounds_in_pixels.size()) | 280 if (root_->bounds().size() == metrics.bounds_in_pixels.size()) |
| 287 return; | 281 return; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 void Display::OnUserIdRemoved(const UserId& id) { | 369 void Display::OnUserIdRemoved(const UserId& id) { |
| 376 window_manager_display_root_map_.erase(id); | 370 window_manager_display_root_map_.erase(id); |
| 377 } | 371 } |
| 378 | 372 |
| 379 void Display::OnWindowManagerWindowTreeFactoryReady( | 373 void Display::OnWindowManagerWindowTreeFactoryReady( |
| 380 WindowManagerWindowTreeFactory* factory) { | 374 WindowManagerWindowTreeFactory* factory) { |
| 381 if (!binding_) | 375 if (!binding_) |
| 382 CreateWindowManagerDisplayRootFromFactory(factory); | 376 CreateWindowManagerDisplayRootFromFactory(factory); |
| 383 } | 377 } |
| 384 | 378 |
| 379 EventDispatchDetails Display::OnEventFromSource(Event* event) { |
| 380 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); |
| 381 if (display_root) { |
| 382 WindowManagerState* wm_state = display_root->window_manager_state(); |
| 383 wm_state->ProcessEvent(*event, GetId()); |
| 384 } |
| 385 |
| 386 UserActivityMonitor* activity_monitor = |
| 387 window_server_->GetUserActivityMonitorForUser( |
| 388 window_server_->user_id_tracker()->active_id()); |
| 389 activity_monitor->OnUserActivity(); |
| 390 return EventDispatchDetails(); |
| 391 } |
| 392 |
| 385 } // namespace ws | 393 } // namespace ws |
| 386 } // namespace ui | 394 } // namespace ui |
| OLD | NEW |