OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ |
6 #define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ | 6 #define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "components/view_manager/public/interfaces/native_viewport.mojom.h" | |
10 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
11 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/mojo/events/input_events.mojom.h" | 11 #include "ui/mojo/events/input_events.mojom.h" |
13 | 12 |
14 namespace gfx { | 13 namespace gfx { |
15 class Rect; | 14 class Rect; |
16 } | 15 } |
17 | 16 |
18 namespace native_viewport { | 17 namespace native_viewport { |
19 | 18 |
20 // Encapsulation of platform-specific Viewport. | 19 // Encapsulation of platform-specific Viewport. |
21 class PlatformViewport { | 20 class PlatformViewport { |
22 public: | 21 public: |
23 class Delegate { | 22 class Delegate { |
24 public: | 23 public: |
25 virtual ~Delegate() {} | 24 virtual ~Delegate() {} |
26 | 25 |
27 virtual void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) = 0; | |
28 virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 26 virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
29 float device_pixel_ratio) = 0; | 27 float device_pixel_ratio) = 0; |
30 virtual void OnAcceleratedWidgetDestroyed() = 0; | 28 virtual void OnAcceleratedWidgetDestroyed() = 0; |
31 virtual bool OnEvent(mojo::EventPtr event) = 0; | |
32 virtual void OnDestroyed() = 0; | 29 virtual void OnDestroyed() = 0; |
| 30 virtual void OnEvent(mojo::EventPtr event) = 0; |
| 31 virtual void OnMetricsChanged(const gfx::Size& size, |
| 32 float device_scale_factor) = 0; |
33 }; | 33 }; |
34 | 34 |
35 virtual ~PlatformViewport() {} | 35 virtual ~PlatformViewport() {} |
36 | 36 |
37 virtual void Init(const gfx::Rect& bounds) = 0; | 37 virtual void Init(const gfx::Rect& bounds) = 0; |
38 virtual void Show() = 0; | 38 virtual void Show() = 0; |
39 virtual void Hide() = 0; | 39 virtual void Hide() = 0; |
40 virtual void Close() = 0; | 40 virtual void Close() = 0; |
41 virtual gfx::Size GetSize() = 0; | 41 virtual gfx::Size GetSize() = 0; |
42 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 42 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
43 | 43 |
44 static scoped_ptr<PlatformViewport> Create(Delegate* delegate); | 44 static scoped_ptr<PlatformViewport> Create(Delegate* delegate, bool headless); |
45 }; | 45 }; |
46 | 46 |
47 } // namespace native_viewport | 47 } // namespace native_viewport |
48 | 48 |
49 #endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ | 49 #endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ |
OLD | NEW |