| 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 MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ | 5 #ifndef MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ |
| 6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ | 6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "mojo/services/native_viewport/native_viewport_export.h" | 9 #include "mojo/services/native_viewport/native_viewport_export.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class Rect; | 14 class Rect; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 class Event; | 18 class Event; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace mojo { | 21 namespace mojo { |
| 22 namespace shell { | 22 namespace services { |
| 23 class Context; | |
| 24 } | |
| 25 | 23 |
| 26 namespace services { | 24 class NativeViewportContext; |
| 27 | 25 |
| 28 class NativeViewportDelegate { | 26 class NativeViewportDelegate { |
| 29 public: | 27 public: |
| 30 virtual ~NativeViewportDelegate() {} | 28 virtual ~NativeViewportDelegate() {} |
| 31 | 29 |
| 32 virtual void OnBoundsChanged(const gfx::Rect& size) = 0; | 30 virtual void OnBoundsChanged(const gfx::Rect& size) = 0; |
| 33 virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) = 0; | 31 virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) = 0; |
| 34 virtual bool OnEvent(ui::Event* ui_event) = 0; | 32 virtual bool OnEvent(ui::Event* ui_event) = 0; |
| 35 virtual void OnDestroyed() = 0; | 33 virtual void OnDestroyed() = 0; |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 // Encapsulation of platform-specific Viewport. | 36 // Encapsulation of platform-specific Viewport. |
| 39 // TODO(abarth): Rename this class so that it doesn't conflict with the name of | 37 // TODO(abarth): Rename this class so that it doesn't conflict with the name of |
| 40 // the service. | 38 // the service. |
| 41 class NativeViewport { | 39 class NativeViewport { |
| 42 public: | 40 public: |
| 43 virtual ~NativeViewport() {} | 41 virtual ~NativeViewport() {} |
| 44 | 42 |
| 45 virtual void Init(const gfx::Rect& bounds) = 0; | 43 virtual void Init(const gfx::Rect& bounds) = 0; |
| 46 virtual void Show() = 0; | 44 virtual void Show() = 0; |
| 47 virtual void Hide() = 0; | 45 virtual void Hide() = 0; |
| 48 virtual void Close() = 0; | 46 virtual void Close() = 0; |
| 49 virtual gfx::Size GetSize() = 0; | 47 virtual gfx::Size GetSize() = 0; |
| 50 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 48 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
| 51 | 49 |
| 52 virtual void SetCapture() = 0; | 50 virtual void SetCapture() = 0; |
| 53 virtual void ReleaseCapture() = 0; | 51 virtual void ReleaseCapture() = 0; |
| 54 | 52 |
| 55 // |context| is NULL when loaded into separate process. | 53 // |context| is NULL when loaded into separate process. |
| 56 static scoped_ptr<NativeViewport> Create(shell::Context* context, | 54 static scoped_ptr<NativeViewport> Create(NativeViewportContext* context, |
| 57 NativeViewportDelegate* delegate); | 55 NativeViewportDelegate* delegate); |
| 58 }; | 56 }; |
| 59 | 57 |
| 60 } // namespace services | 58 } // namespace services |
| 61 } // namespace mojo | 59 } // namespace mojo |
| 62 | 60 |
| 63 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ | 61 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_ |
| OLD | NEW |