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_manager_root_connection.h" | 15 #include "components/view_manager/view_manager_root_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_root_id_(0), | 120 next_root_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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 const ServerView* view) const { | 492 const ServerView* view) const { |
489 while (view && view->parent()) | 493 while (view && view->parent()) |
490 view = view->parent(); | 494 view = view->parent(); |
491 for (auto& pair : root_connection_map_) { | 495 for (auto& pair : root_connection_map_) { |
492 if (view == pair.first->root_view()) | 496 if (view == pair.first->root_view()) |
493 return pair.first; | 497 return pair.first; |
494 } | 498 } |
495 return nullptr; | 499 return nullptr; |
496 } | 500 } |
497 | 501 |
| 502 surfaces::SurfacesState* ConnectionManager::GetSurfacesState() { |
| 503 return surfaces_state_.get(); |
| 504 } |
| 505 |
498 void ConnectionManager::PrepareToDestroyView(ServerView* view) { | 506 void ConnectionManager::PrepareToDestroyView(ServerView* view) { |
499 if (!in_destructor_ && IsViewAttachedToRoot(view) && | 507 if (!in_destructor_ && IsViewAttachedToRoot(view) && |
500 view->id() != ClonedViewId()) { | 508 view->id() != ClonedViewId()) { |
501 // We're about to destroy a view. Any cloned views need to be reparented | 509 // We're about to destroy a view. Any cloned views need to be reparented |
502 // else the animation would no longer be visible. By moving to a visible | 510 // else the animation would no longer be visible. By moving to a visible |
503 // view, view->parent(), we ensure the animation is still visible. | 511 // view, view->parent(), we ensure the animation is still visible. |
504 ServerView* parent_above = view; | 512 ServerView* parent_above = view; |
505 ReparentClonedViews(view->parent(), &parent_above, view); | 513 ReparentClonedViews(view->parent(), &parent_above, view); |
506 } | 514 } |
507 | 515 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 | 717 |
710 if (new_view_manager_root) { | 718 if (new_view_manager_root) { |
711 new_view_manager_root->UpdateTextInputState( | 719 new_view_manager_root->UpdateTextInputState( |
712 new_focused_view->text_input_state()); | 720 new_focused_view->text_input_state()); |
713 } else if (old_view_manager_root) { | 721 } else if (old_view_manager_root) { |
714 old_view_manager_root->UpdateTextInputState(ui::TextInputState()); | 722 old_view_manager_root->UpdateTextInputState(ui::TextInputState()); |
715 } | 723 } |
716 } | 724 } |
717 | 725 |
718 } // namespace view_manager | 726 } // namespace view_manager |
OLD | NEW |