Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Side by Side Diff: trunk/src/mojo/services/view_manager/view_manager_connection.cc

Issue 304323005: Revert 273723 "Wire input events through the ViewManagerClient i..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "mojo/services/view_manager/view_manager_connection.h" 5 #include "mojo/services/view_manager/view_manager_connection.h"
6 6
7 #include "base/bind.h"
8 #include "base/stl_util.h" 7 #include "base/stl_util.h"
9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" 8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
10 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h"
11 #include "mojo/services/view_manager/node.h" 9 #include "mojo/services/view_manager/node.h"
12 #include "mojo/services/view_manager/root_node_manager.h" 10 #include "mojo/services/view_manager/root_node_manager.h"
13 #include "mojo/services/view_manager/view.h" 11 #include "mojo/services/view_manager/view.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
16 #include "ui/gfx/codec/png_codec.h" 14 #include "ui/gfx/codec/png_codec.h"
17 15
18 namespace mojo { 16 namespace mojo {
19 namespace view_manager { 17 namespace view_manager {
20 namespace service { 18 namespace service {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (originated_change || !known_nodes_.count(NodeIdToTransportId(node->id()))) 162 if (originated_change || !known_nodes_.count(NodeIdToTransportId(node->id())))
165 return; 163 return;
166 const TransportViewId new_view_id = new_view ? 164 const TransportViewId new_view_id = new_view ?
167 ViewIdToTransportId(new_view->id()) : 0; 165 ViewIdToTransportId(new_view->id()) : 0;
168 const TransportViewId old_view_id = old_view ? 166 const TransportViewId old_view_id = old_view ?
169 ViewIdToTransportId(old_view->id()) : 0; 167 ViewIdToTransportId(old_view->id()) : 0;
170 client()->OnNodeViewReplaced(NodeIdToTransportId(node->id()), 168 client()->OnNodeViewReplaced(NodeIdToTransportId(node->id()),
171 new_view_id, old_view_id); 169 new_view_id, old_view_id);
172 } 170 }
173 171
174 void ViewManagerConnection::ProcessViewInputEvent(const View* view,
175 const ui::Event* event) {
176 const TransportViewId view_id = ViewIdToTransportId(view->id());
177 if (view->id().connection_id != id_)
178 return;
179 client()->OnViewInputEvent(
180 view_id,
181 TypeConverter<EventPtr, ui::Event>::ConvertFrom(*event),
182 base::Bind(&base::DoNothing));
183 }
184
185 void ViewManagerConnection::ProcessNodeDeleted( 172 void ViewManagerConnection::ProcessNodeDeleted(
186 const NodeId& node, 173 const NodeId& node,
187 TransportChangeId server_change_id, 174 TransportChangeId server_change_id,
188 bool originated_change) { 175 bool originated_change) {
189 const bool in_known = known_nodes_.erase(NodeIdToTransportId(node)) > 0; 176 const bool in_known = known_nodes_.erase(NodeIdToTransportId(node)) > 0;
190 const bool in_roots = roots_.erase(NodeIdToTransportId(node)) > 0; 177 const bool in_roots = roots_.erase(NodeIdToTransportId(node)) > 0;
191 178
192 if (in_roots && roots_.empty()) 179 if (in_roots && roots_.empty())
193 roots_.insert(NodeIdToTransportId(InvalidNodeId())); 180 roots_.insert(NodeIdToTransportId(InvalidNodeId()));
194 181
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 const Node* old_parent) { 606 const Node* old_parent) {
620 root_node_manager_->ProcessNodeHierarchyChanged(node, new_parent, old_parent); 607 root_node_manager_->ProcessNodeHierarchyChanged(node, new_parent, old_parent);
621 } 608 }
622 609
623 void ViewManagerConnection::OnNodeViewReplaced(const Node* node, 610 void ViewManagerConnection::OnNodeViewReplaced(const Node* node,
624 const View* new_view, 611 const View* new_view,
625 const View* old_view) { 612 const View* old_view) {
626 root_node_manager_->ProcessNodeViewReplaced(node, new_view, old_view); 613 root_node_manager_->ProcessNodeViewReplaced(node, new_view, old_view);
627 } 614 }
628 615
629 void ViewManagerConnection::OnViewInputEvent(const View* view,
630 const ui::Event* event) {
631 root_node_manager_->ProcessViewInputEvent(view, event);
632 }
633
634 void ViewManagerConnection::OnConnectionEstablished() { 616 void ViewManagerConnection::OnConnectionEstablished() {
635 DCHECK_EQ(0, id_); // Should only get OnConnectionEstablished() once. 617 DCHECK_EQ(0, id_); // Should only get OnConnectionEstablished() once.
636 618
637 id_ = root_node_manager_->GetAndAdvanceNextConnectionId(); 619 id_ = root_node_manager_->GetAndAdvanceNextConnectionId();
638 620
639 root_node_manager_->AddConnection(this); 621 root_node_manager_->AddConnection(this);
640 622
641 std::vector<const Node*> to_send; 623 std::vector<const Node*> to_send;
642 if (roots_.empty()) { 624 if (roots_.empty()) {
643 GetUnknownNodesFrom(root_node_manager_->root(), &to_send); 625 GetUnknownNodesFrom(root_node_manager_->root(), &to_send);
644 } else { 626 } else {
645 for (NodeIdSet::const_iterator i = roots_.begin(); i != roots_.end(); ++i) 627 for (NodeIdSet::const_iterator i = roots_.begin(); i != roots_.end(); ++i)
646 GetUnknownNodesFrom(GetNode(NodeIdFromTransportId(*i)), &to_send); 628 GetUnknownNodesFrom(GetNode(NodeIdFromTransportId(*i)), &to_send);
647 } 629 }
648 630
649 client()->OnViewManagerConnectionEstablished( 631 client()->OnViewManagerConnectionEstablished(
650 id_, 632 id_,
651 root_node_manager_->next_server_change_id(), 633 root_node_manager_->next_server_change_id(),
652 NodesToINodes(to_send)); 634 NodesToINodes(to_send));
653 } 635 }
654 636
655 } // namespace service 637 } // namespace service
656 } // namespace view_manager 638 } // namespace view_manager
657 } // namespace mojo 639 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698