Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / mojo / examples / aura_demo / root_window_host_mojo.h
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_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_
6 #define MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_
7
8 #include "base/bind.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"
13
14 namespace ui {
15 class ContextFactory;
16 }
17
18 namespace mojo {
19 namespace examples {
20
21 class GLES2ClientImpl;
22
23 class WindowTreeHostMojo : public aura::WindowTreeHost,
24                            public NativeViewportClient {
25  public:
26   WindowTreeHostMojo(ScopedMessagePipeHandle viewport_handle,
27                      const gfx::Rect& bounds,
28                      const base::Callback<void()>& compositor_created_callback);
29   virtual ~WindowTreeHostMojo();
30
31   GLES2ClientImpl* gles2_client() { return gles2_client_.get(); }
32
33  private:
34   // WindowTreeHost:
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;
56
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;
62
63   void DidCreateContext(gfx::Size size);
64
65   static ui::ContextFactory* context_factory_;
66
67   scoped_ptr<GLES2ClientImpl> gles2_client_;
68   RemotePtr<NativeViewport> native_viewport_;
69   base::Callback<void()> compositor_created_callback_;
70
71   gfx::Rect bounds_;
72
73   DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo);
74 };
75
76 }  // namespace examples
77 }  // namespace mojo
78
79 #endif  // MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_