blob: ed6887428bd19939deb88fdc39f90e6fcb71dab2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_SERVICES_VIEW_MANAGER_NODE_H_
#define MOJO_SERVICES_VIEW_MANAGER_NODE_H_
#include <vector>
#include "base/logging.h"
#include "mojo/services/view_manager/ids.h"
#include "mojo/services/view_manager/view_manager_export.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
namespace mojo {
namespace services {
namespace view_manager {
class NodeDelegate;
class View;
// Represents a node in the graph. Delegate is informed of interesting events.
class MOJO_VIEW_MANAGER_EXPORT Node : public aura::WindowObserver {
public:
Node(NodeDelegate* delegate, const NodeId& id);
virtual ~Node();
void set_view_id(const ViewId& view_id) { view_id_ = view_id; }
const ViewId& view_id() const { return view_id_; }
const NodeId& id() const { return id_; }
void Add(Node* child);
void Remove(Node* child);
Node* GetParent();
std::vector<Node*> GetChildren();
// Sets the view associated with this node. Node does not own its View.
void SetView(View* view);
View* view() { return view_; }
private:
// WindowObserver overrides:
virtual void OnWindowHierarchyChanged(
const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE;
NodeDelegate* delegate_;
const NodeId id_;
// Weak pointer to view associated with this node.
View* view_;
ViewId view_id_;
aura::Window window_;
DISALLOW_COPY_AND_ASSIGN(Node);
};
} // namespace view_manager
} // namespace services
} // namespace mojo
#endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_
|