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/connection_manager.h" | 5 #include "mojo/services/view_manager/connection_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/public/cpp/application/application_connection.h" | 8 #include "mojo/public/cpp/application/application_connection.h" |
9 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 9 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
10 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" | 10 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 const gfx::Rect& old_bounds, | 154 const gfx::Rect& old_bounds, |
155 const gfx::Rect& new_bounds) { | 155 const gfx::Rect& new_bounds) { |
156 for (ConnectionMap::iterator i = connection_map_.begin(); | 156 for (ConnectionMap::iterator i = connection_map_.begin(); |
157 i != connection_map_.end(); | 157 i != connection_map_.end(); |
158 ++i) { | 158 ++i) { |
159 i->second->ProcessViewBoundsChanged( | 159 i->second->ProcessViewBoundsChanged( |
160 view, old_bounds, new_bounds, IsChangeSource(i->first)); | 160 view, old_bounds, new_bounds, IsChangeSource(i->first)); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
| 164 void ConnectionManager::ProcessWillChangeViewHierarchy( |
| 165 const ServerView* view, |
| 166 const ServerView* new_parent, |
| 167 const ServerView* old_parent) { |
| 168 for (ConnectionMap::iterator i = connection_map_.begin(); |
| 169 i != connection_map_.end(); |
| 170 ++i) { |
| 171 i->second->ProcessWillChangeViewHierarchy( |
| 172 view, new_parent, old_parent, IsChangeSource(i->first)); |
| 173 } |
| 174 } |
| 175 |
164 void ConnectionManager::ProcessViewHierarchyChanged( | 176 void ConnectionManager::ProcessViewHierarchyChanged( |
165 const ServerView* view, | 177 const ServerView* view, |
166 const ServerView* new_parent, | 178 const ServerView* new_parent, |
167 const ServerView* old_parent) { | 179 const ServerView* old_parent) { |
168 for (ConnectionMap::iterator i = connection_map_.begin(); | 180 for (ConnectionMap::iterator i = connection_map_.begin(); |
169 i != connection_map_.end(); | 181 i != connection_map_.end(); |
170 ++i) { | 182 ++i) { |
171 i->second->ProcessViewHierarchyChanged( | 183 i->second->ProcessViewHierarchyChanged( |
172 view, new_parent, old_parent, IsChangeSource(i->first)); | 184 view, new_parent, old_parent, IsChangeSource(i->first)); |
173 } | 185 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 WeakBindToPipe(connection, pipe.handle0.Pass()); | 243 WeakBindToPipe(connection, pipe.handle0.Pass()); |
232 connections_created_by_connect_.insert(connection); | 244 connections_created_by_connect_.insert(connection); |
233 OnConnectionMessagedClient(connection->id()); | 245 OnConnectionMessagedClient(connection->id()); |
234 return connection; | 246 return connection; |
235 } | 247 } |
236 | 248 |
237 void ConnectionManager::OnViewDestroyed(const ServerView* view) { | 249 void ConnectionManager::OnViewDestroyed(const ServerView* view) { |
238 ProcessViewDeleted(view->id()); | 250 ProcessViewDeleted(view->id()); |
239 } | 251 } |
240 | 252 |
| 253 void ConnectionManager::OnWillChangeViewHierarchy( |
| 254 const ServerView* view, |
| 255 const ServerView* new_parent, |
| 256 const ServerView* old_parent) { |
| 257 if (!display_manager_.in_setup()) |
| 258 ProcessWillChangeViewHierarchy(view, new_parent, old_parent); |
| 259 } |
| 260 |
241 void ConnectionManager::OnViewHierarchyChanged(const ServerView* view, | 261 void ConnectionManager::OnViewHierarchyChanged(const ServerView* view, |
242 const ServerView* new_parent, | 262 const ServerView* new_parent, |
243 const ServerView* old_parent) { | 263 const ServerView* old_parent) { |
244 if (!display_manager_.in_setup()) | 264 if (!display_manager_.in_setup()) |
245 ProcessViewHierarchyChanged(view, new_parent, old_parent); | 265 ProcessViewHierarchyChanged(view, new_parent, old_parent); |
246 } | 266 } |
247 | 267 |
248 void ConnectionManager::OnViewBoundsChanged(const ServerView* view, | 268 void ConnectionManager::OnViewBoundsChanged(const ServerView* view, |
249 const gfx::Rect& old_bounds, | 269 const gfx::Rect& old_bounds, |
250 const gfx::Rect& new_bounds) { | 270 const gfx::Rect& new_bounds) { |
251 ProcessViewBoundsChanged(view, old_bounds, new_bounds); | 271 ProcessViewBoundsChanged(view, old_bounds, new_bounds); |
252 if (!view->parent()) | 272 if (!view->parent()) |
253 return; | 273 return; |
254 | 274 |
255 // TODO(sky): optimize this. | 275 // TODO(sky): optimize this. |
256 display_manager_.SchedulePaint(view->parent(), old_bounds); | 276 display_manager_.SchedulePaint(view->parent(), old_bounds); |
257 display_manager_.SchedulePaint(view->parent(), new_bounds); | 277 display_manager_.SchedulePaint(view->parent(), new_bounds); |
258 } | 278 } |
259 | 279 |
260 void ConnectionManager::OnViewBitmapChanged(const ServerView* view) { | 280 void ConnectionManager::OnViewBitmapChanged(const ServerView* view) { |
261 display_manager_.SchedulePaint(view, gfx::Rect(view->bounds().size())); | 281 display_manager_.SchedulePaint(view, gfx::Rect(view->bounds().size())); |
262 } | 282 } |
263 | 283 |
| 284 void ConnectionManager::OnWillChangeViewVisibility(const ServerView* view) { |
| 285 for (ConnectionMap::iterator i = connection_map_.begin(); |
| 286 i != connection_map_.end(); |
| 287 ++i) { |
| 288 i->second->ProcessWillChangeViewVisibility(view, IsChangeSource(i->first)); |
| 289 } |
| 290 } |
| 291 |
264 } // namespace service | 292 } // namespace service |
265 } // namespace mojo | 293 } // namespace mojo |
OLD | NEW |