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

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

Issue 250633003: Adds more to viewmanager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: override Created 6 years, 8 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/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
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_VIEW_MANAGER_NODE_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_NODE_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_NODE_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_NODE_H_
7 7
8 #include <vector>
9
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "mojo/services/view_manager/ids.h" 11 #include "mojo/services/view_manager/ids.h"
10 #include "mojo/services/view_manager/view_manager_export.h" 12 #include "mojo/services/view_manager/view_manager_export.h"
11 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
12 #include "ui/aura/window_observer.h" 14 #include "ui/aura/window_observer.h"
13 15
14 namespace mojo { 16 namespace mojo {
15 namespace services { 17 namespace services {
16 namespace view_manager { 18 namespace view_manager {
17 19
18 class NodeDelegate; 20 class NodeDelegate;
21 class View;
19 22
20 // Represents a node in the graph. Delegate is informed of interesting events. 23 // Represents a node in the graph. Delegate is informed of interesting events.
21 class MOJO_VIEW_MANAGER_EXPORT Node : public aura::WindowObserver { 24 class MOJO_VIEW_MANAGER_EXPORT Node : public aura::WindowObserver {
22 public: 25 public:
23 Node(NodeDelegate* delegate, const NodeId& id); 26 Node(NodeDelegate* delegate, const NodeId& id);
24 virtual ~Node(); 27 virtual ~Node();
25 28
26 void set_view_id(const ViewId& view_id) { view_id_ = view_id; } 29 void set_view_id(const ViewId& view_id) { view_id_ = view_id; }
27 const ViewId& view_id() const { return view_id_; } 30 const ViewId& view_id() const { return view_id_; }
28 31
29 const NodeId& id() const { return id_; } 32 const NodeId& id() const { return id_; }
30 33
31 void Add(Node* child); 34 void Add(Node* child);
32 void Remove(Node* child); 35 void Remove(Node* child);
33 36
34 Node* GetParent(); 37 Node* GetParent();
35 38
39 std::vector<Node*> GetChildren();
40
41 // Sets the view associated with this node. Node does not own its View.
42 void SetView(View* view);
43 View* view() { return view_; }
44
36 private: 45 private:
37 // WindowObserver overrides: 46 // WindowObserver overrides:
38 virtual void OnWindowHierarchyChanged( 47 virtual void OnWindowHierarchyChanged(
39 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE; 48 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE;
40 49
41 NodeDelegate* delegate_; 50 NodeDelegate* delegate_;
42 const NodeId id_; 51 const NodeId id_;
52
53 // Weak pointer to view associated with this node.
54 View* view_;
55
43 ViewId view_id_; 56 ViewId view_id_;
57
44 aura::Window window_; 58 aura::Window window_;
45 59
46 DISALLOW_COPY_AND_ASSIGN(Node); 60 DISALLOW_COPY_AND_ASSIGN(Node);
47 }; 61 };
48 62
49 } // namespace view_manager 63 } // namespace view_manager
50 } // namespace services 64 } // namespace services
51 } // namespace mojo 65 } // namespace mojo
52 66
53 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ 67 #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