Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: services/ui/ws/platform_display.h

Issue 2434923002: Handle modified displays in mustash. (Closed)
Patch Set: Fixes after initial review. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 virtual void SetViewportSize(const gfx::Size& size) = 0; 72 virtual void SetViewportSize(const gfx::Size& size) = 0;
73 73
74 virtual void SetTitle(const base::string16& title) = 0; 74 virtual void SetTitle(const base::string16& title) = 0;
75 75
76 virtual void SetCapture() = 0; 76 virtual void SetCapture() = 0;
77 77
78 virtual void ReleaseCapture() = 0; 78 virtual void ReleaseCapture() = 0;
79 79
80 virtual void SetCursorById(mojom::Cursor cursor) = 0; 80 virtual void SetCursorById(mojom::Cursor cursor) = 0;
81 81
82 virtual display::Display::Rotation GetRotation() = 0;
83
84 virtual float GetDeviceScaleFactor() = 0;
85
86 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; 82 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0;
87 virtual void SetImeVisibility(bool visible) = 0; 83 virtual void SetImeVisibility(bool visible) = 0;
88 84
89 // 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.
90 virtual bool IsFramePending() const = 0; 86 virtual bool IsFramePending() const = 0;
91 87
92 virtual void RequestCopyOfOutput( 88 virtual void RequestCopyOfOutput(
93 std::unique_ptr<cc::CopyOutputRequest> output_request) = 0; 89 std::unique_ptr<cc::CopyOutputRequest> output_request) = 0;
94 90
95 virtual gfx::Rect GetBounds() const = 0; 91 virtual gfx::Rect GetBounds() const = 0;
96 92
93 // Updates the viewport metrics for the display, returning true if any
94 // metrics have changed.
95 virtual bool UpdateViewportMetrics(
96 const display::ViewportMetrics& metrics) = 0;
97
98 virtual const display::ViewportMetrics& GetViewportMetrics() const = 0;
99
97 virtual bool IsPrimaryDisplay() const = 0; 100 virtual bool IsPrimaryDisplay() const = 0;
98 101
99 // Notifies the PlatformDisplay that a connection to the gpu has been 102 // Notifies the PlatformDisplay that a connection to the gpu has been
100 // established. 103 // established.
101 virtual void OnGpuChannelEstablished( 104 virtual void OnGpuChannelEstablished(
102 scoped_refptr<gpu::GpuChannelHost> gpu_channel) = 0; 105 scoped_refptr<gpu::GpuChannelHost> gpu_channel) = 0;
103 106
104 // Overrides factory for testing. Default (NULL) value indicates regular 107 // Overrides factory for testing. Default (NULL) value indicates regular
105 // (non-test) environment. 108 // (non-test) environment.
106 static void set_factory_for_testing(PlatformDisplayFactory* factory) { 109 static void set_factory_for_testing(PlatformDisplayFactory* factory) {
(...skipping 17 matching lines...) Expand all
124 // PlatformDisplay: 127 // PlatformDisplay:
125 void Init(PlatformDisplayDelegate* delegate) override; 128 void Init(PlatformDisplayDelegate* delegate) override;
126 int64_t GetId() const override; 129 int64_t GetId() const override;
127 void SchedulePaint(const ServerWindow* window, 130 void SchedulePaint(const ServerWindow* window,
128 const gfx::Rect& bounds) override; 131 const gfx::Rect& bounds) override;
129 void SetViewportSize(const gfx::Size& size) override; 132 void SetViewportSize(const gfx::Size& size) override;
130 void SetTitle(const base::string16& title) override; 133 void SetTitle(const base::string16& title) override;
131 void SetCapture() override; 134 void SetCapture() override;
132 void ReleaseCapture() override; 135 void ReleaseCapture() override;
133 void SetCursorById(mojom::Cursor cursor) override; 136 void SetCursorById(mojom::Cursor cursor) override;
134 float GetDeviceScaleFactor() override;
135 display::Display::Rotation GetRotation() override;
136 void UpdateTextInputState(const ui::TextInputState& state) override; 137 void UpdateTextInputState(const ui::TextInputState& state) override;
137 void SetImeVisibility(bool visible) override; 138 void SetImeVisibility(bool visible) override;
138 bool IsFramePending() const override; 139 bool IsFramePending() const override;
139 void RequestCopyOfOutput( 140 void RequestCopyOfOutput(
140 std::unique_ptr<cc::CopyOutputRequest> output_request) override; 141 std::unique_ptr<cc::CopyOutputRequest> output_request) override;
141 gfx::Rect GetBounds() const override; 142 gfx::Rect GetBounds() const override;
143 bool UpdateViewportMetrics(const display::ViewportMetrics& metrics) override;
144 const display::ViewportMetrics& GetViewportMetrics() const override;
142 bool IsPrimaryDisplay() const override; 145 bool IsPrimaryDisplay() const override;
143 void OnGpuChannelEstablished( 146 void OnGpuChannelEstablished(
144 scoped_refptr<gpu::GpuChannelHost> gpu_channel) override; 147 scoped_refptr<gpu::GpuChannelHost> gpu_channel) override;
145 148
146 private: 149 private:
147 void UpdateMetrics(const gfx::Rect& bounds,
148 const gfx::Size& pixel_size,
149 float device_scale_factor);
150
151 // Update the root_location of located events to be relative to the origin 150 // Update the root_location of located events to be relative to the origin
152 // of this display. For example, if the origin of this display is (1800, 0) 151 // of this display. For example, if the origin of this display is (1800, 0)
153 // and the location of the event is (100, 200) then the root_location will be 152 // and the location of the event is (100, 200) then the root_location will be
154 // updated to be (1900, 200). 153 // updated to be (1900, 200).
155 void UpdateEventRootLocation(ui::LocatedEvent* event); 154 void UpdateEventRootLocation(ui::LocatedEvent* event);
156 155
157 // ui::PlatformWindowDelegate: 156 // ui::PlatformWindowDelegate:
158 void OnBoundsChanged(const gfx::Rect& new_bounds) override; 157 void OnBoundsChanged(const gfx::Rect& new_bounds) override;
159 void OnDamageRect(const gfx::Rect& damaged_region) override; 158 void OnDamageRect(const gfx::Rect& damaged_region) override;
160 void DispatchEvent(ui::Event* event) override; 159 void DispatchEvent(ui::Event* event) override;
161 void OnCloseRequest() override; 160 void OnCloseRequest() override;
162 void OnClosed() override; 161 void OnClosed() override;
163 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; 162 void OnWindowStateChanged(ui::PlatformWindowState new_state) override;
164 void OnLostCapture() override; 163 void OnLostCapture() override;
165 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, 164 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
166 float device_scale_factor) override; 165 float device_scale_factor) override;
167 void OnAcceleratedWidgetDestroyed() override; 166 void OnAcceleratedWidgetDestroyed() override;
168 void OnActivationChanged(bool active) override; 167 void OnActivationChanged(bool active) override;
169 168
170 // FrameGeneratorDelegate: 169 // FrameGeneratorDelegate:
171 ServerWindow* GetRootWindow() override; 170 ServerWindow* GetRootWindow() override;
172 bool IsInHighContrastMode() override; 171 bool IsInHighContrastMode() override;
173 const ViewportMetrics& GetViewportMetrics() override;
174 172
175 int64_t id_; 173 int64_t id_;
176 174
177 #if !defined(OS_ANDROID) 175 #if !defined(OS_ANDROID)
178 std::unique_ptr<ui::CursorLoader> cursor_loader_; 176 std::unique_ptr<ui::CursorLoader> cursor_loader_;
179 #endif 177 #endif
180 178
181 PlatformDisplayDelegate* delegate_ = nullptr; 179 PlatformDisplayDelegate* delegate_ = nullptr;
182 std::unique_ptr<FrameGenerator> frame_generator_; 180 std::unique_ptr<FrameGenerator> frame_generator_;
183 181
184 ViewportMetrics metrics_; 182 display::ViewportMetrics metrics_;
185 std::unique_ptr<ui::PlatformWindow> platform_window_; 183 std::unique_ptr<ui::PlatformWindow> platform_window_;
186 184
187 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); 185 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay);
188 }; 186 };
189 187
190 } // namespace ws 188 } // namespace ws
191 189
192 } // namespace ui 190 } // namespace ui
193 191
194 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_H_ 192 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698