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.
5 #ifndef MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_
6 #define MOJO_AURA_WINDOW_TREE_HOST_MOJO_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"
22 class ContextFactoryImpl
;
24 class WindowTreeHostImpl
: public aura::WindowTreeHost
,
25 public ui::EventSource
,
26 public NativeViewportClient
{
28 WindowTreeHostImpl(NativeViewportPtr viewport
,
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();
36 gfx::Rect
bounds() const { return bounds_
; }
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
;
55 virtual ui::EventProcessor
* GetEventProcessor() OVERRIDE
;
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
;
64 static ContextFactoryImpl
* context_factory_
;
66 NativeViewportPtr native_viewport_
;
68 gfx::AcceleratedWidget widget_
;
69 Callback
<void()> compositor_created_callback_
;
70 Callback
<void()> native_viewport_closed_callback_
;
71 Callback
<void(EventPtr
)> event_received_callback_
;
75 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl
);
78 } // namespace service
81 #endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_