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/macros.h" |
8 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
9 #include "cc/surfaces/surface_id.h" | 10 #include "cc/surfaces/surface_id.h" |
10 #include "mojo/services/native_viewport/platform_viewport.h" | 11 #include "mojo/services/native_viewport/platform_viewport.h" |
11 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h" | 12 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h" |
12 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" | 13 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" |
13 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" | 14 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" |
14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 class Event; | 18 class Event; |
18 } | 19 } |
19 | 20 |
20 namespace mojo { | 21 namespace mojo { |
21 class ApplicationImpl; | 22 class ApplicationImpl; |
22 class ViewportSurface; | 23 class ViewportSurface; |
23 | 24 |
24 class NativeViewportImpl : public InterfaceImpl<NativeViewport>, | 25 class NativeViewportImpl : public InterfaceImpl<NativeViewport>, |
25 public PlatformViewport::Delegate { | 26 public PlatformViewport::Delegate { |
26 public: | 27 public: |
27 NativeViewportImpl(ApplicationImpl* app, bool is_headless); | 28 NativeViewportImpl(ApplicationImpl* app, bool is_headless); |
28 virtual ~NativeViewportImpl(); | 29 virtual ~NativeViewportImpl(); |
29 | 30 |
30 // InterfaceImpl<NativeViewport> implementation. | 31 // InterfaceImpl<NativeViewport> implementation. |
31 virtual void Create(SizePtr size, | 32 virtual void Create(SizePtr size, |
32 const Callback<void(uint64_t)>& callback) OVERRIDE; | 33 const Callback<void(uint64_t)>& callback) override; |
33 virtual void Show() OVERRIDE; | 34 virtual void Show() override; |
34 virtual void Hide() OVERRIDE; | 35 virtual void Hide() override; |
35 virtual void Close() OVERRIDE; | 36 virtual void Close() override; |
36 virtual void SetSize(SizePtr size) OVERRIDE; | 37 virtual void SetSize(SizePtr size) override; |
37 virtual void SubmittedFrame(SurfaceIdPtr surface_id) OVERRIDE; | 38 virtual void SubmittedFrame(SurfaceIdPtr surface_id) override; |
38 | 39 |
39 // PlatformViewport::Delegate implementation. | 40 // PlatformViewport::Delegate implementation. |
40 virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE; | 41 virtual void OnBoundsChanged(const gfx::Rect& bounds) override; |
41 virtual void OnAcceleratedWidgetAvailable( | 42 virtual void OnAcceleratedWidgetAvailable( |
42 gfx::AcceleratedWidget widget) OVERRIDE; | 43 gfx::AcceleratedWidget widget) override; |
43 virtual bool OnEvent(ui::Event* ui_event) OVERRIDE; | 44 virtual bool OnEvent(ui::Event* ui_event) override; |
44 virtual void OnDestroyed() OVERRIDE; | 45 virtual void OnDestroyed() override; |
45 | 46 |
46 void AckEvent(); | 47 void AckEvent(); |
47 | 48 |
48 private: | 49 private: |
49 void ProcessOnBoundsChanged(); | 50 void ProcessOnBoundsChanged(); |
50 | 51 |
51 bool is_headless_; | 52 bool is_headless_; |
52 scoped_ptr<PlatformViewport> platform_viewport_; | 53 scoped_ptr<PlatformViewport> platform_viewport_; |
53 scoped_ptr<ViewportSurface> viewport_surface_; | 54 scoped_ptr<ViewportSurface> viewport_surface_; |
54 uint64_t widget_id_; | 55 uint64_t widget_id_; |
55 gfx::Size size_; | 56 gfx::Size size_; |
56 GpuPtr gpu_service_; | 57 GpuPtr gpu_service_; |
57 SurfacesServicePtr surfaces_service_; | 58 SurfacesServicePtr surfaces_service_; |
58 cc::SurfaceId child_surface_id_; | 59 cc::SurfaceId child_surface_id_; |
59 bool waiting_for_event_ack_; | 60 bool waiting_for_event_ack_; |
60 Callback<void(uint64_t)> create_callback_; | 61 Callback<void(uint64_t)> create_callback_; |
61 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; | 62 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; |
62 | 63 |
63 DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl); | 64 DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl); |
64 }; | 65 }; |
65 | 66 |
66 } // namespace mojo | 67 } // namespace mojo |
67 | 68 |
68 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ | 69 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_ |
OLD | NEW |