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 "components/mus/ws/window_tree_host_impl.h" | 5 #include "components/mus/ws/window_tree_host_impl.h" |
6 | 6 |
7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/mus/common/types.h" | 9 #include "components/mus/common/types.h" |
10 #include "components/mus/public/interfaces/input_event_constants.mojom.h" | 10 #include "components/mus/public/interfaces/input_event_constants.mojom.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 if (windows_needing_frame_destruction_.count(window)) | 154 if (windows_needing_frame_destruction_.count(window)) |
155 return; | 155 return; |
156 windows_needing_frame_destruction_.insert(window); | 156 windows_needing_frame_destruction_.insert(window); |
157 window->AddObserver(this); | 157 window->AddObserver(this); |
158 } | 158 } |
159 | 159 |
160 const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const { | 160 const mojom::ViewportMetrics& WindowTreeHostImpl::GetViewportMetrics() const { |
161 return display_manager_->GetViewportMetrics(); | 161 return display_manager_->GetViewportMetrics(); |
162 } | 162 } |
163 | 163 |
164 void WindowTreeHostImpl::SetCapture(ServerWindow* window, | |
165 bool in_nonclient_area) { | |
166 ServerWindow* capture_window = event_dispatcher_.capture_window(); | |
167 if (capture_window == window) | |
168 return; | |
169 event_dispatcher_.SetCaptureWindow(window, in_nonclient_area); | |
170 } | |
171 | |
164 mojom::Rotation WindowTreeHostImpl::GetRotation() const { | 172 mojom::Rotation WindowTreeHostImpl::GetRotation() const { |
165 return display_manager_->GetRotation(); | 173 return display_manager_->GetRotation(); |
166 } | 174 } |
167 | 175 |
168 void WindowTreeHostImpl::SetFocusedWindow(ServerWindow* new_focused_window) { | 176 void WindowTreeHostImpl::SetFocusedWindow(ServerWindow* new_focused_window) { |
169 ServerWindow* old_focused_window = focus_controller_->GetFocusedWindow(); | 177 ServerWindow* old_focused_window = focus_controller_->GetFocusedWindow(); |
170 if (old_focused_window == new_focused_window) | 178 if (old_focused_window == new_focused_window) |
171 return; | 179 return; |
172 DCHECK(root_window()->Contains(new_focused_window)); | 180 DCHECK(root_window()->Contains(new_focused_window)); |
173 focus_controller_->SetFocusedWindow(new_focused_window); | 181 focus_controller_->SetFocusedWindow(new_focused_window); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 event_queue_.back()->event = CoalesceEvents( | 344 event_queue_.back()->event = CoalesceEvents( |
337 std::move(event_queue_.back()->event), std::move(mojo_event)); | 345 std::move(event_queue_.back()->event), std::move(mojo_event)); |
338 return; | 346 return; |
339 } | 347 } |
340 QueueEvent(std::move(mojo_event), nullptr); | 348 QueueEvent(std::move(mojo_event), nullptr); |
341 return; | 349 return; |
342 } | 350 } |
343 event_dispatcher_.ProcessEvent(std::move(mojo_event)); | 351 event_dispatcher_.ProcessEvent(std::move(mojo_event)); |
344 } | 352 } |
345 | 353 |
354 void WindowTreeHostImpl::SetCapture(ServerWindow* window) { | |
355 if (window) | |
sky
2016/02/10 17:38:22
This should never supply null, right? If I'm right
jonross
2016/02/10 19:45:49
Window is no longer passed in. So removed.
| |
356 display_manager_->SetCapture(); | |
357 } | |
358 | |
359 void WindowTreeHostImpl::ReleaseCapture(ServerWindow* window) { | |
360 display_manager_->ReleaseCapture(); | |
361 } | |
362 | |
363 void WindowTreeHostImpl::OnLostCapture() { | |
364 SetCapture(nullptr, false); | |
365 } | |
366 | |
346 void WindowTreeHostImpl::OnDisplayClosed() { | 367 void WindowTreeHostImpl::OnDisplayClosed() { |
347 if (delegate_) | 368 if (delegate_) |
348 delegate_->OnDisplayClosed(); | 369 delegate_->OnDisplayClosed(); |
349 } | 370 } |
350 | 371 |
351 void WindowTreeHostImpl::OnViewportMetricsChanged( | 372 void WindowTreeHostImpl::OnViewportMetricsChanged( |
352 const mojom::ViewportMetrics& old_metrics, | 373 const mojom::ViewportMetrics& old_metrics, |
353 const mojom::ViewportMetrics& new_metrics) { | 374 const mojom::ViewportMetrics& new_metrics) { |
354 if (!root_) { | 375 if (!root_) { |
355 root_.reset(connection_manager_->CreateServerWindow( | 376 root_.reset(connection_manager_->CreateServerWindow( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 | 488 |
468 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( | 489 void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( |
469 ServerWindow* new_focused_window) { | 490 ServerWindow* new_focused_window) { |
470 SetFocusedWindow(new_focused_window); | 491 SetFocusedWindow(new_focused_window); |
471 } | 492 } |
472 | 493 |
473 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { | 494 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { |
474 return GetFocusedWindow(); | 495 return GetFocusedWindow(); |
475 } | 496 } |
476 | 497 |
498 void WindowTreeHostImpl::OnLostCapture(ServerWindow* window) { | |
499 DCHECK(window); | |
500 connection_manager_->ProcessLostCapture(window); | |
501 } | |
502 | |
477 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, | 503 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, |
478 bool in_nonclient_area, | 504 bool in_nonclient_area, |
479 mojom::EventPtr event) { | 505 mojom::EventPtr event) { |
480 if (event_ack_timer_.IsRunning()) { | 506 if (event_ack_timer_.IsRunning()) { |
481 scoped_ptr<ProcessedEventTarget> processed_event_target( | 507 scoped_ptr<ProcessedEventTarget> processed_event_target( |
482 new ProcessedEventTarget(target, in_nonclient_area)); | 508 new ProcessedEventTarget(target, in_nonclient_area)); |
483 QueueEvent(std::move(event), std::move(processed_event_target)); | 509 QueueEvent(std::move(event), std::move(processed_event_target)); |
484 return; | 510 return; |
485 } | 511 } |
486 | 512 |
487 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); | 513 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); |
488 } | 514 } |
489 | 515 |
490 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { | 516 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { |
491 windows_needing_frame_destruction_.erase(window); | 517 windows_needing_frame_destruction_.erase(window); |
492 window->RemoveObserver(this); | 518 window->RemoveObserver(this); |
493 } | 519 } |
494 | 520 |
495 } // namespace ws | 521 } // namespace ws |
496 } // namespace mus | 522 } // namespace mus |
OLD | NEW |