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 #include "ui/display/chromeos/output_configurator.h" | 5 #include "ui/display/chromeos/output_configurator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "ui/display/chromeos/display_mode.h" | 13 #include "ui/display/chromeos/display_mode.h" |
14 #include "ui/display/chromeos/display_snapshot.h" | 14 #include "ui/display/chromeos/display_snapshot.h" |
| 15 #include "ui/display/chromeos/native_display_delegate.h" |
| 16 |
| 17 #if defined(USE_OZONE) |
| 18 #include "ui/display/chromeos/ozone/native_display_delegate_ozone.h" |
| 19 #include "ui/display/chromeos/ozone/touchscreen_delegate_ozone.h" |
| 20 #elif defined(USE_X11) |
15 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" | 21 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" |
16 #include "ui/display/chromeos/x11/touchscreen_delegate_x11.h" | 22 #include "ui/display/chromeos/x11/touchscreen_delegate_x11.h" |
| 23 #endif |
17 | 24 |
18 namespace ui { | 25 namespace ui { |
19 | 26 |
20 namespace { | 27 namespace { |
21 | 28 |
22 typedef std::vector<const DisplayMode*> DisplayModeList; | 29 typedef std::vector<const DisplayMode*> DisplayModeList; |
23 | 30 |
24 // The delay to perform configuration after RRNotify. See the comment | 31 // The delay to perform configuration after RRNotify. See the comment |
25 // in |Dispatch()|. | 32 // in |Dispatch()|. |
26 const int kConfigureDelayMs = 500; | 33 const int kConfigureDelayMs = 500; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 DCHECK_EQ(output_state_, OUTPUT_STATE_INVALID); | 189 DCHECK_EQ(output_state_, OUTPUT_STATE_INVALID); |
183 power_state_ = power_state; | 190 power_state_ = power_state; |
184 } | 191 } |
185 | 192 |
186 void OutputConfigurator::Init(bool is_panel_fitting_enabled) { | 193 void OutputConfigurator::Init(bool is_panel_fitting_enabled) { |
187 is_panel_fitting_enabled_ = is_panel_fitting_enabled; | 194 is_panel_fitting_enabled_ = is_panel_fitting_enabled; |
188 if (!configure_display_) | 195 if (!configure_display_) |
189 return; | 196 return; |
190 | 197 |
191 if (!native_display_delegate_) { | 198 if (!native_display_delegate_) { |
| 199 #if defined(USE_OZONE) |
| 200 native_display_delegate_.reset(new NativeDisplayDelegateOzone()); |
| 201 #elif defined(USE_X11) |
192 native_display_delegate_.reset(new NativeDisplayDelegateX11()); | 202 native_display_delegate_.reset(new NativeDisplayDelegateX11()); |
| 203 #else |
| 204 NOTREACHED(); |
| 205 #endif |
193 native_display_delegate_->AddObserver(this); | 206 native_display_delegate_->AddObserver(this); |
194 } | 207 } |
195 | 208 |
196 if (!touchscreen_delegate_) | 209 if (!touchscreen_delegate_) { |
| 210 #if defined(USE_OZONE) |
| 211 touchscreen_delegate_.reset(new TouchscreenDelegateOzone()); |
| 212 #elif defined(USE_X11) |
197 touchscreen_delegate_.reset(new TouchscreenDelegateX11()); | 213 touchscreen_delegate_.reset(new TouchscreenDelegateX11()); |
| 214 #else |
| 215 NOTREACHED(); |
| 216 #endif |
| 217 } |
198 } | 218 } |
199 | 219 |
200 void OutputConfigurator::ForceInitialConfigure(uint32_t background_color_argb) { | 220 void OutputConfigurator::ForceInitialConfigure(uint32_t background_color_argb) { |
201 if (!configure_display_) | 221 if (!configure_display_) |
202 return; | 222 return; |
203 | 223 |
204 native_display_delegate_->GrabServer(); | 224 native_display_delegate_->GrabServer(); |
205 native_display_delegate_->Initialize(); | 225 native_display_delegate_->Initialize(); |
206 | 226 |
207 UpdateCachedOutputs(); | 227 UpdateCachedOutputs(); |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 float width_ratio = static_cast<float>(mirror_mode_info->size().width()) / | 1044 float width_ratio = static_cast<float>(mirror_mode_info->size().width()) / |
1025 static_cast<float>(native_mode_info->size().width()); | 1045 static_cast<float>(native_mode_info->size().width()); |
1026 float height_ratio = static_cast<float>(mirror_mode_info->size().height()) / | 1046 float height_ratio = static_cast<float>(mirror_mode_info->size().height()) / |
1027 static_cast<float>(native_mode_info->size().height()); | 1047 static_cast<float>(native_mode_info->size().height()); |
1028 | 1048 |
1029 area_ratio = width_ratio * height_ratio; | 1049 area_ratio = width_ratio * height_ratio; |
1030 return area_ratio; | 1050 return area_ratio; |
1031 } | 1051 } |
1032 | 1052 |
1033 } // namespace ui | 1053 } // namespace ui |
OLD | NEW |