| 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_AURA_WINDOW_TREE_HOST_MOJO_H_ | 5 #ifndef MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ |
| 6 #define MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ | 6 #define MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h" | |
| 10 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" | 9 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" |
| 11 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
| 12 #include "ui/events/event_source.h" | 11 #include "ui/events/event_source.h" |
| 13 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 14 | 13 |
| 15 namespace ui { | 14 namespace ui { |
| 16 class ContextFactory; | 15 class ContextFactory; |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace mojo { | 18 namespace mojo { |
| 20 namespace service { | 19 namespace service { |
| 21 | 20 |
| 22 class ContextFactoryImpl; | 21 class ContextFactoryImpl; |
| 23 | 22 |
| 24 class WindowTreeHostImpl : public aura::WindowTreeHost, | 23 class WindowTreeHostImpl : public aura::WindowTreeHost, |
| 25 public ui::EventSource, | 24 public ui::EventSource, |
| 26 public NativeViewportClient { | 25 public NativeViewportClient { |
| 27 public: | 26 public: |
| 28 WindowTreeHostImpl(NativeViewportPtr viewport, | 27 WindowTreeHostImpl( |
| 29 GpuPtr gpu_service, | 28 NativeViewportPtr viewport, |
| 30 const gfx::Rect& bounds, | 29 const gfx::Rect& bounds, |
| 31 const Callback<void()>& compositor_created_callback, | 30 const Callback<void()>& compositor_created_callback, |
| 32 const Callback<void()>& native_viewport_closed_callback, | 31 const Callback<void()>& native_viewport_closed_callback, |
| 33 const Callback<void(EventPtr)>& event_received_callback); | 32 const Callback<void(EventPtr)>& event_received_callback); |
| 34 virtual ~WindowTreeHostImpl(); | 33 virtual ~WindowTreeHostImpl(); |
| 35 | 34 |
| 36 gfx::Rect bounds() const { return bounds_; } | 35 gfx::Rect bounds() const { return bounds_; } |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 // WindowTreeHost: | 38 // WindowTreeHost: |
| 40 virtual ui::EventSource* GetEventSource() OVERRIDE; | 39 virtual ui::EventSource* GetEventSource() OVERRIDE; |
| 41 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 40 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| 42 virtual void Show() OVERRIDE; | 41 virtual void Show() OVERRIDE; |
| 43 virtual void Hide() OVERRIDE; | 42 virtual void Hide() OVERRIDE; |
| 44 virtual gfx::Rect GetBounds() const OVERRIDE; | 43 virtual gfx::Rect GetBounds() const OVERRIDE; |
| 45 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 44 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 46 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 45 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
| 47 virtual void SetCapture() OVERRIDE; | 46 virtual void SetCapture() OVERRIDE; |
| 48 virtual void ReleaseCapture() OVERRIDE; | 47 virtual void ReleaseCapture() OVERRIDE; |
| 49 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 48 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
| 50 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; | 49 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; |
| 51 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; | 50 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; |
| 52 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; | 51 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; |
| 53 | 52 |
| 54 // ui::EventSource: | 53 // ui::EventSource: |
| 55 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; | 54 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; |
| 56 | 55 |
| 57 // Overridden from NativeViewportClient: | 56 // Overridden from NativeViewportClient: |
| 58 virtual void OnCreated(uint64_t native_viewport_id) OVERRIDE; | 57 virtual void OnCreated() OVERRIDE; |
| 59 virtual void OnDestroyed() OVERRIDE; | 58 virtual void OnDestroyed(const mojo::Callback<void()>& callback) OVERRIDE; |
| 60 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE; | 59 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE; |
| 61 virtual void OnEvent(EventPtr event, | 60 virtual void OnEvent(EventPtr event, |
| 62 const mojo::Callback<void()>& callback) OVERRIDE; | 61 const mojo::Callback<void()>& callback) OVERRIDE; |
| 63 | 62 |
| 64 static ContextFactoryImpl* context_factory_; | 63 static ContextFactoryImpl* context_factory_; |
| 65 | 64 |
| 66 NativeViewportPtr native_viewport_; | 65 NativeViewportPtr native_viewport_; |
| 67 GpuPtr gpu_service_; | |
| 68 gfx::AcceleratedWidget widget_; | |
| 69 Callback<void()> compositor_created_callback_; | 66 Callback<void()> compositor_created_callback_; |
| 70 Callback<void()> native_viewport_closed_callback_; | 67 Callback<void()> native_viewport_closed_callback_; |
| 71 Callback<void(EventPtr)> event_received_callback_; | 68 Callback<void(EventPtr)> event_received_callback_; |
| 72 | 69 |
| 73 gfx::Rect bounds_; | 70 gfx::Rect bounds_; |
| 74 | 71 |
| 75 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); | 72 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); |
| 76 }; | 73 }; |
| 77 | 74 |
| 78 } // namespace service | 75 } // namespace service |
| 79 } // namespace mojo | 76 } // namespace mojo |
| 80 | 77 |
| 81 #endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ | 78 #endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ |
| OLD | NEW |