Chromium Code Reviews| Index: ui/gfx/monitor.cc |
| diff --git a/ui/gfx/monitor.cc b/ui/gfx/monitor.cc |
| index 242abced7e2eb00fae2f4854eb3e2ba2d8a30371..d87d9dc1defe534a67fe20b3d13ee3120e20cbd6 100644 |
| --- a/ui/gfx/monitor.cc |
| +++ b/ui/gfx/monitor.cc |
| @@ -4,22 +4,51 @@ |
| #include "ui/gfx/monitor.h" |
| -#include "ui/gfx/insets.h" |
| +#include "base/command_line.h" |
| +#include "base/string_number_conversions.h" |
| #include "base/stringprintf.h" |
| +#include "ui/gfx/gfx_switches.h" |
| +#include "ui/gfx/insets.h" |
| namespace gfx { |
| +namespace { |
| + |
| +float GetDefaultDeviceScaleFactorImpl() { |
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + if (command_line.HasSwitch(switches::kDefaultDeviceScaleFactor)) { |
| + double scale_in_double; |
| + base::StringToDouble( |
|
sadrul
2012/04/30 18:57:00
Check the return value of StringToDouble?
oshima
2012/04/30 19:41:14
Done.
|
| + command_line.GetSwitchValueASCII(switches::kDefaultDeviceScaleFactor), |
| + &scale_in_double); |
| + return static_cast<float>(scale_in_double); |
| + } |
| + return 1.0f; |
| +} |
| -Monitor::Monitor() : id_(-1), device_scale_factor_(1.0) { |
| +} // namespace |
| + |
| +// static |
| +float Monitor::GetDefaultDeviceScaleFactor() { |
| + static float default_device_scale_factor = |
| + GetDefaultDeviceScaleFactorImpl(); |
| + return default_device_scale_factor; |
| +} |
| + |
| +Monitor::Monitor() |
| + : id_(-1), |
| + device_scale_factor_(GetDefaultDeviceScaleFactor()) { |
| } |
| -Monitor::Monitor(int id) : id_(id), device_scale_factor_(1.0) { |
| +Monitor::Monitor(int id) |
| + : id_(id), |
| + device_scale_factor_(GetDefaultDeviceScaleFactor()) { |
| } |
| Monitor::Monitor(int id, const gfx::Rect& bounds) |
| : id_(id), |
| bounds_(bounds), |
| work_area_(bounds), |
| - device_scale_factor_(1.0) { |
| + device_scale_factor_(GetDefaultDeviceScaleFactor()) { |
| #if defined(USE_ASH) |
| SetScaleAndBounds(device_scale_factor_, bounds); |
| #endif |