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