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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 const ServerView* old_parent) { | 256 const ServerView* old_parent) { |
257 if (!display_manager_.in_setup()) | 257 if (!display_manager_.in_setup()) |
258 ProcessWillChangeViewHierarchy(view, new_parent, old_parent); | 258 ProcessWillChangeViewHierarchy(view, new_parent, old_parent); |
259 } | 259 } |
260 | 260 |
261 void ConnectionManager::OnViewHierarchyChanged(const ServerView* view, | 261 void ConnectionManager::OnViewHierarchyChanged(const ServerView* view, |
262 const ServerView* new_parent, | 262 const ServerView* new_parent, |
263 const ServerView* old_parent) { | 263 const ServerView* old_parent) { |
264 if (!display_manager_.in_setup()) | 264 if (!display_manager_.in_setup()) |
265 ProcessViewHierarchyChanged(view, new_parent, old_parent); | 265 ProcessViewHierarchyChanged(view, new_parent, old_parent); |
266 // TODO(beng): optimize. | |
267 if (old_parent) | |
268 display_manager_.SchedulePaint(old_parent, old_parent->bounds()); | |
sky
2014/09/11 19:32:22
I think you want gfx::Rect(old_parent()->bounds().
| |
269 if (new_parent) | |
270 display_manager_.SchedulePaint(new_parent, new_parent->bounds()); | |
266 } | 271 } |
267 | 272 |
268 void ConnectionManager::OnViewBoundsChanged(const ServerView* view, | 273 void ConnectionManager::OnViewBoundsChanged(const ServerView* view, |
269 const gfx::Rect& old_bounds, | 274 const gfx::Rect& old_bounds, |
270 const gfx::Rect& new_bounds) { | 275 const gfx::Rect& new_bounds) { |
271 ProcessViewBoundsChanged(view, old_bounds, new_bounds); | 276 ProcessViewBoundsChanged(view, old_bounds, new_bounds); |
272 if (!view->parent()) | 277 if (!view->parent()) |
273 return; | 278 return; |
274 | 279 |
275 // TODO(sky): optimize this. | 280 // TODO(sky): optimize this. |
276 display_manager_.SchedulePaint(view->parent(), old_bounds); | 281 display_manager_.SchedulePaint(view->parent(), old_bounds); |
277 display_manager_.SchedulePaint(view->parent(), new_bounds); | 282 display_manager_.SchedulePaint(view->parent(), new_bounds); |
278 } | 283 } |
279 | 284 |
280 void ConnectionManager::OnViewBitmapChanged(const ServerView* view) { | 285 void ConnectionManager::OnViewBitmapChanged(const ServerView* view) { |
281 display_manager_.SchedulePaint(view, gfx::Rect(view->bounds().size())); | 286 display_manager_.SchedulePaint(view, gfx::Rect(view->bounds().size())); |
282 } | 287 } |
283 | 288 |
284 void ConnectionManager::OnWillChangeViewVisibility(const ServerView* view) { | 289 void ConnectionManager::OnWillChangeViewVisibility(const ServerView* view) { |
285 for (ConnectionMap::iterator i = connection_map_.begin(); | 290 for (ConnectionMap::iterator i = connection_map_.begin(); |
286 i != connection_map_.end(); | 291 i != connection_map_.end(); |
287 ++i) { | 292 ++i) { |
288 i->second->ProcessWillChangeViewVisibility(view, IsChangeSource(i->first)); | 293 i->second->ProcessWillChangeViewVisibility(view, IsChangeSource(i->first)); |
289 } | 294 } |
290 } | 295 } |
291 | 296 |
292 } // namespace service | 297 } // namespace service |
293 } // namespace mojo | 298 } // namespace mojo |
OLD | NEW |