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