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

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

Issue 2434923002: Handle modified displays in mustash. (Closed)
Patch Set: Fix PlatformScreenStub for tests. 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
« no previous file with comments | « services/ui/ws/frame_generator_delegate.h ('k') | services/ui/ws/platform_display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 gfx::Rect GetBounds() const = 0; 88 virtual gfx::Rect GetBounds() const = 0;
93 89
90 // Updates the viewport metrics for the display, returning true if any
91 // metrics have changed.
92 virtual bool UpdateViewportMetrics(
93 const display::ViewportMetrics& metrics) = 0;
94
95 virtual const display::ViewportMetrics& GetViewportMetrics() const = 0;
96
94 virtual bool IsPrimaryDisplay() const = 0; 97 virtual bool IsPrimaryDisplay() const = 0;
95 98
96 // Notifies the PlatformDisplay that a connection to the gpu has been 99 // Notifies the PlatformDisplay that a connection to the gpu has been
97 // established. 100 // established.
98 virtual void OnGpuChannelEstablished( 101 virtual void OnGpuChannelEstablished(
99 scoped_refptr<gpu::GpuChannelHost> gpu_channel) = 0; 102 scoped_refptr<gpu::GpuChannelHost> gpu_channel) = 0;
100 103
101 // Overrides factory for testing. Default (NULL) value indicates regular 104 // Overrides factory for testing. Default (NULL) value indicates regular
102 // (non-test) environment. 105 // (non-test) environment.
103 static void set_factory_for_testing(PlatformDisplayFactory* factory) { 106 static void set_factory_for_testing(PlatformDisplayFactory* factory) {
(...skipping 17 matching lines...) Expand all
121 // PlatformDisplay: 124 // PlatformDisplay:
122 void Init(PlatformDisplayDelegate* delegate) override; 125 void Init(PlatformDisplayDelegate* delegate) override;
123 int64_t GetId() const override; 126 int64_t GetId() const override;
124 void SchedulePaint(const ServerWindow* window, 127 void SchedulePaint(const ServerWindow* window,
125 const gfx::Rect& bounds) override; 128 const gfx::Rect& bounds) override;
126 void SetViewportSize(const gfx::Size& size) override; 129 void SetViewportSize(const gfx::Size& size) override;
127 void SetTitle(const base::string16& title) override; 130 void SetTitle(const base::string16& title) override;
128 void SetCapture() override; 131 void SetCapture() override;
129 void ReleaseCapture() override; 132 void ReleaseCapture() override;
130 void SetCursorById(mojom::Cursor cursor) override; 133 void SetCursorById(mojom::Cursor cursor) override;
131 float GetDeviceScaleFactor() override;
132 display::Display::Rotation GetRotation() override;
133 void UpdateTextInputState(const ui::TextInputState& state) override; 134 void UpdateTextInputState(const ui::TextInputState& state) override;
134 void SetImeVisibility(bool visible) override; 135 void SetImeVisibility(bool visible) override;
135 bool IsFramePending() const override; 136 bool IsFramePending() const override;
136 gfx::Rect GetBounds() const override; 137 gfx::Rect GetBounds() const override;
138 bool UpdateViewportMetrics(const display::ViewportMetrics& metrics) override;
139 const display::ViewportMetrics& GetViewportMetrics() const override;
137 bool IsPrimaryDisplay() const override; 140 bool IsPrimaryDisplay() const override;
138 void OnGpuChannelEstablished( 141 void OnGpuChannelEstablished(
139 scoped_refptr<gpu::GpuChannelHost> gpu_channel) override; 142 scoped_refptr<gpu::GpuChannelHost> gpu_channel) override;
140 143
141 private: 144 private:
142 void UpdateMetrics(const gfx::Rect& bounds,
143 const gfx::Size& pixel_size,
144 float device_scale_factor);
145
146 // Update the root_location of located events to be relative to the origin 145 // Update the root_location of located events to be relative to the origin
147 // of this display. For example, if the origin of this display is (1800, 0) 146 // of this display. For example, if the origin of this display is (1800, 0)
148 // and the location of the event is (100, 200) then the root_location will be 147 // and the location of the event is (100, 200) then the root_location will be
149 // updated to be (1900, 200). 148 // updated to be (1900, 200).
150 void UpdateEventRootLocation(ui::LocatedEvent* event); 149 void UpdateEventRootLocation(ui::LocatedEvent* event);
151 150
152 // ui::PlatformWindowDelegate: 151 // ui::PlatformWindowDelegate:
153 void OnBoundsChanged(const gfx::Rect& new_bounds) override; 152 void OnBoundsChanged(const gfx::Rect& new_bounds) override;
154 void OnDamageRect(const gfx::Rect& damaged_region) override; 153 void OnDamageRect(const gfx::Rect& damaged_region) override;
155 void DispatchEvent(ui::Event* event) override; 154 void DispatchEvent(ui::Event* event) override;
156 void OnCloseRequest() override; 155 void OnCloseRequest() override;
157 void OnClosed() override; 156 void OnClosed() override;
158 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; 157 void OnWindowStateChanged(ui::PlatformWindowState new_state) override;
159 void OnLostCapture() override; 158 void OnLostCapture() override;
160 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, 159 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
161 float device_scale_factor) override; 160 float device_scale_factor) override;
162 void OnAcceleratedWidgetDestroyed() override; 161 void OnAcceleratedWidgetDestroyed() override;
163 void OnActivationChanged(bool active) override; 162 void OnActivationChanged(bool active) override;
164 163
165 // FrameGeneratorDelegate: 164 // FrameGeneratorDelegate:
166 ServerWindow* GetRootWindow() override; 165 ServerWindow* GetRootWindow() override;
167 bool IsInHighContrastMode() override; 166 bool IsInHighContrastMode() override;
168 const ViewportMetrics& GetViewportMetrics() override;
169 167
170 int64_t id_; 168 int64_t id_;
171 169
172 #if !defined(OS_ANDROID) 170 #if !defined(OS_ANDROID)
173 std::unique_ptr<ui::CursorLoader> cursor_loader_; 171 std::unique_ptr<ui::CursorLoader> cursor_loader_;
174 #endif 172 #endif
175 173
176 PlatformDisplayDelegate* delegate_ = nullptr; 174 PlatformDisplayDelegate* delegate_ = nullptr;
177 std::unique_ptr<FrameGenerator> frame_generator_; 175 std::unique_ptr<FrameGenerator> frame_generator_;
178 176
179 ViewportMetrics metrics_; 177 display::ViewportMetrics metrics_;
180 std::unique_ptr<ui::PlatformWindow> platform_window_; 178 std::unique_ptr<ui::PlatformWindow> platform_window_;
181 179
182 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); 180 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay);
183 }; 181 };
184 182
185 } // namespace ws 183 } // namespace ws
186 184
187 } // namespace ui 185 } // namespace ui
188 186
189 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_H_ 187 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_H_
OLDNEW
« no previous file with comments | « services/ui/ws/frame_generator_delegate.h ('k') | services/ui/ws/platform_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698