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