OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_ | 5 #ifndef MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_ |
6 #define MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_ | 6 #define MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/view_manager/public/cpp/view_observer.h" | 9 #include "components/view_manager/public/cpp/view_observer.h" |
10 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
11 #include "ui/events/event_source.h" | 11 #include "ui/events/event_source.h" |
12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
13 | 13 |
14 class SkBitmap; | 14 class SkBitmap; |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 class Compositor; | 17 class Compositor; |
18 } | 18 } |
19 | 19 |
20 namespace mojo { | 20 namespace mojo { |
21 class Shell; | 21 class Shell; |
22 } | 22 } |
23 | 23 |
24 namespace mandoline { | 24 namespace mandoline { |
25 | 25 |
26 class SurfaceContextFactory; | 26 class SurfaceContextFactory; |
27 | 27 |
28 class WindowTreeHostMojo : public aura::WindowTreeHost, | 28 class WindowTreeHostMojo : public aura::WindowTreeHost, |
29 public ui::EventSource, | |
30 public mojo::ViewObserver { | 29 public mojo::ViewObserver { |
31 public: | 30 public: |
32 WindowTreeHostMojo(mojo::Shell* shell, mojo::View* view); | 31 WindowTreeHostMojo(mojo::Shell* shell, mojo::View* view); |
33 ~WindowTreeHostMojo() override; | 32 ~WindowTreeHostMojo() override; |
34 | 33 |
35 const gfx::Rect& bounds() const { return bounds_; } | 34 const gfx::Rect& bounds() const { return bounds_; } |
36 | 35 |
37 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) { | 36 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) { |
38 return ui::EventSource::SendEventToProcessor(event); | 37 return ui::EventSource::SendEventToProcessor(event); |
39 } | 38 } |
40 | 39 |
41 private: | 40 private: |
42 // WindowTreeHost: | 41 // WindowTreeHost: |
43 ui::EventSource* GetEventSource() override; | 42 ui::EventSource* GetEventSource() override; |
44 gfx::AcceleratedWidget GetAcceleratedWidget() override; | 43 gfx::AcceleratedWidget GetAcceleratedWidget() override; |
45 void ShowImpl() override; | 44 void ShowImpl() override; |
46 void HideImpl() override; | 45 void HideImpl() override; |
47 gfx::Rect GetBounds() const override; | 46 gfx::Rect GetBounds() const override; |
48 void SetBounds(const gfx::Rect& bounds) override; | 47 void SetBounds(const gfx::Rect& bounds) override; |
49 gfx::Point GetLocationOnNativeScreen() const override; | 48 gfx::Point GetLocationOnNativeScreen() const override; |
50 void SetCapture() override; | 49 void SetCapture() override; |
51 void ReleaseCapture() override; | 50 void ReleaseCapture() override; |
52 void SetCursorNative(gfx::NativeCursor cursor) override; | 51 void SetCursorNative(gfx::NativeCursor cursor) override; |
53 void MoveCursorToNative(const gfx::Point& location) override; | 52 void MoveCursorToNative(const gfx::Point& location) override; |
54 void OnCursorVisibilityChangedNative(bool show) override; | 53 void OnCursorVisibilityChangedNative(bool show) override; |
55 | 54 |
56 // ui::EventSource: | |
57 ui::EventProcessor* GetEventProcessor() override; | |
58 | |
59 // mojo::ViewObserver: | 55 // mojo::ViewObserver: |
60 void OnViewBoundsChanged(mojo::View* view, | 56 void OnViewBoundsChanged(mojo::View* view, |
61 const mojo::Rect& old_bounds, | 57 const mojo::Rect& old_bounds, |
62 const mojo::Rect& new_bounds) override; | 58 const mojo::Rect& new_bounds) override; |
63 | 59 |
64 mojo::View* view_; | 60 mojo::View* view_; |
65 | 61 |
66 gfx::Rect bounds_; | 62 gfx::Rect bounds_; |
67 | 63 |
68 scoped_ptr<SurfaceContextFactory> context_factory_; | 64 scoped_ptr<SurfaceContextFactory> context_factory_; |
69 | 65 |
70 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); | 66 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); |
71 }; | 67 }; |
72 | 68 |
73 } // namespace mandoline | 69 } // namespace mandoline |
74 | 70 |
75 #endif // MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_ | 71 #endif // MANDOLINE_UI_AURA_WINDOW_TREE_HOST_MOJO_H_ |
OLD | NEW |