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 "cc/surfaces/surface_id_allocator.h" | |
9 #include "mojo/services/native_viewport/platform_viewport.h" | 10 #include "mojo/services/native_viewport/platform_viewport.h" |
11 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h" | |
10 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom. h" | 12 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom. h" |
13 #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" | |
14 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" | |
15 #include "ui/gfx/geometry/rect.h" | |
11 | 16 |
12 namespace ui { | 17 namespace ui { |
13 class Event; | 18 class Event; |
14 } | 19 } |
15 | 20 |
16 namespace mojo { | 21 namespace mojo { |
17 | 22 |
18 class NativeViewportImpl : public InterfaceImpl<NativeViewport>, | 23 class NativeViewportImpl : public InterfaceImpl<NativeViewport>, |
19 public PlatformViewport::Delegate { | 24 public PlatformViewport::Delegate, |
25 public SurfaceClient { | |
20 public: | 26 public: |
21 NativeViewportImpl(); | 27 NativeViewportImpl(SurfacesServicePtr surfaces_service, GpuPtr gpu_service); |
22 virtual ~NativeViewportImpl(); | 28 virtual ~NativeViewportImpl(); |
23 | 29 |
24 // InterfaceImpl<NativeViewport> implementation. | 30 // InterfaceImpl<NativeViewport> implementation. |
25 virtual void Create(RectPtr bounds) OVERRIDE; | 31 virtual void Create(RectPtr bounds) OVERRIDE; |
26 virtual void Show() OVERRIDE; | 32 virtual void Show() OVERRIDE; |
27 virtual void Hide() OVERRIDE; | 33 virtual void Hide() OVERRIDE; |
28 virtual void Close() OVERRIDE; | 34 virtual void Close() OVERRIDE; |
29 virtual void SetBounds(RectPtr bounds) OVERRIDE; | 35 virtual void SetBounds(RectPtr bounds) OVERRIDE; |
36 virtual void SubmittedFrame(SurfaceIdPtr surface_id) OVERRIDE; | |
30 | 37 |
31 // PlatformViewport::Delegate implementation. | 38 // PlatformViewport::Delegate implementation. |
32 virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE; | 39 virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE; |
33 virtual void OnAcceleratedWidgetAvailable( | 40 virtual void OnAcceleratedWidgetAvailable( |
34 gfx::AcceleratedWidget widget) OVERRIDE; | 41 gfx::AcceleratedWidget widget) OVERRIDE; |
35 virtual bool OnEvent(ui::Event* ui_event) OVERRIDE; | 42 virtual bool OnEvent(ui::Event* ui_event) OVERRIDE; |
36 virtual void OnDestroyed() OVERRIDE; | 43 virtual void OnDestroyed() OVERRIDE; |
37 | 44 |
38 void AckEvent(); | 45 void AckEvent(); |
39 | 46 |
40 private: | 47 private: |
48 // SurfaceClient implementation. | |
49 virtual void ReturnResources(Array<ReturnedResourcePtr> resources) OVERRIDE; | |
41 | 50 |
42 gfx::AcceleratedWidget widget_; | 51 void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace); |
52 void CreateViewportBoundSurface(); | |
53 void SubmitFrame(); | |
54 | |
43 scoped_ptr<PlatformViewport> platform_viewport_; | 55 scoped_ptr<PlatformViewport> platform_viewport_; |
56 SurfacesServicePtr surfaces_service_; | |
jamesr
2014/08/26 23:05:50
might be worth splitting all this crap out into a
sky
2014/08/26 23:16:32
Sure.
| |
57 SurfacePtr surface_; | |
58 GpuPtr gpu_service_; | |
59 gfx::Rect bounds_; | |
60 uint64_t widget_id_; | |
61 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | |
62 cc::SurfaceId surface_id_; | |
63 cc::SurfaceId child_surface_id_; | |
44 bool waiting_for_event_ack_; | 64 bool waiting_for_event_ack_; |
45 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; | 65 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; |
46 }; | 66 }; |
47 | 67 |
48 } // namespace mojo | 68 } // namespace mojo |
49 | 69 |
50 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ | 70 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ |
OLD | NEW |