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.
5 #ifndef MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_MOJO_H_
6 #define MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_MOJO_H_
9 #include "mojo/public/bindings/remote_ptr.h"
10 #include "mojom/native_viewport.h"
11 #include "ui/aura/window_tree_host.h"
12 #include "ui/events/event_source.h"
13 #include "ui/gfx/rect.h"
22 class WindowTreeHostMojo : public aura::WindowTreeHost,
23 public ui::EventSource,
24 public NativeViewportClient {
26 WindowTreeHostMojo(ScopedNativeViewportHandle viewport_handle,
27 const gfx::Rect& bounds,
28 const base::Callback<void()>& compositor_created_callback);
29 virtual ~WindowTreeHostMojo();
31 gfx::Rect bounds() const { return bounds_; }
32 ScopedMessagePipeHandle TakeGLES2PipeHandle() { return gles2_handle_.Pass(); }
36 virtual aura::RootWindow* GetRootWindow() OVERRIDE;
37 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
38 virtual void Show() OVERRIDE;
39 virtual void Hide() OVERRIDE;
40 virtual void ToggleFullScreen() OVERRIDE;
41 virtual gfx::Rect GetBounds() const OVERRIDE;
42 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
43 virtual gfx::Insets GetInsets() const OVERRIDE;
44 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE;
45 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE;
46 virtual void SetCapture() OVERRIDE;
47 virtual void ReleaseCapture() OVERRIDE;
48 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE;
49 virtual bool ConfineCursorToRootWindow() OVERRIDE;
50 virtual void UnConfineCursor() OVERRIDE;
51 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
52 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
53 virtual void PrepareForShutdown() OVERRIDE;
54 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE;
55 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE;
56 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE;
59 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE;
61 // Overridden from NativeViewportClient:
62 virtual void OnCreated() MOJO_OVERRIDE;
63 virtual void OnDestroyed() OVERRIDE;
64 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE;
65 virtual void OnEvent(const Event& event) OVERRIDE;
67 static ui::ContextFactory* context_factory_;
69 ScopedMessagePipeHandle gles2_handle_;
70 RemotePtr<NativeViewport> native_viewport_;
71 base::Callback<void()> compositor_created_callback_;
75 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo);
78 } // namespace examples
81 #endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_MOJO_H_