| 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/frame_generator_delegate.h" | 13 #include "services/ui/ws/frame_generator_delegate.h" |
| 14 #include "services/ui/ws/platform_display.h" | 14 #include "services/ui/ws/platform_display.h" |
| 15 #include "services/ui/ws/platform_display_delegate.h" | 15 #include "services/ui/ws/platform_display_delegate.h" |
| 16 #include "services/ui/ws/server_window.h" | 16 #include "services/ui/ws/server_window.h" |
| 17 #include "ui/platform_window/platform_window_delegate.h" | 17 #include "ui/platform_window/platform_window_delegate.h" |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 | 20 |
| 21 class EventSink; |
| 21 class ImageCursors; | 22 class ImageCursors; |
| 22 class LocatedEvent; | 23 class LocatedEvent; |
| 23 class PlatformWindow; | 24 class PlatformWindow; |
| 24 | 25 |
| 25 namespace ws { | 26 namespace ws { |
| 26 | 27 |
| 27 // PlatformDisplay implementation that connects to a PlatformWindow and | 28 // PlatformDisplay implementation that connects to a PlatformWindow and |
| 28 // FrameGenerator for Chrome OS. | 29 // FrameGenerator for Chrome OS. |
| 29 class PlatformDisplayDefault : public PlatformDisplay, | 30 class PlatformDisplayDefault : public PlatformDisplay, |
| 30 public ui::PlatformWindowDelegate, | 31 public ui::PlatformWindowDelegate, |
| 31 public FrameGeneratorDelegate { | 32 public FrameGeneratorDelegate { |
| 32 public: | 33 public: |
| 33 PlatformDisplayDefault(ServerWindow* root_window, | 34 PlatformDisplayDefault(ServerWindow* root_window, |
| 34 const display::ViewportMetrics& metrics); | 35 const display::ViewportMetrics& metrics); |
| 35 ~PlatformDisplayDefault() override; | 36 ~PlatformDisplayDefault() override; |
| 36 | 37 |
| 38 // EventSource:: |
| 39 EventSink* GetEventSink() override; |
| 40 |
| 37 // PlatformDisplay: | 41 // PlatformDisplay: |
| 38 void Init(PlatformDisplayDelegate* delegate) override; | 42 void Init(PlatformDisplayDelegate* delegate) override; |
| 39 void SetViewportSize(const gfx::Size& size) override; | 43 void SetViewportSize(const gfx::Size& size) override; |
| 40 void SetTitle(const base::string16& title) override; | 44 void SetTitle(const base::string16& title) override; |
| 41 void SetCapture() override; | 45 void SetCapture() override; |
| 42 void ReleaseCapture() override; | 46 void ReleaseCapture() override; |
| 43 void SetCursorById(mojom::Cursor cursor) override; | 47 void SetCursorById(mojom::Cursor cursor) override; |
| 44 void UpdateTextInputState(const ui::TextInputState& state) override; | 48 void UpdateTextInputState(const ui::TextInputState& state) override; |
| 45 void SetImeVisibility(bool visible) override; | 49 void SetImeVisibility(bool visible) override; |
| 46 bool UpdateViewportMetrics(const display::ViewportMetrics& metrics) override; | 50 bool UpdateViewportMetrics(const display::ViewportMetrics& metrics) override; |
| 47 gfx::AcceleratedWidget GetAcceleratedWidget() const override; | 51 gfx::AcceleratedWidget GetAcceleratedWidget() const override; |
| 48 FrameGenerator* GetFrameGenerator() override; | 52 FrameGenerator* GetFrameGenerator() override; |
| 49 | 53 |
| 50 private: | 54 private: |
| 51 // Update the root_location of located events to be relative to the origin | 55 // Update the root_location of located events to be relative to the origin |
| 52 // of this display. For example, if the origin of this display is (1800, 0) | 56 // of this display. For example, if the origin of this display is (1800, 0) |
| 53 // and the location of the event is (100, 200) then the root_location will be | 57 // and the location of the event is (100, 200) then the root_location will be |
| 54 // updated to be (1900, 200). | 58 // updated to be (1900, 200). |
| 55 // TODO(riajiang): This is totally broken with HDPI. | 59 // TODO(riajiang): This is totally broken with HDPI. |
| 56 void UpdateEventRootLocation(ui::LocatedEvent* event); | 60 void UpdateEventRootLocation(ui::LocatedEvent* event); |
| 61 void DispatchEventToDelegate(const ui::Event& event); |
| 57 | 62 |
| 58 // ui::PlatformWindowDelegate: | 63 // ui::PlatformWindowDelegate: |
| 59 void OnBoundsChanged(const gfx::Rect& new_bounds) override; | 64 void OnBoundsChanged(const gfx::Rect& new_bounds) override; |
| 60 void OnDamageRect(const gfx::Rect& damaged_region) override; | 65 void OnDamageRect(const gfx::Rect& damaged_region) override; |
| 61 void DispatchEvent(ui::Event* event) override; | 66 void DispatchEvent(ui::Event* event) override; |
| 62 void OnCloseRequest() override; | 67 void OnCloseRequest() override; |
| 63 void OnClosed() override; | 68 void OnClosed() override; |
| 64 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 69 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
| 65 void OnLostCapture() override; | 70 void OnLostCapture() override; |
| 66 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 71 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 85 gfx::AcceleratedWidget widget_; | 90 gfx::AcceleratedWidget widget_; |
| 86 float init_device_scale_factor_; | 91 float init_device_scale_factor_; |
| 87 | 92 |
| 88 DISALLOW_COPY_AND_ASSIGN(PlatformDisplayDefault); | 93 DISALLOW_COPY_AND_ASSIGN(PlatformDisplayDefault); |
| 89 }; | 94 }; |
| 90 | 95 |
| 91 } // namespace ws | 96 } // namespace ws |
| 92 } // namespace ui | 97 } // namespace ui |
| 93 | 98 |
| 94 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ | 99 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ |
| OLD | NEW |