| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ | 5 #ifndef SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ |
| 6 #define SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ | 6 #define SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "services/ui/display/viewport_metrics.h" | 11 #include "services/ui/display/viewport_metrics.h" |
| 12 #include "services/ui/ws/frame_generator.h" | 12 #include "services/ui/ws/frame_generator.h" |
| 13 #include "services/ui/ws/platform_display.h" | 13 #include "services/ui/ws/platform_display.h" |
| 14 #include "services/ui/ws/platform_display_delegate.h" | 14 #include "services/ui/ws/platform_display_delegate.h" |
| 15 #include "services/ui/ws/server_window.h" | 15 #include "services/ui/ws/server_window.h" |
| 16 #include "ui/platform_window/platform_window_delegate.h" | 16 #include "ui/platform_window/platform_window_delegate.h" |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 class EventSink; | 20 class EventSink; |
| 21 class ImageCursors; | 21 class ImageCursors; |
| 22 class LocatedEvent; | |
| 23 class PlatformWindow; | 22 class PlatformWindow; |
| 24 | 23 |
| 25 namespace ws { | 24 namespace ws { |
| 26 | 25 |
| 27 // PlatformDisplay implementation that connects to a PlatformWindow and | 26 // PlatformDisplay implementation that connects to a PlatformWindow and |
| 28 // FrameGenerator for Chrome OS. | 27 // FrameGenerator for Chrome OS. |
| 29 class PlatformDisplayDefault : public PlatformDisplay, | 28 class PlatformDisplayDefault : public PlatformDisplay, |
| 30 public ui::PlatformWindowDelegate { | 29 public ui::PlatformWindowDelegate { |
| 31 public: | 30 public: |
| 32 // |image_cursors| may be null, for example on Android or in tests. | 31 // |image_cursors| may be null, for example on Android or in tests. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 45 void SetCapture() override; | 44 void SetCapture() override; |
| 46 void ReleaseCapture() override; | 45 void ReleaseCapture() override; |
| 47 void SetCursor(const ui::CursorData& cursor) override; | 46 void SetCursor(const ui::CursorData& cursor) override; |
| 48 void UpdateTextInputState(const ui::TextInputState& state) override; | 47 void UpdateTextInputState(const ui::TextInputState& state) override; |
| 49 void SetImeVisibility(bool visible) override; | 48 void SetImeVisibility(bool visible) override; |
| 50 void UpdateViewportMetrics(const display::ViewportMetrics& metrics) override; | 49 void UpdateViewportMetrics(const display::ViewportMetrics& metrics) override; |
| 51 gfx::AcceleratedWidget GetAcceleratedWidget() const override; | 50 gfx::AcceleratedWidget GetAcceleratedWidget() const override; |
| 52 FrameGenerator* GetFrameGenerator() override; | 51 FrameGenerator* GetFrameGenerator() override; |
| 53 | 52 |
| 54 private: | 53 private: |
| 55 // Update the root_location of located events to be relative to the origin | |
| 56 // of this display. For example, if the origin of this display is (1800, 0) | |
| 57 // and the location of the event is (100, 200) then the root_location will be | |
| 58 // updated to be (1900, 200). | |
| 59 // TODO(riajiang): This is totally broken with HDPI. | |
| 60 void UpdateEventRootLocation(ui::LocatedEvent* event); | |
| 61 | |
| 62 // ui::PlatformWindowDelegate: | 54 // ui::PlatformWindowDelegate: |
| 63 void OnBoundsChanged(const gfx::Rect& new_bounds) override; | 55 void OnBoundsChanged(const gfx::Rect& new_bounds) override; |
| 64 void OnDamageRect(const gfx::Rect& damaged_region) override; | 56 void OnDamageRect(const gfx::Rect& damaged_region) override; |
| 65 void DispatchEvent(ui::Event* event) override; | 57 void DispatchEvent(ui::Event* event) override; |
| 66 void OnCloseRequest() override; | 58 void OnCloseRequest() override; |
| 67 void OnClosed() override; | 59 void OnClosed() override; |
| 68 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 60 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
| 69 void OnLostCapture() override; | 61 void OnLostCapture() override; |
| 70 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 62 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
| 71 float device_scale_factor) override; | 63 float device_scale_factor) override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 83 std::unique_ptr<ui::PlatformWindow> platform_window_; | 75 std::unique_ptr<ui::PlatformWindow> platform_window_; |
| 84 gfx::AcceleratedWidget widget_; | 76 gfx::AcceleratedWidget widget_; |
| 85 | 77 |
| 86 DISALLOW_COPY_AND_ASSIGN(PlatformDisplayDefault); | 78 DISALLOW_COPY_AND_ASSIGN(PlatformDisplayDefault); |
| 87 }; | 79 }; |
| 88 | 80 |
| 89 } // namespace ws | 81 } // namespace ws |
| 90 } // namespace ui | 82 } // namespace ui |
| 91 | 83 |
| 92 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ | 84 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ |
| OLD | NEW |