| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_H_ | 5 #ifndef SERVICES_UI_WS_PLATFORM_DISPLAY_H_ |
| 6 #define SERVICES_UI_WS_PLATFORM_DISPLAY_H_ | 6 #define SERVICES_UI_WS_PLATFORM_DISPLAY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "services/ui/display/platform_screen.h" |
| 18 #include "services/ui/public/interfaces/window_manager.mojom.h" | 19 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 19 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 20 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 20 #include "services/ui/public/interfaces/window_tree.mojom.h" | 21 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 21 #include "services/ui/ws/frame_generator.h" | 22 #include "services/ui/ws/frame_generator.h" |
| 22 #include "services/ui/ws/frame_generator_delegate.h" | 23 #include "services/ui/ws/frame_generator_delegate.h" |
| 23 #include "services/ui/ws/platform_display_delegate.h" | 24 #include "services/ui/ws/platform_display_delegate.h" |
| 24 #include "ui/display/display.h" | 25 #include "ui/display/display.h" |
| 25 #include "ui/platform_window/platform_window_delegate.h" | 26 #include "ui/platform_window/platform_window_delegate.h" |
| 26 | 27 |
| 27 namespace cc { | 28 namespace cc { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 virtual void SetImeVisibility(bool visible) = 0; | 83 virtual void SetImeVisibility(bool visible) = 0; |
| 83 | 84 |
| 84 // Returns true if a compositor frame has been submitted but not drawn yet. | 85 // Returns true if a compositor frame has been submitted but not drawn yet. |
| 85 virtual bool IsFramePending() const = 0; | 86 virtual bool IsFramePending() const = 0; |
| 86 | 87 |
| 87 virtual void RequestCopyOfOutput( | 88 virtual void RequestCopyOfOutput( |
| 88 std::unique_ptr<cc::CopyOutputRequest> output_request) = 0; | 89 std::unique_ptr<cc::CopyOutputRequest> output_request) = 0; |
| 89 | 90 |
| 90 virtual gfx::Rect GetBounds() const = 0; | 91 virtual gfx::Rect GetBounds() const = 0; |
| 91 | 92 |
| 93 virtual bool IsPrimaryDisplay() const = 0; |
| 94 |
| 92 // Overrides factory for testing. Default (NULL) value indicates regular | 95 // Overrides factory for testing. Default (NULL) value indicates regular |
| 93 // (non-test) environment. | 96 // (non-test) environment. |
| 94 static void set_factory_for_testing(PlatformDisplayFactory* factory) { | 97 static void set_factory_for_testing(PlatformDisplayFactory* factory) { |
| 95 PlatformDisplay::factory_ = factory; | 98 PlatformDisplay::factory_ = factory; |
| 96 } | 99 } |
| 97 | 100 |
| 98 private: | 101 private: |
| 99 // Static factory instance (always NULL for non-test). | 102 // Static factory instance (always NULL for non-test). |
| 100 static PlatformDisplayFactory* factory_; | 103 static PlatformDisplayFactory* factory_; |
| 101 }; | 104 }; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 120 void ReleaseCapture() override; | 123 void ReleaseCapture() override; |
| 121 void SetCursorById(int32_t cursor) override; | 124 void SetCursorById(int32_t cursor) override; |
| 122 float GetDeviceScaleFactor() override; | 125 float GetDeviceScaleFactor() override; |
| 123 display::Display::Rotation GetRotation() override; | 126 display::Display::Rotation GetRotation() override; |
| 124 void UpdateTextInputState(const ui::TextInputState& state) override; | 127 void UpdateTextInputState(const ui::TextInputState& state) override; |
| 125 void SetImeVisibility(bool visible) override; | 128 void SetImeVisibility(bool visible) override; |
| 126 bool IsFramePending() const override; | 129 bool IsFramePending() const override; |
| 127 void RequestCopyOfOutput( | 130 void RequestCopyOfOutput( |
| 128 std::unique_ptr<cc::CopyOutputRequest> output_request) override; | 131 std::unique_ptr<cc::CopyOutputRequest> output_request) override; |
| 129 gfx::Rect GetBounds() const override; | 132 gfx::Rect GetBounds() const override; |
| 133 bool IsPrimaryDisplay() const override; |
| 130 | 134 |
| 131 private: | 135 private: |
| 132 void UpdateMetrics(const gfx::Rect& bounds, float device_scale_factor); | 136 void UpdateMetrics(const gfx::Rect& bounds, float device_scale_factor); |
| 133 | 137 |
| 138 // Update the root_location of located events to be relative to the origin |
| 139 // of this display. For example, if the origin of this display is (1800, 0) |
| 140 // and the location of the event is (100, 200) then the root_location will be |
| 141 // updated to be (1900, 200). |
| 142 void UpdateEventRootLocation(ui::LocatedEvent* event); |
| 143 |
| 134 // ui::PlatformWindowDelegate: | 144 // ui::PlatformWindowDelegate: |
| 135 void OnBoundsChanged(const gfx::Rect& new_bounds) override; | 145 void OnBoundsChanged(const gfx::Rect& new_bounds) override; |
| 136 void OnDamageRect(const gfx::Rect& damaged_region) override; | 146 void OnDamageRect(const gfx::Rect& damaged_region) override; |
| 137 void DispatchEvent(ui::Event* event) override; | 147 void DispatchEvent(ui::Event* event) override; |
| 138 void OnCloseRequest() override; | 148 void OnCloseRequest() override; |
| 139 void OnClosed() override; | 149 void OnClosed() override; |
| 140 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 150 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
| 141 void OnLostCapture() override; | 151 void OnLostCapture() override; |
| 142 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 152 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
| 143 float device_scale_factor) override; | 153 float device_scale_factor) override; |
| 144 void OnAcceleratedWidgetDestroyed() override; | 154 void OnAcceleratedWidgetDestroyed() override; |
| 145 void OnActivationChanged(bool active) override; | 155 void OnActivationChanged(bool active) override; |
| 146 | 156 |
| 147 // FrameGeneratorDelegate: | 157 // FrameGeneratorDelegate: |
| 148 ServerWindow* GetRootWindow() override; | 158 ServerWindow* GetRootWindow() override; |
| 149 void OnCompositorFrameDrawn() override; | 159 void OnCompositorFrameDrawn() override; |
| 150 bool IsInHighContrastMode() override; | 160 bool IsInHighContrastMode() override; |
| 151 const ViewportMetrics& GetViewportMetrics() override; | 161 const ViewportMetrics& GetViewportMetrics() override; |
| 152 | 162 |
| 153 int64_t id_; | 163 int64_t id_; |
| 164 display::PlatformScreen* platform_screen_; |
| 154 | 165 |
| 155 #if !defined(OS_ANDROID) | 166 #if !defined(OS_ANDROID) |
| 156 std::unique_ptr<ui::CursorLoader> cursor_loader_; | 167 std::unique_ptr<ui::CursorLoader> cursor_loader_; |
| 157 #endif | 168 #endif |
| 158 | 169 |
| 159 PlatformDisplayDelegate* delegate_ = nullptr; | 170 PlatformDisplayDelegate* delegate_ = nullptr; |
| 160 std::unique_ptr<FrameGenerator> frame_generator_; | 171 std::unique_ptr<FrameGenerator> frame_generator_; |
| 161 | 172 |
| 162 ViewportMetrics metrics_; | 173 ViewportMetrics metrics_; |
| 163 std::unique_ptr<ui::PlatformWindow> platform_window_; | 174 std::unique_ptr<ui::PlatformWindow> platform_window_; |
| 164 | 175 |
| 165 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); | 176 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); |
| 166 }; | 177 }; |
| 167 | 178 |
| 168 } // namespace ws | 179 } // namespace ws |
| 169 | 180 |
| 170 } // namespace ui | 181 } // namespace ui |
| 171 | 182 |
| 172 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_H_ | 183 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_H_ |
| OLD | NEW |