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

Side by Side Diff: mojo/services/view_manager/root_node_manager.cc

Issue 267293004: Wires up view manager to an actual display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 7 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/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/services/view_manager/view_manager_connection.h" 8 #include "mojo/services/view_manager/view_manager_connection.h"
9 #include "ui/aura/env.h"
9 10
10 namespace mojo { 11 namespace mojo {
11 namespace services { 12 namespace services {
12 namespace view_manager { 13 namespace view_manager {
13 namespace { 14 namespace {
14 15
15 // Id for the root node. 16 // Id for the root node.
16 const TransportConnectionSpecificNodeId kRootId = 1; 17 const TransportConnectionSpecificNodeId kRootId = 1;
17 18
18 } // namespace 19 } // namespace
19 20
21 RootNodeManager::Context::Context() {
22 // Pass in false as native viewport creates the PlatformEventSource.
23 aura::Env::CreateInstance(false);
24 }
25
26 RootNodeManager::Context::~Context() {
27 }
28
20 RootNodeManager::ScopedChange::ScopedChange(ViewManagerConnection* connection, 29 RootNodeManager::ScopedChange::ScopedChange(ViewManagerConnection* connection,
21 RootNodeManager* root, 30 RootNodeManager* root,
22 TransportChangeId change_id) 31 TransportChangeId change_id)
23 : root_(root) { 32 : root_(root) {
24 root_->PrepareForChange(connection, change_id); 33 root_->PrepareForChange(connection, change_id);
25 } 34 }
26 35
27 RootNodeManager::ScopedChange::~ScopedChange() { 36 RootNodeManager::ScopedChange::~ScopedChange() {
28 root_->FinishChange(); 37 root_->FinishChange();
29 } 38 }
30 39
31 RootNodeManager::RootNodeManager() 40 RootNodeManager::RootNodeManager(Shell* shell)
32 : next_connection_id_(1), 41 : next_connection_id_(1),
42 root_view_manager_(shell, this),
33 root_(this, NodeId(0, kRootId)) { 43 root_(this, NodeId(0, kRootId)) {
34 } 44 }
35 45
36 RootNodeManager::~RootNodeManager() { 46 RootNodeManager::~RootNodeManager() {
47 // All the connections should have been destroyed.
48 DCHECK(connection_map_.empty());
37 } 49 }
38 50
39 TransportConnectionId RootNodeManager::GetAndAdvanceNextConnectionId() { 51 TransportConnectionId RootNodeManager::GetAndAdvanceNextConnectionId() {
40 const TransportConnectionId id = next_connection_id_++; 52 const TransportConnectionId id = next_connection_id_++;
41 DCHECK_LT(id, next_connection_id_); 53 DCHECK_LT(id, next_connection_id_);
42 return id; 54 return id;
43 } 55 }
44 56
45 void RootNodeManager::AddConnection(ViewManagerConnection* connection) { 57 void RootNodeManager::AddConnection(ViewManagerConnection* connection) {
46 DCHECK_EQ(0u, connection_map_.count(connection->id())); 58 DCHECK_EQ(0u, connection_map_.count(connection->id()));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 TransportChangeId change_id) { 112 TransportChangeId change_id) {
101 DCHECK(!change_.get()); // Should only ever have one change in flight. 113 DCHECK(!change_.get()); // Should only ever have one change in flight.
102 change_.reset(new Change(connection->id(), change_id)); 114 change_.reset(new Change(connection->id(), change_id));
103 } 115 }
104 116
105 void RootNodeManager::FinishChange() { 117 void RootNodeManager::FinishChange() {
106 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced. 118 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced.
107 change_.reset(); 119 change_.reset();
108 } 120 }
109 121
110 void RootNodeManager::OnCreated() {
111 }
112
113 void RootNodeManager::OnDestroyed() {
114 }
115
116 void RootNodeManager::OnBoundsChanged(const Rect& bounds) {
117 }
118
119 void RootNodeManager::OnEvent(const Event& event,
120 const mojo::Callback<void()>& callback) {
121 callback.Run();
122 }
123
124 void RootNodeManager::OnNodeHierarchyChanged(const NodeId& node, 122 void RootNodeManager::OnNodeHierarchyChanged(const NodeId& node,
125 const NodeId& new_parent, 123 const NodeId& new_parent,
126 const NodeId& old_parent) { 124 const NodeId& old_parent) {
127 NotifyNodeHierarchyChanged(node, new_parent, old_parent); 125 if (!root_view_manager_.in_setup())
126 NotifyNodeHierarchyChanged(node, new_parent, old_parent);
128 } 127 }
129 128
130 void RootNodeManager::OnNodeViewReplaced(const NodeId& node, 129 void RootNodeManager::OnNodeViewReplaced(const NodeId& node,
131 const ViewId& new_view_id, 130 const ViewId& new_view_id,
132 const ViewId& old_view_id) { 131 const ViewId& old_view_id) {
133 NotifyNodeViewReplaced(node, new_view_id, old_view_id); 132 NotifyNodeViewReplaced(node, new_view_id, old_view_id);
134 } 133 }
135 134
136 } // namespace view_manager 135 } // namespace view_manager
137 } // namespace services 136 } // namespace services
138 } // namespace mojo 137 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/root_node_manager.h ('k') | mojo/services/view_manager/root_view_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698