OLD | NEW |
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_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ | 5 #ifndef MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ |
6 #define MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ | 6 #define MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ |
7 | 7 |
8 #include "mojo/services/public/cpp/view_manager/node_observer.h" | 8 #include "mojo/services/public/cpp/view_manager/node_observer.h" |
9 #include "ui/aura/window_tree_host.h" | 9 #include "ui/aura/window_tree_host.h" |
10 #include "ui/events/event_source.h" | 10 #include "ui/events/event_source.h" |
11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
12 | 12 |
13 class SkBitmap; | 13 class SkBitmap; |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 class Compositor; | 16 class Compositor; |
17 } | 17 } |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 | 20 |
21 class WindowTreeHostMojoDelegate; | 21 class WindowTreeHostMojoDelegate; |
22 | 22 |
23 class WindowTreeHostMojo : public aura::WindowTreeHost, | 23 class WindowTreeHostMojo : public aura::WindowTreeHost, |
24 public ui::EventSource, | 24 public ui::EventSource, |
25 public view_manager::NodeObserver { | 25 public NodeObserver { |
26 public: | 26 public: |
27 WindowTreeHostMojo(view_manager::Node* node, | 27 WindowTreeHostMojo(Node* node, WindowTreeHostMojoDelegate* delegate); |
28 WindowTreeHostMojoDelegate* delegate); | |
29 virtual ~WindowTreeHostMojo(); | 28 virtual ~WindowTreeHostMojo(); |
30 | 29 |
31 // Returns the WindowTreeHostMojo for the specified compositor. | 30 // Returns the WindowTreeHostMojo for the specified compositor. |
32 static WindowTreeHostMojo* ForCompositor(ui::Compositor* compositor); | 31 static WindowTreeHostMojo* ForCompositor(ui::Compositor* compositor); |
33 | 32 |
34 const gfx::Rect& bounds() const { return bounds_; } | 33 const gfx::Rect& bounds() const { return bounds_; } |
35 | 34 |
36 // Sets the contents to show in this WindowTreeHost. This forwards to the | 35 // Sets the contents to show in this WindowTreeHost. This forwards to the |
37 // delegate. | 36 // delegate. |
38 void SetContents(const SkBitmap& contents); | 37 void SetContents(const SkBitmap& contents); |
(...skipping 14 matching lines...) Expand all Loading... |
53 virtual void SetCapture() OVERRIDE; | 52 virtual void SetCapture() OVERRIDE; |
54 virtual void ReleaseCapture() OVERRIDE; | 53 virtual void ReleaseCapture() OVERRIDE; |
55 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 54 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
56 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; | 55 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; |
57 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; | 56 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; |
58 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; | 57 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; |
59 | 58 |
60 // ui::EventSource: | 59 // ui::EventSource: |
61 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 60 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
62 | 61 |
63 // view_manager::NodeObserver: | 62 // NodeObserver: |
64 virtual void OnNodeBoundsChanged( | 63 virtual void OnNodeBoundsChanged( |
65 view_manager::Node* node, | 64 Node* node, |
66 const gfx::Rect& old_bounds, | 65 const gfx::Rect& old_bounds, |
67 const gfx::Rect& new_bounds) OVERRIDE; | 66 const gfx::Rect& new_bounds) OVERRIDE; |
68 | 67 |
69 view_manager::Node* node_; | 68 Node* node_; |
70 | 69 |
71 gfx::Rect bounds_; | 70 gfx::Rect bounds_; |
72 | 71 |
73 WindowTreeHostMojoDelegate* delegate_; | 72 WindowTreeHostMojoDelegate* delegate_; |
74 | 73 |
75 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); | 74 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); |
76 }; | 75 }; |
77 | 76 |
78 } // namespace mojo | 77 } // namespace mojo |
79 | 78 |
80 #endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ | 79 #endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ |
OLD | NEW |