Chromium Code Reviews| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 display_manager()->GetAndAdvanceNextRootId(), | 257 display_manager()->GetAndAdvanceNextRootId(), |
| 258 ServerWindow::Properties())); | 258 ServerWindow::Properties())); |
| 259 root_->set_event_targeting_policy( | 259 root_->set_event_targeting_policy( |
| 260 mojom::EventTargetingPolicy::DESCENDANTS_ONLY); | 260 mojom::EventTargetingPolicy::DESCENDANTS_ONLY); |
| 261 root_->SetBounds(gfx::Rect(size)); | 261 root_->SetBounds(gfx::Rect(size)); |
| 262 root_->SetVisible(true); | 262 root_->SetVisible(true); |
| 263 focus_controller_ = base::MakeUnique<FocusController>(this, root_.get()); | 263 focus_controller_ = base::MakeUnique<FocusController>(this, root_.get()); |
| 264 focus_controller_->AddObserver(this); | 264 focus_controller_->AddObserver(this); |
| 265 } | 265 } |
| 266 | 266 |
| 267 bool Display::CanDispatchToTarget(EventTarget* target) { | |
| 268 NOTREACHED(); | |
| 269 return true; | |
| 270 } | |
| 271 | |
| 272 ui::EventTarget* Display::GetRootForEvent(ui::Event* event) { | |
| 273 NOTREACHED(); | |
| 274 return nullptr; | |
| 275 } | |
| 276 | |
| 277 ui::EventTargeter* Display::GetDefaultEventTargeter() { | |
| 278 NOTREACHED(); | |
|
sadrul
2017/02/24 15:59:54
These should have proper implementations.
Peng
2017/02/28 16:47:30
I did little research and found out it is not easy
sky
2017/02/28 17:54:26
It feels a bit hacky to try to use parts of event
Peng
2017/02/28 18:14:29
We can let PlatformDisplayDefault to implement the
| |
| 279 return nullptr; | |
| 280 } | |
| 281 | |
| 282 ui::EventDispatchDetails Display::OnEventFromSource(Event* event) { | |
| 283 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); | |
| 284 if (display_root) | |
| 285 display_root->window_manager_state()->ProcessEvent(*event, GetId()); | |
| 286 window_server_ | |
| 287 ->GetUserActivityMonitorForUser( | |
| 288 window_server_->user_id_tracker()->active_id()) | |
| 289 ->OnUserActivity(); | |
| 290 return ui::EventDispatchDetails(); | |
| 291 } | |
| 292 | |
| 267 display::Display Display::GetDisplay() { | 293 display::Display Display::GetDisplay() { |
| 268 return ToDisplay(); | 294 return ToDisplay(); |
| 269 } | 295 } |
| 270 | 296 |
| 271 ServerWindow* Display::GetRootWindow() { | 297 ServerWindow* Display::GetRootWindow() { |
| 272 return root_.get(); | 298 return root_.get(); |
| 273 } | 299 } |
| 274 | 300 |
| 301 ui::EventProcessor* Display::GetEventProcessor() { | |
| 302 return this; | |
| 303 } | |
| 304 | |
| 275 void Display::OnAcceleratedWidgetAvailable() { | 305 void Display::OnAcceleratedWidgetAvailable() { |
| 276 display_manager()->OnDisplayAcceleratedWidgetAvailable(this); | 306 display_manager()->OnDisplayAcceleratedWidgetAvailable(this); |
| 277 InitWindowManagerDisplayRoots(); | 307 InitWindowManagerDisplayRoots(); |
| 278 } | 308 } |
| 279 | 309 |
| 280 bool Display::IsInHighContrastMode() { | 310 bool Display::IsInHighContrastMode() { |
| 281 return window_server_->IsActiveUserInHighContrastMode(); | 311 return window_server_->IsActiveUserInHighContrastMode(); |
| 282 } | 312 } |
| 283 | 313 |
| 284 void Display::OnEvent(const ui::Event& event) { | |
| 285 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); | |
| 286 if (display_root) | |
| 287 display_root->window_manager_state()->ProcessEvent(event, GetId()); | |
| 288 window_server_ | |
| 289 ->GetUserActivityMonitorForUser( | |
| 290 window_server_->user_id_tracker()->active_id()) | |
| 291 ->OnUserActivity(); | |
| 292 } | |
| 293 | |
| 294 void Display::OnNativeCaptureLost() { | 314 void Display::OnNativeCaptureLost() { |
| 295 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); | 315 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); |
| 296 if (display_root) | 316 if (display_root) |
| 297 display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId); | 317 display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId); |
| 298 } | 318 } |
| 299 | 319 |
| 300 void Display::OnViewportMetricsChanged( | 320 void Display::OnViewportMetricsChanged( |
| 301 const display::ViewportMetrics& metrics) { | 321 const display::ViewportMetrics& metrics) { |
| 302 if (root_->bounds().size() == metrics.pixel_size) | 322 if (root_->bounds().size() == metrics.pixel_size) |
| 303 return; | 323 return; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 } | 413 } |
| 394 | 414 |
| 395 void Display::OnWindowManagerWindowTreeFactoryReady( | 415 void Display::OnWindowManagerWindowTreeFactoryReady( |
| 396 WindowManagerWindowTreeFactory* factory) { | 416 WindowManagerWindowTreeFactory* factory) { |
| 397 if (!binding_) | 417 if (!binding_) |
| 398 CreateWindowManagerDisplayRootFromFactory(factory); | 418 CreateWindowManagerDisplayRootFromFactory(factory); |
| 399 } | 419 } |
| 400 | 420 |
| 401 } // namespace ws | 421 } // namespace ws |
| 402 } // namespace ui | 422 } // namespace ui |
| OLD | NEW |