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