OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ | |
6 #define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "components/view_manager/native_viewport/onscreen_context_provider.h" | |
11 #include "components/view_manager/native_viewport/platform_viewport.h" | |
12 #include "components/view_manager/public/interfaces/gpu.mojom.h" | |
13 | |
14 namespace gles2 { | |
15 class GpuState; | |
16 } // namespace gles2 | |
17 | |
18 namespace gfx { | |
19 class Size; | |
20 } // namespace gfx | |
21 | |
22 namespace view_manager { | |
23 | |
24 class EventDispatcher; | |
25 | |
26 class NativeViewport : public native_viewport::PlatformViewport::Delegate { | |
27 public: | |
28 class Delegate { | |
29 public: | |
30 virtual ~Delegate() {} | |
sky
2015/06/05 23:25:50
nit: protected
Fady Samuel
2015/06/05 23:34:52
Native viewport wasn't doing much so I just got ri
| |
31 | |
32 virtual void OnMetricsChanged(const gfx::Size& size, | |
33 float device_scale_factor) {} | |
34 // TODO(fsamuel): I don't think this bool does anything event in | |
35 // PlatformViewport. We should just remove it. | |
36 virtual bool OnEvent(mojo::EventPtr event) = 0; | |
37 virtual void OnViewDestroyed() = 0; | |
38 }; | |
39 | |
40 using ViewDestroyedCallback = mojo::Callback<void()>; | |
41 | |
42 NativeViewport(Delegate* delegate, | |
43 const gfx::Size& size, | |
44 bool is_headless, | |
45 const scoped_refptr<gles2::GpuState>& gpu_state); | |
46 ~NativeViewport() override; | |
47 | |
48 void Show(); | |
49 | |
50 void Hide(); | |
51 | |
52 void Close(); | |
53 | |
54 void SetSize(const gfx::Size& size); | |
55 | |
56 void GetContextProvider( | |
57 mojo::InterfaceRequest<mojo::ContextProvider> request); | |
58 | |
59 // PlatformViewport::Delegate implementation. | |
60 void OnMetricsChanged(const gfx::Size& size, | |
61 float device_scale_factor) override; | |
62 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | |
63 float device_pixel_ratio) override; | |
64 void OnAcceleratedWidgetDestroyed() override; | |
65 bool OnEvent(mojo::EventPtr event) override; | |
66 void OnDestroyed() override; | |
67 | |
68 private: | |
69 Delegate* delegate_; | |
70 | |
71 scoped_ptr<native_viewport::PlatformViewport> platform_viewport_; | |
72 scoped_ptr<native_viewport::OnscreenContextProvider> context_provider_; | |
73 | |
74 gfx::Size size_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(NativeViewport); | |
77 }; | |
78 } // namespace view_manager | |
79 | |
80 #endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ | |
OLD | NEW |