| 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 #include "services/ui/display/viewport_metrics.h" | 5 #include "services/ui/display/viewport_metrics.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 | 8 |
| 9 namespace display { | 9 namespace display { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 std::string TouchSupportString(Display::TouchSupport touch_support) { |
| 14 switch (touch_support) { |
| 15 case Display::TOUCH_SUPPORT_UNKNOWN: |
| 16 return "unknown"; |
| 17 case Display::TOUCH_SUPPORT_AVAILABLE: |
| 18 return "available"; |
| 19 case Display::TOUCH_SUPPORT_UNAVAILABLE: |
| 20 return "unavailable"; |
| 21 } |
| 22 NOTREACHED(); |
| 23 return "Invalid TouchSupport"; |
| 24 } |
| 25 |
| 13 std::string RotationString(Display::Rotation rotation) { | 26 std::string RotationString(Display::Rotation rotation) { |
| 14 switch (rotation) { | 27 switch (rotation) { |
| 15 case Display::ROTATE_0: | 28 case Display::ROTATE_0: |
| 16 return "0"; | 29 return "0"; |
| 17 case Display::ROTATE_90: | 30 case Display::ROTATE_90: |
| 18 return "90"; | 31 return "90"; |
| 19 case Display::ROTATE_180: | 32 case Display::ROTATE_180: |
| 20 return "180"; | 33 return "180"; |
| 21 case Display::ROTATE_270: | 34 case Display::ROTATE_270: |
| 22 return "270"; | 35 return "270"; |
| 23 } | 36 } |
| 24 NOTREACHED(); | 37 NOTREACHED(); |
| 25 return "Invalid Rotation"; | 38 return "Invalid Rotation"; |
| 26 } | 39 } |
| 27 | 40 |
| 28 } // namespace | 41 } // namespace |
| 29 | 42 |
| 30 std::string ViewportMetrics::ToString() const { | 43 std::string ViewportMetrics::ToString() const { |
| 31 return base::StringPrintf( | 44 return base::StringPrintf( |
| 32 "ViewportMetrics(bounds=%s, work_area=%s, pixel_size=%s, " | 45 "ViewportMetrics(bounds=%s, work_area=%s, pixel_size=%s, " |
| 33 "rotation=%s, device_scale_factor=%g)", | 46 "rotation=%s, touch_support=%s, " |
| 47 "device_scale_factor=%g, ui_scale_factor=%g)", |
| 34 bounds.ToString().c_str(), work_area.ToString().c_str(), | 48 bounds.ToString().c_str(), work_area.ToString().c_str(), |
| 35 pixel_size.ToString().c_str(), RotationString(rotation).c_str(), | 49 pixel_size.ToString().c_str(), RotationString(rotation).c_str(), |
| 36 device_scale_factor); | 50 TouchSupportString(touch_support).c_str(), device_scale_factor, |
| 51 ui_scale_factor); |
| 37 } | 52 } |
| 38 | 53 |
| 39 } // namespace display | 54 } // namespace display |
| OLD | NEW |