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

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

Issue 327073003: Reorder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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
« no previous file with comments | « mojo/services/view_manager/node.h ('k') | mojo/services/view_manager/root_node_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void Node::Add(Node* child) { 53 void Node::Add(Node* child) {
54 window_.AddChild(&child->window_); 54 window_.AddChild(&child->window_);
55 } 55 }
56 56
57 void Node::Remove(Node* child) { 57 void Node::Remove(Node* child) {
58 window_.RemoveChild(&child->window_); 58 window_.RemoveChild(&child->window_);
59 } 59 }
60 60
61 void Node::Reorder(Node* child, Node* relative, OrderDirection direction) {
62 if (direction == ORDER_ABOVE)
63 window_.StackChildAbove(child->window(), relative->window());
64 else if (direction == ORDER_BELOW)
65 window_.StackChildBelow(child->window(), relative->window());
66 }
67
61 const Node* Node::GetRoot() const { 68 const Node* Node::GetRoot() const {
62 const aura::Window* window = &window_; 69 const aura::Window* window = &window_;
63 while (window && window->parent()) 70 while (window && window->parent())
64 window = window->parent(); 71 window = window->parent();
65 return window->GetProperty(kNodeKey); 72 return window->GetProperty(kNodeKey);
66 } 73 }
67 74
68 std::vector<const Node*> Node::GetChildren() const { 75 std::vector<const Node*> Node::GetChildren() const {
69 std::vector<const Node*> children; 76 std::vector<const Node*> children;
70 children.reserve(window_.children().size()); 77 children.reserve(window_.children().size());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 180 }
174 181
175 void Node::OnEvent(ui::Event* event) { 182 void Node::OnEvent(ui::Event* event) {
176 if (view_) 183 if (view_)
177 delegate_->OnViewInputEvent(view_, event); 184 delegate_->OnViewInputEvent(view_, event);
178 } 185 }
179 186
180 } // namespace service 187 } // namespace service
181 } // namespace view_manager 188 } // namespace view_manager
182 } // namespace mojo 189 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/node.h ('k') | mojo/services/view_manager/root_node_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698