| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SERVICES_NATIVE_VIEWPORT_IMPL_H_ | 5 #ifndef MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ |
| 6 #define MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ | 6 #define MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "mojo/services/gles2/command_buffer_impl.h" | |
| 10 #include "mojo/services/native_viewport/platform_viewport.h" | 9 #include "mojo/services/native_viewport/platform_viewport.h" |
| 11 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" | 10 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" |
| 12 | 11 |
| 13 namespace ui { | 12 namespace ui { |
| 14 class Event; | 13 class Event; |
| 15 } | 14 } |
| 16 | 15 |
| 17 namespace mojo { | 16 namespace mojo { |
| 18 | 17 |
| 19 class NativeViewportImpl : public InterfaceImpl<NativeViewport>, | 18 class NativeViewportImpl : public InterfaceImpl<NativeViewport>, |
| 20 public PlatformViewport::Delegate { | 19 public PlatformViewport::Delegate { |
| 21 public: | 20 public: |
| 22 NativeViewportImpl(); | 21 NativeViewportImpl(); |
| 23 virtual ~NativeViewportImpl(); | 22 virtual ~NativeViewportImpl(); |
| 24 | 23 |
| 25 // InterfaceImpl<NativeViewport> implementation. | 24 // InterfaceImpl<NativeViewport> implementation. |
| 26 virtual void Create(RectPtr bounds) OVERRIDE; | 25 virtual void Create(RectPtr bounds) OVERRIDE; |
| 27 virtual void Show() OVERRIDE; | 26 virtual void Show() OVERRIDE; |
| 28 virtual void Hide() OVERRIDE; | 27 virtual void Hide() OVERRIDE; |
| 29 virtual void Close() OVERRIDE; | 28 virtual void Close() OVERRIDE; |
| 30 virtual void SetBounds(RectPtr bounds) OVERRIDE; | 29 virtual void SetBounds(RectPtr bounds) OVERRIDE; |
| 31 virtual void CreateGLES2Context( | |
| 32 InterfaceRequest<CommandBuffer> command_buffer_request) OVERRIDE; | |
| 33 | 30 |
| 34 // PlatformViewport::Delegate implementation. | 31 // PlatformViewport::Delegate implementation. |
| 35 virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE; | 32 virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE; |
| 36 virtual void OnAcceleratedWidgetAvailable( | 33 virtual void OnAcceleratedWidgetAvailable( |
| 37 gfx::AcceleratedWidget widget) OVERRIDE; | 34 gfx::AcceleratedWidget widget) OVERRIDE; |
| 38 virtual bool OnEvent(ui::Event* ui_event) OVERRIDE; | 35 virtual bool OnEvent(ui::Event* ui_event) OVERRIDE; |
| 39 virtual void OnDestroyed() OVERRIDE; | 36 virtual void OnDestroyed() OVERRIDE; |
| 40 | 37 |
| 41 void AckEvent(); | 38 void AckEvent(); |
| 42 void CreateCommandBufferIfNeeded(); | |
| 43 | 39 |
| 44 private: | 40 private: |
| 45 void AckDestroyed(); | |
| 46 | 41 |
| 47 gfx::AcceleratedWidget widget_; | 42 gfx::AcceleratedWidget widget_; |
| 48 scoped_ptr<PlatformViewport> platform_viewport_; | 43 scoped_ptr<PlatformViewport> platform_viewport_; |
| 49 InterfaceRequest<CommandBuffer> command_buffer_request_; | |
| 50 scoped_ptr<CommandBufferImpl> command_buffer_; | |
| 51 bool waiting_for_event_ack_; | 44 bool waiting_for_event_ack_; |
| 52 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; | 45 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; |
| 53 }; | 46 }; |
| 54 | 47 |
| 55 } // namespace mojo | 48 } // namespace mojo |
| 56 | 49 |
| 57 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ | 50 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ |
| OLD | NEW |