| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ | 5 #ifndef MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ |
| 6 #define MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ | 6 #define MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "mojo/public/bindings/lib/remote_ptr.h" | 9 #include "mojo/public/bindings/lib/remote_ptr.h" |
| 10 #include "mojom/native_viewport.h" | 10 #include "mojom/native_viewport.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class GLES2ClientImpl; | 21 class GLES2ClientImpl; |
| 22 | 22 |
| 23 class WindowTreeHostMojo : public aura::WindowTreeHost, | 23 class WindowTreeHostMojo : public aura::WindowTreeHost, |
| 24 public NativeViewportClient { | 24 public NativeViewportClient { |
| 25 public: | 25 public: |
| 26 WindowTreeHostMojo(ScopedMessagePipeHandle viewport_handle, | 26 WindowTreeHostMojo(ScopedMessagePipeHandle viewport_handle, |
| 27 const gfx::Rect& bounds, | 27 const gfx::Rect& bounds, |
| 28 const base::Callback<void()>& compositor_created_callback); | 28 const base::Callback<void()>& compositor_created_callback); |
| 29 virtual ~WindowTreeHostMojo(); | 29 virtual ~WindowTreeHostMojo(); |
| 30 | 30 |
| 31 gfx::Rect bounds() const { return bounds_; } |
| 31 GLES2ClientImpl* gles2_client() { return gles2_client_.get(); } | 32 GLES2ClientImpl* gles2_client() { return gles2_client_.get(); } |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 // WindowTreeHost: | 35 // WindowTreeHost: |
| 35 virtual aura::RootWindow* GetRootWindow() OVERRIDE; | 36 virtual aura::RootWindow* GetRootWindow() OVERRIDE; |
| 36 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 37 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| 37 virtual void Show() OVERRIDE; | 38 virtual void Show() OVERRIDE; |
| 38 virtual void Hide() OVERRIDE; | 39 virtual void Hide() OVERRIDE; |
| 39 virtual void ToggleFullScreen() OVERRIDE; | 40 virtual void ToggleFullScreen() OVERRIDE; |
| 40 virtual gfx::Rect GetBounds() const OVERRIDE; | 41 virtual gfx::Rect GetBounds() const OVERRIDE; |
| 41 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 42 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 42 virtual gfx::Insets GetInsets() const OVERRIDE; | 43 virtual gfx::Insets GetInsets() const OVERRIDE; |
| 43 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; | 44 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; |
| 44 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 45 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
| 45 virtual void SetCapture() OVERRIDE; | 46 virtual void SetCapture() OVERRIDE; |
| 46 virtual void ReleaseCapture() OVERRIDE; | 47 virtual void ReleaseCapture() OVERRIDE; |
| 47 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | 48 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
| 48 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; | 49 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; |
| 49 virtual bool ConfineCursorToRootWindow() OVERRIDE; | 50 virtual bool ConfineCursorToRootWindow() OVERRIDE; |
| 50 virtual void UnConfineCursor() OVERRIDE; | 51 virtual void UnConfineCursor() OVERRIDE; |
| 51 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; | 52 virtual void OnCursorVisibilityChanged(bool show) OVERRIDE; |
| 52 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; | 53 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
| 53 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 54 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
| 54 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 55 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
| 55 virtual void PrepareForShutdown() OVERRIDE; | 56 virtual void PrepareForShutdown() OVERRIDE; |
| 56 | 57 |
| 57 // Overridden from NativeViewportClient: | 58 // Overridden from NativeViewportClient: |
| 58 virtual void OnCreated() OVERRIDE; | 59 virtual void OnCreated() MOJO_OVERRIDE; |
| 59 virtual void OnDestroyed() OVERRIDE; | 60 virtual void OnDestroyed() OVERRIDE; |
| 60 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE; | 61 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE; |
| 61 virtual void OnEvent(const Event& event) OVERRIDE; | 62 virtual void OnEvent(const Event& event) OVERRIDE; |
| 62 | 63 |
| 63 void DidCreateContext(gfx::Size size); | 64 void DidCreateContext(); |
| 65 void CreateCompositorIfNeeded(); |
| 64 | 66 |
| 65 static ui::ContextFactory* context_factory_; | 67 static ui::ContextFactory* context_factory_; |
| 66 | 68 |
| 67 scoped_ptr<GLES2ClientImpl> gles2_client_; | 69 scoped_ptr<GLES2ClientImpl> gles2_client_; |
| 70 bool context_created_; |
| 68 RemotePtr<NativeViewport> native_viewport_; | 71 RemotePtr<NativeViewport> native_viewport_; |
| 69 base::Callback<void()> compositor_created_callback_; | 72 base::Callback<void()> compositor_created_callback_; |
| 70 | 73 |
| 71 gfx::Rect bounds_; | 74 gfx::Rect bounds_; |
| 72 | 75 |
| 73 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); | 76 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); |
| 74 }; | 77 }; |
| 75 | 78 |
| 76 } // namespace examples | 79 } // namespace examples |
| 77 } // namespace mojo | 80 } // namespace mojo |
| 78 | 81 |
| 79 #endif // MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ | 82 #endif // MOJO_EXAMPLES_AURA_DEMO_ROOT_WINDOW_HOST_MOJO_H_ |
| OLD | NEW |