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