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/native_viewport/native_viewport.mojom.
h" | 9 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
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/rect.h" | 12 #include "ui/gfx/rect.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 class ContextFactory; | 15 class ContextFactory; |
16 } | 16 } |
17 | 17 |
18 namespace mojo { | 18 namespace mojo { |
19 namespace view_manager { | 19 namespace view_manager { |
20 namespace service { | 20 namespace service { |
21 | 21 |
22 class ContextFactoryImpl; | 22 class ContextFactoryImpl; |
23 | 23 |
24 class WindowTreeHostImpl : public aura::WindowTreeHost, | 24 class WindowTreeHostImpl : public aura::WindowTreeHost, |
25 public ui::EventSource, | 25 public ui::EventSource, |
26 public NativeViewportClient { | 26 public NativeViewportClient { |
27 public: | 27 public: |
28 WindowTreeHostImpl(NativeViewportPtr viewport, | 28 WindowTreeHostImpl( |
29 const gfx::Rect& bounds, | 29 NativeViewportPtr viewport, |
30 const base::Callback<void()>& compositor_created_callback); | 30 const gfx::Rect& bounds, |
| 31 const Callback<void()>& compositor_created_callback, |
| 32 const Callback<void()>& native_viewport_closed_callback); |
31 virtual ~WindowTreeHostImpl(); | 33 virtual ~WindowTreeHostImpl(); |
32 | 34 |
33 gfx::Rect bounds() const { return bounds_; } | 35 gfx::Rect bounds() const { return bounds_; } |
34 | 36 |
35 private: | 37 private: |
36 // WindowTreeHost: | 38 // WindowTreeHost: |
37 virtual ui::EventSource* GetEventSource() OVERRIDE; | 39 virtual ui::EventSource* GetEventSource() OVERRIDE; |
38 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 40 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
39 virtual void Show() OVERRIDE; | 41 virtual void Show() OVERRIDE; |
40 virtual void Hide() OVERRIDE; | 42 virtual void Hide() OVERRIDE; |
41 virtual gfx::Rect GetBounds() const OVERRIDE; | 43 virtual gfx::Rect GetBounds() const OVERRIDE; |
42 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 44 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
43 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 45 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
44 virtual void SetCapture() OVERRIDE; | 46 virtual void SetCapture() OVERRIDE; |
45 virtual void ReleaseCapture() OVERRIDE; | 47 virtual void ReleaseCapture() OVERRIDE; |
46 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 48 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
47 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 49 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
48 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; | 50 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; |
49 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; | 51 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; |
50 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; | 52 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; |
51 | 53 |
52 // ui::EventSource: | 54 // ui::EventSource: |
53 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 55 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
54 | 56 |
55 // Overridden from NativeViewportClient: | 57 // Overridden from NativeViewportClient: |
56 virtual void OnCreated() OVERRIDE; | 58 virtual void OnCreated() OVERRIDE; |
57 virtual void OnDestroyed() OVERRIDE; | 59 virtual void OnDestroyed(const mojo::Callback<void()>& callback) OVERRIDE; |
58 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE; | 60 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE; |
59 virtual void OnEvent(EventPtr event, | 61 virtual void OnEvent(EventPtr event, |
60 const mojo::Callback<void()>& callback) OVERRIDE; | 62 const mojo::Callback<void()>& callback) OVERRIDE; |
61 | 63 |
62 static ContextFactoryImpl* context_factory_; | 64 static ContextFactoryImpl* context_factory_; |
63 | 65 |
64 NativeViewportPtr native_viewport_; | 66 NativeViewportPtr native_viewport_; |
65 base::Callback<void()> compositor_created_callback_; | 67 Callback<void()> compositor_created_callback_; |
| 68 Callback<void()> native_viewport_closed_callback_; |
66 | 69 |
67 gfx::Rect bounds_; | 70 gfx::Rect bounds_; |
68 | 71 |
69 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); | 72 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); |
70 }; | 73 }; |
71 | 74 |
72 } // namespace service | 75 } // namespace service |
73 } // namespace view_manager | 76 } // namespace view_manager |
74 } // namespace mojo | 77 } // namespace mojo |
75 | 78 |
76 #endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ | 79 #endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ |
OLD | NEW |