OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 UI_AURA_WINDOW_TREE_HOST_PLATFORM_H_ | 5 #ifndef UI_AURA_WINDOW_TREE_HOST_PLATFORM_H_ |
6 #define UI_AURA_WINDOW_TREE_HOST_PLATFORM_H_ | 6 #define UI_AURA_WINDOW_TREE_HOST_PLATFORM_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "ui/aura/aura_export.h" | 12 #include "ui/aura/aura_export.h" |
13 #include "ui/aura/window_tree_host.h" | 13 #include "ui/aura/window_tree_host.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 #include "ui/platform_window/platform_window.h" | 15 #include "ui/platform_window/platform_window.h" |
16 #include "ui/platform_window/platform_window_delegate.h" | 16 #include "ui/platform_window/platform_window_delegate.h" |
17 | 17 |
18 namespace aura { | 18 namespace aura { |
19 | 19 |
| 20 class WindowPort; |
| 21 |
20 // The unified WindowTreeHost implementation for platforms | 22 // The unified WindowTreeHost implementation for platforms |
21 // that implement PlatformWindow. | 23 // that implement PlatformWindow. |
22 class AURA_EXPORT WindowTreeHostPlatform | 24 class AURA_EXPORT WindowTreeHostPlatform |
23 : public WindowTreeHost, | 25 : public WindowTreeHost, |
24 public NON_EXPORTED_BASE(ui::PlatformWindowDelegate) { | 26 public NON_EXPORTED_BASE(ui::PlatformWindowDelegate) { |
25 public: | 27 public: |
26 explicit WindowTreeHostPlatform(const gfx::Rect& bounds); | 28 explicit WindowTreeHostPlatform(const gfx::Rect& bounds); |
27 ~WindowTreeHostPlatform() override; | 29 ~WindowTreeHostPlatform() override; |
28 | 30 |
29 // WindowTreeHost: | 31 // WindowTreeHost: |
30 ui::EventSource* GetEventSource() override; | 32 ui::EventSource* GetEventSource() override; |
31 gfx::AcceleratedWidget GetAcceleratedWidget() override; | 33 gfx::AcceleratedWidget GetAcceleratedWidget() override; |
32 void ShowImpl() override; | 34 void ShowImpl() override; |
33 void HideImpl() override; | 35 void HideImpl() override; |
34 gfx::Rect GetBounds() const override; | 36 gfx::Rect GetBounds() const override; |
35 void SetBounds(const gfx::Rect& bounds) override; | 37 void SetBounds(const gfx::Rect& bounds) override; |
36 gfx::Point GetLocationOnNativeScreen() const override; | 38 gfx::Point GetLocationOnNativeScreen() const override; |
37 void SetCapture() override; | 39 void SetCapture() override; |
38 void ReleaseCapture() override; | 40 void ReleaseCapture() override; |
39 void SetCursorNative(gfx::NativeCursor cursor) override; | 41 void SetCursorNative(gfx::NativeCursor cursor) override; |
40 void MoveCursorToNative(const gfx::Point& location) override; | 42 void MoveCursorToNative(const gfx::Point& location) override; |
41 void OnCursorVisibilityChangedNative(bool show) override; | 43 void OnCursorVisibilityChangedNative(bool show) override; |
42 | 44 |
43 protected: | 45 protected: |
44 WindowTreeHostPlatform(); | 46 WindowTreeHostPlatform(); |
| 47 explicit WindowTreeHostPlatform(std::unique_ptr<WindowPort> window_port); |
| 48 |
45 void SetPlatformWindow(std::unique_ptr<ui::PlatformWindow> window); | 49 void SetPlatformWindow(std::unique_ptr<ui::PlatformWindow> window); |
46 ui::PlatformWindow* platform_window() { return window_.get(); } | 50 ui::PlatformWindow* platform_window() { return window_.get(); } |
47 | 51 |
48 // ui::PlatformWindowDelegate: | 52 // ui::PlatformWindowDelegate: |
49 void OnBoundsChanged(const gfx::Rect& new_bounds) override; | 53 void OnBoundsChanged(const gfx::Rect& new_bounds) override; |
50 void OnDamageRect(const gfx::Rect& damaged_region) override; | 54 void OnDamageRect(const gfx::Rect& damaged_region) override; |
51 void DispatchEvent(ui::Event* event) override; | 55 void DispatchEvent(ui::Event* event) override; |
52 void OnCloseRequest() override; | 56 void OnCloseRequest() override; |
53 void OnClosed() override; | 57 void OnClosed() override; |
54 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 58 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
55 void OnLostCapture() override; | 59 void OnLostCapture() override; |
56 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 60 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
57 float device_pixel_ratio) override; | 61 float device_pixel_ratio) override; |
58 void OnAcceleratedWidgetDestroyed() override; | 62 void OnAcceleratedWidgetDestroyed() override; |
59 void OnActivationChanged(bool active) override; | 63 void OnActivationChanged(bool active) override; |
60 | 64 |
61 private: | 65 private: |
62 gfx::AcceleratedWidget widget_; | 66 gfx::AcceleratedWidget widget_; |
63 std::unique_ptr<ui::PlatformWindow> window_; | 67 std::unique_ptr<ui::PlatformWindow> window_; |
64 gfx::NativeCursor current_cursor_; | 68 gfx::NativeCursor current_cursor_; |
65 gfx::Rect bounds_; | 69 gfx::Rect bounds_; |
66 | 70 |
67 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostPlatform); | 71 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostPlatform); |
68 }; | 72 }; |
69 | 73 |
70 } // namespace aura | 74 } // namespace aura |
71 | 75 |
72 #endif // UI_AURA_WINDOW_TREE_HOST_PLATFORM_H_ | 76 #endif // UI_AURA_WINDOW_TREE_HOST_PLATFORM_H_ |
OLD | NEW |