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 "mojo/services/view_manager/root_node_manager.h" | 5 #include "mojo/services/view_manager/root_node_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" | 8 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
| 9 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" |
9 #include "mojo/services/view_manager/view.h" | 10 #include "mojo/services/view_manager/view.h" |
10 #include "mojo/services/view_manager/view_manager_service_impl.h" | 11 #include "mojo/services/view_manager/view_manager_service_impl.h" |
11 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
12 | 13 |
13 namespace mojo { | 14 namespace mojo { |
14 namespace view_manager { | 15 namespace view_manager { |
15 namespace service { | 16 namespace service { |
16 | 17 |
17 RootNodeManager::ScopedChange::ScopedChange( | 18 RootNodeManager::ScopedChange::ScopedChange( |
18 ViewManagerServiceImpl* connection, | 19 ViewManagerServiceImpl* connection, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 ConnectionSpecificId creator_id, | 124 ConnectionSpecificId creator_id, |
124 const std::string& url) const { | 125 const std::string& url) const { |
125 for (ConnectionMap::const_iterator i = connection_map_.begin(); | 126 for (ConnectionMap::const_iterator i = connection_map_.begin(); |
126 i != connection_map_.end(); ++i) { | 127 i != connection_map_.end(); ++i) { |
127 if (i->second->creator_id() == creator_id && i->second->url() == url) | 128 if (i->second->creator_id() == creator_id && i->second->url() == url) |
128 return i->second; | 129 return i->second; |
129 } | 130 } |
130 return NULL; | 131 return NULL; |
131 } | 132 } |
132 | 133 |
| 134 void RootNodeManager::DispatchViewInputEventToWindowManager( |
| 135 const View* view, |
| 136 const ui::Event* event) { |
| 137 // Input events are forwarded to the WindowManager. The WindowManager |
| 138 // eventually calls back to us with DispatchOnViewInputEvent(). |
| 139 ViewManagerServiceImpl* connection = GetConnection(kWindowManagerConnection); |
| 140 if (!connection) |
| 141 return; |
| 142 connection->client()->DispatchOnViewInputEvent( |
| 143 ViewIdToTransportId(view->id()), |
| 144 TypeConverter<EventPtr, ui::Event>::ConvertFrom(*event)); |
| 145 } |
| 146 |
133 void RootNodeManager::ProcessNodeBoundsChanged(const Node* node, | 147 void RootNodeManager::ProcessNodeBoundsChanged(const Node* node, |
134 const gfx::Rect& old_bounds, | 148 const gfx::Rect& old_bounds, |
135 const gfx::Rect& new_bounds) { | 149 const gfx::Rect& new_bounds) { |
136 for (ConnectionMap::iterator i = connection_map_.begin(); | 150 for (ConnectionMap::iterator i = connection_map_.begin(); |
137 i != connection_map_.end(); ++i) { | 151 i != connection_map_.end(); ++i) { |
138 i->second->ProcessNodeBoundsChanged(node, old_bounds, new_bounds, | 152 i->second->ProcessNodeBoundsChanged(node, old_bounds, new_bounds, |
139 IsChangeSource(i->first)); | 153 IsChangeSource(i->first)); |
140 } | 154 } |
141 } | 155 } |
142 | 156 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 250 } |
237 | 251 |
238 void RootNodeManager::OnNodeViewReplaced(const Node* node, | 252 void RootNodeManager::OnNodeViewReplaced(const Node* node, |
239 const View* new_view, | 253 const View* new_view, |
240 const View* old_view) { | 254 const View* old_view) { |
241 ProcessNodeViewReplaced(node, new_view, old_view); | 255 ProcessNodeViewReplaced(node, new_view, old_view); |
242 } | 256 } |
243 | 257 |
244 void RootNodeManager::OnViewInputEvent(const View* view, | 258 void RootNodeManager::OnViewInputEvent(const View* view, |
245 const ui::Event* event) { | 259 const ui::Event* event) { |
246 GetConnection(view->id().connection_id)->ProcessViewInputEvent(view, event); | 260 DispatchViewInputEventToWindowManager(view, event); |
247 } | 261 } |
248 | 262 |
249 } // namespace service | 263 } // namespace service |
250 } // namespace view_manager | 264 } // namespace view_manager |
251 } // namespace mojo | 265 } // namespace mojo |
OLD | NEW |