OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_AURA_WINDOW_TREE_HOST_MOJO_H_ | 5 #ifndef MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ |
6 #define MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ | 6 #define MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h" |
9 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" | 10 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" |
10 #include "ui/aura/window_tree_host.h" | 11 #include "ui/aura/window_tree_host.h" |
11 #include "ui/events/event_source.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 service { | 20 namespace service { |
20 | 21 |
21 class ContextFactoryImpl; | 22 class ContextFactoryImpl; |
22 | 23 |
23 class WindowTreeHostImpl : public aura::WindowTreeHost, | 24 class WindowTreeHostImpl : public aura::WindowTreeHost, |
24 public ui::EventSource, | 25 public ui::EventSource, |
25 public NativeViewportClient { | 26 public NativeViewportClient { |
26 public: | 27 public: |
27 WindowTreeHostImpl( | 28 WindowTreeHostImpl(NativeViewportPtr viewport, |
28 NativeViewportPtr viewport, | 29 GpuPtr gpu_service, |
29 const gfx::Rect& bounds, | 30 const gfx::Rect& bounds, |
30 const Callback<void()>& compositor_created_callback, | 31 const Callback<void()>& compositor_created_callback, |
31 const Callback<void()>& native_viewport_closed_callback, | 32 const Callback<void()>& native_viewport_closed_callback, |
32 const Callback<void(EventPtr)>& event_received_callback); | 33 const Callback<void(EventPtr)>& event_received_callback); |
33 virtual ~WindowTreeHostImpl(); | 34 virtual ~WindowTreeHostImpl(); |
34 | 35 |
35 gfx::Rect bounds() const { return bounds_; } | 36 gfx::Rect bounds() const { return bounds_; } |
36 | 37 |
37 private: | 38 private: |
38 // WindowTreeHost: | 39 // WindowTreeHost: |
39 virtual ui::EventSource* GetEventSource() OVERRIDE; | 40 virtual ui::EventSource* GetEventSource() OVERRIDE; |
40 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 41 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
41 virtual void Show() OVERRIDE; | 42 virtual void Show() OVERRIDE; |
42 virtual void Hide() OVERRIDE; | 43 virtual void Hide() OVERRIDE; |
43 virtual gfx::Rect GetBounds() const OVERRIDE; | 44 virtual gfx::Rect GetBounds() const OVERRIDE; |
44 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 45 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
45 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 46 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
46 virtual void SetCapture() OVERRIDE; | 47 virtual void SetCapture() OVERRIDE; |
47 virtual void ReleaseCapture() OVERRIDE; | 48 virtual void ReleaseCapture() OVERRIDE; |
48 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 49 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
49 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; | 50 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; |
50 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; | 51 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; |
51 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; | 52 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; |
52 | 53 |
53 // ui::EventSource: | 54 // ui::EventSource: |
54 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 55 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
55 | 56 |
56 // Overridden from NativeViewportClient: | 57 // Overridden from NativeViewportClient: |
57 virtual void OnCreated() OVERRIDE; | 58 virtual void OnCreated(uint64_t native_viewport_id) OVERRIDE; |
58 virtual void OnDestroyed(const mojo::Callback<void()>& callback) OVERRIDE; | 59 virtual void OnDestroyed() OVERRIDE; |
59 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE; | 60 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE; |
60 virtual void OnEvent(EventPtr event, | 61 virtual void OnEvent(EventPtr event, |
61 const mojo::Callback<void()>& callback) OVERRIDE; | 62 const mojo::Callback<void()>& callback) OVERRIDE; |
62 | 63 |
63 static ContextFactoryImpl* context_factory_; | 64 static ContextFactoryImpl* context_factory_; |
64 | 65 |
65 NativeViewportPtr native_viewport_; | 66 NativeViewportPtr native_viewport_; |
| 67 GpuPtr gpu_service_; |
| 68 gfx::AcceleratedWidget widget_; |
66 Callback<void()> compositor_created_callback_; | 69 Callback<void()> compositor_created_callback_; |
67 Callback<void()> native_viewport_closed_callback_; | 70 Callback<void()> native_viewport_closed_callback_; |
68 Callback<void(EventPtr)> event_received_callback_; | 71 Callback<void(EventPtr)> event_received_callback_; |
69 | 72 |
70 gfx::Rect bounds_; | 73 gfx::Rect bounds_; |
71 | 74 |
72 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); | 75 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); |
73 }; | 76 }; |
74 | 77 |
75 } // namespace service | 78 } // namespace service |
76 } // namespace mojo | 79 } // namespace mojo |
77 | 80 |
78 #endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ | 81 #endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ |
OLD | NEW |