| 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/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 21 matching lines...) Expand all Loading... |
| 32 // Pass in false as native viewport creates the PlatformEventSource. | 32 // Pass in false as native viewport creates the PlatformEventSource. |
| 33 aura::Env::CreateInstance(false); | 33 aura::Env::CreateInstance(false); |
| 34 } | 34 } |
| 35 | 35 |
| 36 RootNodeManager::Context::~Context() { | 36 RootNodeManager::Context::~Context() { |
| 37 aura::Env::DeleteInstance(); | 37 aura::Env::DeleteInstance(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 RootNodeManager::RootNodeManager( | 40 RootNodeManager::RootNodeManager( |
| 41 ApplicationConnection* app_connection, | 41 ApplicationConnection* app_connection, |
| 42 RootViewManagerDelegate* view_manager_delegate, | 42 DisplayManagerDelegate* display_manager_delegate, |
| 43 const Callback<void()>& native_viewport_closed_callback) | 43 const Callback<void()>& native_viewport_closed_callback) |
| 44 : app_connection_(app_connection), | 44 : app_connection_(app_connection), |
| 45 next_connection_id_(1), | 45 next_connection_id_(1), |
| 46 root_view_manager_(app_connection, | 46 display_manager_(app_connection, |
| 47 this, | 47 this, |
| 48 view_manager_delegate, | 48 display_manager_delegate, |
| 49 native_viewport_closed_callback), | 49 native_viewport_closed_callback), |
| 50 root_(new Node(this, RootNodeId())), | 50 root_(new Node(this, RootNodeId())), |
| 51 current_change_(NULL) { | 51 current_change_(NULL) { |
| 52 } | 52 } |
| 53 | 53 |
| 54 RootNodeManager::~RootNodeManager() { | 54 RootNodeManager::~RootNodeManager() { |
| 55 while (!connections_created_by_connect_.empty()) | 55 while (!connections_created_by_connect_.empty()) |
| 56 delete *(connections_created_by_connect_.begin()); | 56 delete *(connections_created_by_connect_.begin()); |
| 57 // All the connections should have been destroyed. | 57 // All the connections should have been destroyed. |
| 58 DCHECK(connection_map_.empty()); | 58 DCHECK(connection_map_.empty()); |
| 59 root_.reset(); | 59 root_.reset(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 return connection; | 237 return connection; |
| 238 } | 238 } |
| 239 | 239 |
| 240 void RootNodeManager::OnNodeDestroyed(const Node* node) { | 240 void RootNodeManager::OnNodeDestroyed(const Node* node) { |
| 241 ProcessNodeDeleted(node->id()); | 241 ProcessNodeDeleted(node->id()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void RootNodeManager::OnNodeHierarchyChanged(const Node* node, | 244 void RootNodeManager::OnNodeHierarchyChanged(const Node* node, |
| 245 const Node* new_parent, | 245 const Node* new_parent, |
| 246 const Node* old_parent) { | 246 const Node* old_parent) { |
| 247 if (!root_view_manager_.in_setup()) | 247 if (!display_manager_.in_setup()) |
| 248 ProcessNodeHierarchyChanged(node, new_parent, old_parent); | 248 ProcessNodeHierarchyChanged(node, new_parent, old_parent); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void RootNodeManager::OnNodeBoundsChanged(const Node* node, | 251 void RootNodeManager::OnNodeBoundsChanged(const Node* node, |
| 252 const gfx::Rect& old_bounds, | 252 const gfx::Rect& old_bounds, |
| 253 const gfx::Rect& new_bounds) { | 253 const gfx::Rect& new_bounds) { |
| 254 ProcessNodeBoundsChanged(node, old_bounds, new_bounds); | 254 ProcessNodeBoundsChanged(node, old_bounds, new_bounds); |
| 255 if (!node->parent()) | 255 if (!node->parent()) |
| 256 return; | 256 return; |
| 257 | 257 |
| 258 // TODO(sky): optimize this. | 258 // TODO(sky): optimize this. |
| 259 root_view_manager_.SchedulePaint(node->parent(), old_bounds); | 259 display_manager_.SchedulePaint(node->parent(), old_bounds); |
| 260 root_view_manager_.SchedulePaint(node->parent(), new_bounds); | 260 display_manager_.SchedulePaint(node->parent(), new_bounds); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void RootNodeManager::OnNodeBitmapChanged(const Node* node) { | 263 void RootNodeManager::OnNodeBitmapChanged(const Node* node) { |
| 264 root_view_manager_.SchedulePaint(node, gfx::Rect(node->bounds().size())); | 264 display_manager_.SchedulePaint(node, gfx::Rect(node->bounds().size())); |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace service | 267 } // namespace service |
| 268 } // namespace mojo | 268 } // namespace mojo |
| OLD | NEW |