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/node.h" | 5 #include "mojo/services/view_manager/node.h" |
6 | 6 |
7 #include "mojo/services/view_manager/node_delegate.h" | 7 #include "mojo/services/view_manager/node_delegate.h" |
8 #include "mojo/services/view_manager/view.h" | 8 #include "mojo/services/view_manager/view.h" |
9 #include "ui/aura/window_property.h" | 9 #include "ui/aura/window_property.h" |
10 #include "ui/base/cursor/cursor.h" | 10 #include "ui/base/cursor/cursor.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 window_.AddObserver(this); | 31 window_.AddObserver(this); |
32 window_.SetProperty(kNodeKey, this); | 32 window_.SetProperty(kNodeKey, this); |
33 window_.Init(aura::WINDOW_LAYER_TEXTURED); | 33 window_.Init(aura::WINDOW_LAYER_TEXTURED); |
34 | 34 |
35 // TODO(sky): this likely needs to be false and add a visibility API. | 35 // TODO(sky): this likely needs to be false and add a visibility API. |
36 window_.Show(); | 36 window_.Show(); |
37 } | 37 } |
38 | 38 |
39 Node::~Node() { | 39 Node::~Node() { |
40 SetView(NULL); | 40 SetView(NULL); |
| 41 // This is implicitly done during deletion of the window, but we do it here so |
| 42 // that we're in a known state. |
| 43 if (window_.parent()) |
| 44 window_.parent()->RemoveChild(&window_); |
41 } | 45 } |
42 | 46 |
43 const Node* Node::GetParent() const { | 47 const Node* Node::GetParent() const { |
44 if (!window_.parent()) | 48 if (!window_.parent()) |
45 return NULL; | 49 return NULL; |
46 return window_.parent()->GetProperty(kNodeKey); | 50 return window_.parent()->GetProperty(kNodeKey); |
47 } | 51 } |
48 | 52 |
49 void Node::Add(Node* child) { | 53 void Node::Add(Node* child) { |
50 window_.AddChild(&child->window_); | 54 window_.AddChild(&child->window_); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bool Node::HasHitTestMask() const { | 168 bool Node::HasHitTestMask() const { |
165 return false; | 169 return false; |
166 } | 170 } |
167 | 171 |
168 void Node::GetHitTestMask(gfx::Path* mask) const { | 172 void Node::GetHitTestMask(gfx::Path* mask) const { |
169 } | 173 } |
170 | 174 |
171 } // namespace service | 175 } // namespace service |
172 } // namespace view_manager | 176 } // namespace view_manager |
173 } // namespace mojo | 177 } // namespace mojo |
OLD | NEW |