| 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 "ui/events/event_source.h" |
| 16 #include "ui/platform_window/platform_window_delegate.h" | 17 #include "ui/platform_window/platform_window_delegate.h" |
| 17 | 18 |
| 18 namespace ui { | 19 namespace ui { |
| 19 | 20 |
| 20 class ImageCursors; | 21 class ImageCursors; |
| 21 class PlatformWindow; | 22 class PlatformWindow; |
| 22 | 23 |
| 23 namespace ws { | 24 namespace ws { |
| 24 | 25 |
| 25 // PlatformDisplay implementation that connects to a PlatformWindow and | 26 // PlatformDisplay implementation that connects to a PlatformWindow and |
| 26 // FrameGenerator for Chrome OS. | 27 // FrameGenerator for Chrome OS. |
| 27 class PlatformDisplayDefault : public PlatformDisplay, | 28 class PlatformDisplayDefault : public PlatformDisplay, |
| 29 public ui::EventSource, |
| 28 public ui::PlatformWindowDelegate, | 30 public ui::PlatformWindowDelegate, |
| 29 public FrameGeneratorDelegate { | 31 public FrameGeneratorDelegate { |
| 30 public: | 32 public: |
| 31 explicit PlatformDisplayDefault(const PlatformDisplayInitParams& init_params); | 33 explicit PlatformDisplayDefault(const PlatformDisplayInitParams& init_params); |
| 32 ~PlatformDisplayDefault() override; | 34 ~PlatformDisplayDefault() override; |
| 33 | 35 |
| 34 // PlatformDisplay: | 36 // PlatformDisplay: |
| 35 void Init(PlatformDisplayDelegate* delegate) override; | 37 void Init(PlatformDisplayDelegate* delegate) override; |
| 36 int64_t GetId() const override; | 38 int64_t GetId() const override; |
| 37 void SetViewportSize(const gfx::Size& size) override; | 39 void SetViewportSize(const gfx::Size& size) override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 48 FrameGenerator* GetFrameGenerator() override; | 50 FrameGenerator* GetFrameGenerator() override; |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 // Update the root_location of located events to be relative to the origin | 53 // 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) | 54 // 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 | 55 // and the location of the event is (100, 200) then the root_location will be |
| 54 // updated to be (1900, 200). | 56 // updated to be (1900, 200). |
| 55 // TODO(riajiang): This is totally broken with HDPI. | 57 // TODO(riajiang): This is totally broken with HDPI. |
| 56 void UpdateEventRootLocation(ui::LocatedEvent* event); | 58 void UpdateEventRootLocation(ui::LocatedEvent* event); |
| 57 | 59 |
| 60 // ui::EventSource: |
| 61 ui::EventProcessor* GetEventProcessor() override; |
| 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, |
| 67 float device_scale_factor) override; | 72 float device_scale_factor) override; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 86 ServerWindow* root_window_; | 91 ServerWindow* root_window_; |
| 87 float init_device_scale_factor_; | 92 float init_device_scale_factor_; |
| 88 | 93 |
| 89 DISALLOW_COPY_AND_ASSIGN(PlatformDisplayDefault); | 94 DISALLOW_COPY_AND_ASSIGN(PlatformDisplayDefault); |
| 90 }; | 95 }; |
| 91 | 96 |
| 92 } // namespace ws | 97 } // namespace ws |
| 93 } // namespace ui | 98 } // namespace ui |
| 94 | 99 |
| 95 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ | 100 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_ |
| OLD | NEW |