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_ROOT_WINDOW_HOST_MOJO_H_
6 #define MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_
9 #include "mojo/public/bindings/lib/remote_ptr.h"
10 #include "mojom/native_viewport.h"
11 #include "ui/aura/window_tree_host.h"
12 #include "ui/gfx/rect.h"
21 class GLES2ClientImpl;
23 class WindowTreeHostMojo : public aura::WindowTreeHost,
24 public NativeViewportClient {
26 WindowTreeHostMojo(ScopedMessagePipeHandle viewport_handle,
27 const gfx::Rect& bounds,
28 const base::Callback<void()>& compositor_created_callback);
29 virtual ~WindowTreeHostMojo();
31 GLES2ClientImpl* gles2_client() { return gles2_client_.get(); }
35 virtual aura::RootWindow* GetRootWindow() OVERRIDE;
36 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
37 virtual void Show() OVERRIDE;
38 virtual void Hide() OVERRIDE;
39 virtual void ToggleFullScreen() OVERRIDE;
40 virtual gfx::Rect GetBounds() const OVERRIDE;
41 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
42 virtual gfx::Insets GetInsets() const OVERRIDE;
43 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE;
44 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE;
45 virtual void SetCapture() OVERRIDE;
46 virtual void ReleaseCapture() OVERRIDE;
47 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE;
48 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE;
49 virtual bool ConfineCursorToRootWindow() OVERRIDE;
50 virtual void UnConfineCursor() OVERRIDE;
51 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE;
52 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE;
53 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
54 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
55 virtual void PrepareForShutdown() OVERRIDE;
57 // Overridden from NativeViewportClient:
58 virtual void OnCreated() OVERRIDE;
59 virtual void OnDestroyed() OVERRIDE;
60 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE;
61 virtual void OnEvent(const Event& event) OVERRIDE;
63 void DidCreateContext(gfx::Size size);
65 static ui::ContextFactory* context_factory_;
67 scoped_ptr<GLES2ClientImpl> gles2_client_;
68 RemotePtr<NativeViewport> native_viewport_;
69 base::Callback<void()> compositor_created_callback_;
73 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo);
76 } // namespace examples
79 #endif // MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_