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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 9 #include "mojo/services/public/cpp/view_manager/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 | 21 |
22 class Shell; | 22 class Shell; |
23 class SurfaceContextFactory; | 23 class SurfaceContextFactory; |
24 | 24 |
25 class WindowTreeHostMojo : public aura::WindowTreeHost, | 25 class WindowTreeHostMojo : public aura::WindowTreeHost, |
26 public ui::EventSource, | 26 public ui::EventSource, |
27 public ViewObserver { | 27 public ViewObserver { |
28 public: | 28 public: |
29 WindowTreeHostMojo(Shell* shell, View* view); | 29 WindowTreeHostMojo(Shell* shell, View* view); |
30 virtual ~WindowTreeHostMojo(); | 30 ~WindowTreeHostMojo() override; |
31 | 31 |
32 const gfx::Rect& bounds() const { return bounds_; } | 32 const gfx::Rect& bounds() const { return bounds_; } |
33 | 33 |
34 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) { | 34 ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) { |
35 return ui::EventSource::SendEventToProcessor(event); | 35 return ui::EventSource::SendEventToProcessor(event); |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 // WindowTreeHost: | 39 // WindowTreeHost: |
40 virtual ui::EventSource* GetEventSource() override; | 40 ui::EventSource* GetEventSource() override; |
41 virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; | 41 gfx::AcceleratedWidget GetAcceleratedWidget() override; |
42 virtual void Show() override; | 42 void Show() override; |
43 virtual void Hide() override; | 43 void Hide() override; |
44 virtual gfx::Rect GetBounds() const override; | 44 gfx::Rect GetBounds() const override; |
45 virtual void SetBounds(const gfx::Rect& bounds) override; | 45 void SetBounds(const gfx::Rect& bounds) override; |
46 virtual gfx::Point GetLocationOnNativeScreen() const override; | 46 gfx::Point GetLocationOnNativeScreen() const override; |
47 virtual void SetCapture() override; | 47 void SetCapture() override; |
48 virtual void ReleaseCapture() override; | 48 void ReleaseCapture() override; |
49 virtual void PostNativeEvent(const base::NativeEvent& native_event) override; | 49 void PostNativeEvent(const base::NativeEvent& native_event) override; |
50 virtual void SetCursorNative(gfx::NativeCursor cursor) override; | 50 void SetCursorNative(gfx::NativeCursor cursor) override; |
51 virtual void MoveCursorToNative(const gfx::Point& location) override; | 51 void MoveCursorToNative(const gfx::Point& location) override; |
52 virtual void OnCursorVisibilityChangedNative(bool show) override; | 52 void OnCursorVisibilityChangedNative(bool show) override; |
53 | 53 |
54 // ui::EventSource: | 54 // ui::EventSource: |
55 virtual ui::EventProcessor* GetEventProcessor() override; | 55 ui::EventProcessor* GetEventProcessor() override; |
56 | 56 |
57 // ViewObserver: | 57 // ViewObserver: |
58 virtual void OnViewBoundsChanged(View* view, | 58 void OnViewBoundsChanged(View* view, |
59 const gfx::Rect& old_bounds, | 59 const gfx::Rect& old_bounds, |
60 const gfx::Rect& new_bounds) override; | 60 const gfx::Rect& new_bounds) override; |
61 | 61 |
62 View* view_; | 62 View* view_; |
63 | 63 |
64 gfx::Rect bounds_; | 64 gfx::Rect bounds_; |
65 | 65 |
66 scoped_ptr<SurfaceContextFactory> context_factory_; | 66 scoped_ptr<SurfaceContextFactory> context_factory_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); | 68 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace mojo | 71 } // namespace mojo |
72 | 72 |
73 #endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ | 73 #endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_ |
OLD | NEW |