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

Side by Side Diff: mojo/services/public/cpp/view_manager/view_tree_node.h

Issue 287053004: SetBounds for ViewTreeNode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" 12 #include "mojo/services/public/cpp/view_manager/view_manager_types.h"
13 #include "ui/gfx/geometry/rect.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 namespace view_manager { 16 namespace view_manager {
16 17
17 class View; 18 class View;
18 class ViewManager; 19 class ViewManager;
19 class ViewTreeNodeObserver; 20 class ViewTreeNodeObserver;
20 21
21 // ViewTreeNodes are owned by the ViewManager. 22 // ViewTreeNodes are owned by the ViewManager.
22 // TODO(beng): Right now, you'll have to implement a ViewTreeNodeObserver to 23 // TODO(beng): Right now, you'll have to implement a ViewTreeNodeObserver to
23 // track destruction and NULL any pointers you have. 24 // track destruction and NULL any pointers you have.
24 // Investigate some kind of smart pointer or weak pointer for these. 25 // Investigate some kind of smart pointer or weak pointer for these.
25 class ViewTreeNode { 26 class ViewTreeNode {
26 public: 27 public:
27 typedef std::vector<ViewTreeNode*> Children; 28 typedef std::vector<ViewTreeNode*> Children;
28 29
29 static ViewTreeNode* Create(ViewManager* view_manager); 30 static ViewTreeNode* Create(ViewManager* view_manager);
30 31
31 // Destroys this node and all its children. 32 // Destroys this node and all its children.
32 void Destroy(); 33 void Destroy();
33 34
34 // Configuration. 35 // Configuration.
35 TransportNodeId id() const { return id_; } 36 TransportNodeId id() const { return id_; }
36 37
38 // Geometric disposition.
39 const gfx::Rect& bounds() { return bounds_; }
40 void SetBounds(const gfx::Rect& bounds);
41
37 // Observation. 42 // Observation.
38 void AddObserver(ViewTreeNodeObserver* observer); 43 void AddObserver(ViewTreeNodeObserver* observer);
39 void RemoveObserver(ViewTreeNodeObserver* observer); 44 void RemoveObserver(ViewTreeNodeObserver* observer);
40 45
41 // Tree. 46 // Tree.
42 ViewTreeNode* parent() { return parent_; } 47 ViewTreeNode* parent() { return parent_; }
43 const ViewTreeNode* parent() const { return parent_; } 48 const ViewTreeNode* parent() const { return parent_; }
44 const Children& children() const { return children_; } 49 const Children& children() const { return children_; }
45 50
46 void AddChild(ViewTreeNode* child); 51 void AddChild(ViewTreeNode* child);
(...skipping 14 matching lines...) Expand all
61 66
62 private: 67 private:
63 friend class ViewTreeNodePrivate; 68 friend class ViewTreeNodePrivate;
64 69
65 explicit ViewTreeNode(ViewManager* manager); 70 explicit ViewTreeNode(ViewManager* manager);
66 71
67 void LocalDestroy(); 72 void LocalDestroy();
68 void LocalAddChild(ViewTreeNode* child); 73 void LocalAddChild(ViewTreeNode* child);
69 void LocalRemoveChild(ViewTreeNode* child); 74 void LocalRemoveChild(ViewTreeNode* child);
70 void LocalSetActiveView(View* view); 75 void LocalSetActiveView(View* view);
76 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds);
71 77
72 ViewManager* manager_; 78 ViewManager* manager_;
73 TransportNodeId id_; 79 TransportNodeId id_;
74 ViewTreeNode* parent_; 80 ViewTreeNode* parent_;
75 Children children_; 81 Children children_;
76 82
77 ObserverList<ViewTreeNodeObserver> observers_; 83 ObserverList<ViewTreeNodeObserver> observers_;
78 84
85 gfx::Rect bounds_;
79 View* active_view_; 86 View* active_view_;
80 87
81 DISALLOW_COPY_AND_ASSIGN(ViewTreeNode); 88 DISALLOW_COPY_AND_ASSIGN(ViewTreeNode);
82 }; 89 };
83 90
84 } // namespace view_manager 91 } // namespace view_manager
85 } // namespace mojo 92 } // namespace mojo
86 93
87 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ 94 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698