| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/view_manager/connection_manager.h" | 5 #include "components/view_manager/connection_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "cc/output/compositor_frame.h" |
| 9 #include "components/view_manager/client_connection.h" | 10 #include "components/view_manager/client_connection.h" |
| 10 #include "components/view_manager/connection_manager_delegate.h" | 11 #include "components/view_manager/connection_manager_delegate.h" |
| 11 #include "components/view_manager/focus_controller.h" | 12 #include "components/view_manager/focus_controller.h" |
| 12 #include "components/view_manager/server_view.h" | 13 #include "components/view_manager/server_view.h" |
| 13 #include "components/view_manager/view_coordinate_conversions.h" | 14 #include "components/view_manager/view_coordinate_conversions.h" |
| 14 #include "components/view_manager/view_tree_host_connection.h" | 15 #include "components/view_manager/view_tree_host_connection.h" |
| 15 #include "components/view_manager/view_tree_impl.h" | 16 #include "components/view_manager/view_tree_impl.h" |
| 16 #include "mojo/application/public/cpp/application_connection.h" | 17 #include "mojo/application/public/cpp/application_connection.h" |
| 17 #include "mojo/converters/geometry/geometry_type_converters.h" | 18 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 18 #include "mojo/converters/input_events/input_events_type_converters.h" | 19 #include "mojo/converters/input_events/input_events_type_converters.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 : connection_manager_(connection_manager), | 104 : connection_manager_(connection_manager), |
| 104 connection_id_(connection->id()), | 105 connection_id_(connection->id()), |
| 105 is_delete_view_(is_delete_view) { | 106 is_delete_view_(is_delete_view) { |
| 106 connection_manager_->PrepareForChange(this); | 107 connection_manager_->PrepareForChange(this); |
| 107 } | 108 } |
| 108 | 109 |
| 109 ConnectionManager::ScopedChange::~ScopedChange() { | 110 ConnectionManager::ScopedChange::~ScopedChange() { |
| 110 connection_manager_->FinishChange(); | 111 connection_manager_->FinishChange(); |
| 111 } | 112 } |
| 112 | 113 |
| 113 ConnectionManager::ConnectionManager(ConnectionManagerDelegate* delegate) | 114 ConnectionManager::ConnectionManager( |
| 115 ConnectionManagerDelegate* delegate, |
| 116 const scoped_refptr<surfaces::SurfacesState>& surfaces_state) |
| 114 : delegate_(delegate), | 117 : delegate_(delegate), |
| 118 surfaces_state_(surfaces_state), |
| 115 next_connection_id_(1), | 119 next_connection_id_(1), |
| 116 next_host_id_(0), | 120 next_host_id_(0), |
| 117 event_dispatcher_(this), | 121 event_dispatcher_(this), |
| 118 current_change_(nullptr), | 122 current_change_(nullptr), |
| 119 in_destructor_(false), | 123 in_destructor_(false), |
| 120 animation_runner_(base::TimeTicks::Now()), | 124 animation_runner_(base::TimeTicks::Now()), |
| 121 focus_controller_(new FocusController(this)) { | 125 focus_controller_(new FocusController(this)) { |
| 122 } | 126 } |
| 123 | 127 |
| 124 ConnectionManager::~ConnectionManager() { | 128 ConnectionManager::~ConnectionManager() { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 const ServerView* view) const { | 491 const ServerView* view) const { |
| 488 while (view && view->parent()) | 492 while (view && view->parent()) |
| 489 view = view->parent(); | 493 view = view->parent(); |
| 490 for (auto& pair : host_connection_map_) { | 494 for (auto& pair : host_connection_map_) { |
| 491 if (view == pair.first->root_view()) | 495 if (view == pair.first->root_view()) |
| 492 return pair.first; | 496 return pair.first; |
| 493 } | 497 } |
| 494 return nullptr; | 498 return nullptr; |
| 495 } | 499 } |
| 496 | 500 |
| 501 surfaces::SurfacesState* ConnectionManager::GetSurfacesState() { |
| 502 return surfaces_state_.get(); |
| 503 } |
| 504 |
| 497 void ConnectionManager::PrepareToDestroyView(ServerView* view) { | 505 void ConnectionManager::PrepareToDestroyView(ServerView* view) { |
| 498 if (!in_destructor_ && IsViewAttachedToRoot(view) && | 506 if (!in_destructor_ && IsViewAttachedToRoot(view) && |
| 499 view->id() != ClonedViewId()) { | 507 view->id() != ClonedViewId()) { |
| 500 // We're about to destroy a view. Any cloned views need to be reparented | 508 // We're about to destroy a view. Any cloned views need to be reparented |
| 501 // else the animation would no longer be visible. By moving to a visible | 509 // else the animation would no longer be visible. By moving to a visible |
| 502 // view, view->parent(), we ensure the animation is still visible. | 510 // view, view->parent(), we ensure the animation is still visible. |
| 503 ServerView* parent_above = view; | 511 ServerView* parent_above = view; |
| 504 ReparentClonedViews(view->parent(), &parent_above, view); | 512 ReparentClonedViews(view->parent(), &parent_above, view); |
| 505 } | 513 } |
| 506 | 514 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 ViewTreeHostImpl* new_host = | 714 ViewTreeHostImpl* new_host = |
| 707 new_focused_view ? GetViewTreeHostByView(new_focused_view) : nullptr; | 715 new_focused_view ? GetViewTreeHostByView(new_focused_view) : nullptr; |
| 708 | 716 |
| 709 if (new_host) | 717 if (new_host) |
| 710 new_host->UpdateTextInputState(new_focused_view->text_input_state()); | 718 new_host->UpdateTextInputState(new_focused_view->text_input_state()); |
| 711 else if (old_host) | 719 else if (old_host) |
| 712 old_host->UpdateTextInputState(ui::TextInputState()); | 720 old_host->UpdateTextInputState(ui::TextInputState()); |
| 713 } | 721 } |
| 714 | 722 |
| 715 } // namespace view_manager | 723 } // namespace view_manager |
| OLD | NEW |