Index: components/mus/view_tree_host_impl.cc |
diff --git a/components/mus/view_tree_host_impl.cc b/components/mus/view_tree_host_impl.cc |
index 7f04d19d4054242bb6f05d5396e1d8038dc86424..772cbbc3103dba633ac5402d3ed55763625ae656 100644 |
--- a/components/mus/view_tree_host_impl.cc |
+++ b/components/mus/view_tree_host_impl.cc |
@@ -31,7 +31,8 @@ ViewTreeHostImpl::ViewTreeHostImpl( |
app_impl, |
gpu_state, |
surfaces_state)), |
- focus_controller_(new FocusController(this)) { |
+ focus_controller_(new FocusController(this)), |
+ captured_view_(nullptr) { |
display_manager_->Init(this); |
if (client_) { |
client_.set_connection_error_handler( |
@@ -68,6 +69,19 @@ const mojo::ViewportMetrics& ViewTreeHostImpl::GetViewportMetrics() const { |
return display_manager_->GetViewportMetrics(); |
} |
+void ViewTreeHostImpl::SetCapture(ServerView* view) { |
+ if (captured_view_) { |
+ ViewTreeImpl* connection = |
+ connection_manager_->GetConnection(captured_view_->id().connection_id); |
+ if (connection) { |
+ connection->ProcessLostCapture(captured_view_); |
+ } |
+ } |
+ captured_view_ = view; |
+ if (captured_view_) |
+ display_manager_->SetCapture(); |
+} |
+ |
void ViewTreeHostImpl::SetFocusedView(ServerView* new_focused_view) { |
ServerView* old_focused_view = focus_controller_->GetFocusedView(); |
if (old_focused_view == new_focused_view) |
@@ -154,6 +168,10 @@ void ViewTreeHostImpl::OnEvent(mojo::EventPtr event) { |
event_dispatcher_.OnEvent(event.Pass()); |
} |
+void ViewTreeHostImpl::OnLostCapture() { |
+ SetCapture(nullptr); |
+} |
+ |
void ViewTreeHostImpl::OnDisplayClosed() { |
if (delegate_) |
delegate_->OnDisplayClosed(); |