OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_ROOT_WINDOW_HOST_MOJO_H_ | 5 #ifndef MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ |
6 #define MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ | 6 #define MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "mojo/public/bindings/remote_ptr.h" | 9 #include "mojo/public/bindings/remote_ptr.h" |
10 #include "mojom/native_viewport.h" | 10 #include "mojom/native_viewport.h" |
11 #include "ui/aura/window_tree_host.h" | 11 #include "ui/aura/window_tree_host.h" |
| 12 #include "ui/events/event_source.h" |
12 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 class ContextFactory; | 16 class ContextFactory; |
16 } | 17 } |
17 | 18 |
18 namespace mojo { | 19 namespace mojo { |
19 namespace examples { | 20 namespace examples { |
20 | 21 |
21 class GLES2ClientImpl; | 22 class GLES2ClientImpl; |
22 | 23 |
23 class WindowTreeHostMojo : public aura::WindowTreeHost, | 24 class WindowTreeHostMojo : public aura::WindowTreeHost, |
| 25 public ui::EventSource, |
24 public NativeViewportClient { | 26 public NativeViewportClient { |
25 public: | 27 public: |
26 WindowTreeHostMojo(ScopedMessagePipeHandle viewport_handle, | 28 WindowTreeHostMojo(ScopedMessagePipeHandle viewport_handle, |
27 const gfx::Rect& bounds, | 29 const gfx::Rect& bounds, |
28 const base::Callback<void()>& compositor_created_callback); | 30 const base::Callback<void()>& compositor_created_callback); |
29 virtual ~WindowTreeHostMojo(); | 31 virtual ~WindowTreeHostMojo(); |
30 | 32 |
31 gfx::Rect bounds() const { return bounds_; } | 33 gfx::Rect bounds() const { return bounds_; } |
32 GLES2ClientImpl* gles2_client() { return gles2_client_.get(); } | 34 GLES2ClientImpl* gles2_client() { return gles2_client_.get(); } |
33 | 35 |
(...skipping 14 matching lines...) Expand all Loading... |
48 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | 50 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
49 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; | 51 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; |
50 virtual bool ConfineCursorToRootWindow() OVERRIDE; | 52 virtual bool ConfineCursorToRootWindow() OVERRIDE; |
51 virtual void UnConfineCursor() OVERRIDE; | 53 virtual void UnConfineCursor() OVERRIDE; |
52 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; | 54 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; |
53 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; | 55 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
54 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 56 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
55 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 57 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
56 virtual void PrepareForShutdown() OVERRIDE; | 58 virtual void PrepareForShutdown() OVERRIDE; |
57 | 59 |
| 60 // ui::EventSource: |
| 61 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
| 62 |
58 // Overridden from NativeViewportClient: | 63 // Overridden from NativeViewportClient: |
59 virtual void OnCreated() MOJO_OVERRIDE; | 64 virtual void OnCreated() MOJO_OVERRIDE; |
60 virtual void OnDestroyed() OVERRIDE; | 65 virtual void OnDestroyed() OVERRIDE; |
61 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE; | 66 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE; |
62 virtual void OnEvent(const Event& event) OVERRIDE; | 67 virtual void OnEvent(const Event& event) OVERRIDE; |
63 | 68 |
64 void DidCreateContext(); | 69 void DidCreateContext(); |
65 void CreateCompositorIfNeeded(); | 70 void CreateCompositorIfNeeded(); |
66 | 71 |
67 static ui::ContextFactory* context_factory_; | 72 static ui::ContextFactory* context_factory_; |
68 | 73 |
69 scoped_ptr<GLES2ClientImpl> gles2_client_; | 74 scoped_ptr<GLES2ClientImpl> gles2_client_; |
70 bool context_created_; | 75 bool context_created_; |
71 RemotePtr<NativeViewport> native_viewport_; | 76 RemotePtr<NativeViewport> native_viewport_; |
72 base::Callback<void()> compositor_created_callback_; | 77 base::Callback<void()> compositor_created_callback_; |
73 | 78 |
74 gfx::Rect bounds_; | 79 gfx::Rect bounds_; |
75 | 80 |
76 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); | 81 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); |
77 }; | 82 }; |
78 | 83 |
79 } // namespace examples | 84 } // namespace examples |
80 } // namespace mojo | 85 } // namespace mojo |
81 | 86 |
82 #endif // MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ | 87 #endif // MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ |
OLD | NEW |