Ignore title parameter for navigator.registerProtocolHandler
[chromium-blink-merge.git] / mojo / services / view_manager / node.h
blobd1b65ae24fa2b175296bdc3f266567cc878e7920
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.
5 #ifndef MOJO_SERVICES_VIEW_MANAGER_NODE_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_NODE_H_
8 #include <vector>
10 #include "base/logging.h"
11 #include "mojo/services/view_manager/ids.h"
12 #include "mojo/services/view_manager/view_manager_export.h"
13 #include "ui/aura/window.h"
14 #include "ui/aura/window_delegate.h"
15 #include "ui/aura/window_observer.h"
17 namespace mojo {
18 namespace services {
19 namespace view_manager {
21 class NodeDelegate;
22 class View;
24 // Represents a node in the graph. Delegate is informed of interesting events.
25 class MOJO_VIEW_MANAGER_EXPORT Node
26 : public aura::WindowObserver,
27 public aura::WindowDelegate {
28 public:
29 Node(NodeDelegate* delegate, const NodeId& id);
30 virtual ~Node();
32 void set_view_id(const ViewId& view_id) { view_id_ = view_id; }
33 const ViewId& view_id() const { return view_id_; }
35 const NodeId& id() const { return id_; }
37 void Add(Node* child);
38 void Remove(Node* child);
40 aura::Window* window() { return &window_; }
42 Node* GetParent();
44 std::vector<Node*> GetChildren();
46 // Sets the view associated with this node. Node does not own its View.
47 void SetView(View* view);
48 View* view() { return view_; }
50 private:
51 // WindowObserver overrides:
52 virtual void OnWindowHierarchyChanged(
53 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE;
55 // WindowDelegate overrides:
56 virtual gfx::Size GetMinimumSize() const OVERRIDE;
57 virtual gfx::Size GetMaximumSize() const OVERRIDE;
58 virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
59 const gfx::Rect& new_bounds) OVERRIDE;
60 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
61 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
62 virtual bool ShouldDescendIntoChildForEventHandling(
63 aura::Window* child,
64 const gfx::Point& location) OVERRIDE;
65 virtual bool CanFocus() OVERRIDE;
66 virtual void OnCaptureLost() OVERRIDE;
67 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
68 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
69 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
70 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
71 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE;
72 virtual bool HasHitTestMask() const OVERRIDE;
73 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE;
75 NodeDelegate* delegate_;
76 const NodeId id_;
78 // Weak pointer to view associated with this node.
79 View* view_;
81 ViewId view_id_;
83 aura::Window window_;
85 DISALLOW_COPY_AND_ASSIGN(Node);
88 } // namespace view_manager
89 } // namespace services
90 } // namespace mojo
92 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_