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