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 SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ | 5 #ifndef SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ |
6 #define SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ | 6 #define SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "mojo/services/input_events/public/interfaces/input_events.mojom.h" |
9 #include "mojo/services/native_viewport/public/interfaces/native_viewport.mojom.
h" | 10 #include "mojo/services/native_viewport/public/interfaces/native_viewport.mojom.
h" |
10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
12 | 13 |
13 namespace gfx { | 14 namespace gfx { |
14 class Rect; | 15 class Rect; |
15 } | 16 } |
16 | 17 |
17 namespace ui { | |
18 class Event; | |
19 } | |
20 | |
21 namespace native_viewport { | 18 namespace native_viewport { |
22 | 19 |
23 // Encapsulation of platform-specific Viewport. | 20 // Encapsulation of platform-specific Viewport. |
24 class PlatformViewport { | 21 class PlatformViewport { |
25 public: | 22 public: |
26 class Delegate { | 23 class Delegate { |
27 public: | 24 public: |
28 virtual ~Delegate() {} | 25 virtual ~Delegate() {} |
29 | 26 |
30 virtual void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) = 0; | 27 virtual void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) = 0; |
31 virtual void OnAcceleratedWidgetAvailable( | 28 virtual void OnAcceleratedWidgetAvailable( |
32 gfx::AcceleratedWidget widget) = 0; | 29 gfx::AcceleratedWidget widget) = 0; |
33 virtual void OnAcceleratedWidgetDestroyed() = 0; | 30 virtual void OnAcceleratedWidgetDestroyed() = 0; |
34 virtual bool OnEvent(ui::Event* ui_event) = 0; | 31 virtual bool OnEvent(mojo::EventPtr event) = 0; |
35 virtual void OnDestroyed() = 0; | 32 virtual void OnDestroyed() = 0; |
36 }; | 33 }; |
37 | 34 |
38 virtual ~PlatformViewport() {} | 35 virtual ~PlatformViewport() {} |
39 | 36 |
40 virtual void Init(const gfx::Rect& bounds) = 0; | 37 virtual void Init(const gfx::Rect& bounds) = 0; |
41 virtual void Show() = 0; | 38 virtual void Show() = 0; |
42 virtual void Hide() = 0; | 39 virtual void Hide() = 0; |
43 virtual void Close() = 0; | 40 virtual void Close() = 0; |
44 virtual gfx::Size GetSize() = 0; | 41 virtual gfx::Size GetSize() = 0; |
45 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 42 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
46 | 43 |
47 virtual void SetCapture() = 0; | |
48 virtual void ReleaseCapture() = 0; | |
49 | |
50 static scoped_ptr<PlatformViewport> Create(Delegate* delegate); | 44 static scoped_ptr<PlatformViewport> Create(Delegate* delegate); |
51 }; | 45 }; |
52 | 46 |
53 } // namespace native_viewport | 47 } // namespace native_viewport |
54 | 48 |
55 #endif // SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ | 49 #endif // SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_H_ |
OLD | NEW |