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

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

Issue 513923004: More viewmanager renaming: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sim30 Created 6 years, 3 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
« no previous file with comments | « mojo/services/view_manager/ids.h ('k') | mojo/services/view_manager/node.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_SERVICES_VIEW_MANAGER_NODE_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_NODE_H_
7
8 #include <vector>
9
10 #include "base/logging.h"
11 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
12 #include "mojo/services/view_manager/ids.h"
13 #include "mojo/services/view_manager/view_manager_export.h"
14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/gfx/geometry/rect.h"
16
17 namespace mojo {
18 namespace service {
19
20 class NodeDelegate;
21
22 // Represents a node in the graph. Delegate is informed of interesting events.
23 //
24 // It is assumed that all functions that mutate the node tree have validated the
25 // value. For example, Reorder() assumes the supplied node is a child and not
26 // already in position.
27 class MOJO_VIEW_MANAGER_EXPORT Node {
28 public:
29 Node(NodeDelegate* delegate, const NodeId& id);
30 virtual ~Node();
31
32 const NodeId& id() const { return id_; }
33
34 void Add(Node* child);
35 void Remove(Node* child);
36 void Reorder(Node* child, Node* relative, OrderDirection direction);
37
38 const gfx::Rect& bounds() const { return bounds_; }
39 void SetBounds(const gfx::Rect& bounds);
40
41 const Node* parent() const { return parent_; }
42 Node* parent() { return parent_; }
43
44 const Node* GetRoot() const;
45 Node* GetRoot() {
46 return const_cast<Node*>(const_cast<const Node*>(this)->GetRoot());
47 }
48
49 std::vector<const Node*> GetChildren() const;
50 std::vector<Node*> GetChildren();
51
52 bool Contains(const Node* node) const;
53
54 // Returns true if the window is visible. This does not consider visibility
55 // of any ancestors.
56 bool visible() const { return visible_; }
57 void SetVisible(bool value);
58
59 void SetBitmap(const SkBitmap& contents);
60 const SkBitmap& bitmap() const { return bitmap_; }
61
62 private:
63 typedef std::vector<Node*> Nodes;
64
65 // Implementation of removing a node. Doesn't send any notification.
66 void RemoveImpl(Node* node);
67
68 NodeDelegate* delegate_;
69 const NodeId id_;
70 Node* parent_;
71 Nodes children_;
72 bool visible_;
73 gfx::Rect bounds_;
74 SkBitmap bitmap_;
75
76 DISALLOW_COPY_AND_ASSIGN(Node);
77 };
78
79 } // namespace service
80 } // namespace mojo
81
82 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/ids.h ('k') | mojo/services/view_manager/node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698