Chromium Code Reviews| Index: ui/aura/monitor_manager.cc |
| diff --git a/ui/aura/monitor_manager.cc b/ui/aura/monitor_manager.cc |
| index 00535ce4bf0401e62c45bb72f4fc905f2a55435b..ffedb0dd5c7b5686eaf29654de3a5268394bc4bc 100644 |
| --- a/ui/aura/monitor_manager.cc |
| +++ b/ui/aura/monitor_manager.cc |
| @@ -6,8 +6,11 @@ |
| #include <stdio.h> |
| +#include "base/command_line.h" |
| #include "base/logging.h" |
| +#include "base/string_number_conversions.h" |
| #include "ui/aura/env.h" |
| +#include "ui/aura/aura_switches.h" |
| #include "ui/aura/monitor_observer.h" |
| #include "ui/aura/root_window.h" |
| #include "ui/aura/root_window_host.h" |
| @@ -27,12 +30,13 @@ static const int kDefaultHostWindowHeight = 1024; |
| bool MonitorManager::use_fullscreen_host_window_ = false; |
| // static |
| -gfx::Monitor MonitorManager::CreateMonitorFromSpec(const std::string& spec) { |
| +gfx::Monitor MonitorManager::CreateMonitorFromSpec( |
| + float device_scale_factor, const std::string& spec) { |
|
sadrul
2012/04/30 15:15:49
one param in a line
|
| static int synthesized_monitor_id = 1000; |
| gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY, |
| kDefaultHostWindowWidth, kDefaultHostWindowHeight); |
| int x = 0, y = 0, width, height; |
| - float scale = 1.0f; |
| + float scale = device_scale_factor; |
| if (sscanf(spec.c_str(), "%dx%d*%f", &width, &height, &scale) >= 2) { |
| bounds.set_size(gfx::Size(width, height)); |
| } else if (sscanf(spec.c_str(), "%d+%d-%dx%d*%f", &x, &y, &width, &height, |
| @@ -57,7 +61,16 @@ RootWindow* MonitorManager::CreateRootWindowForPrimaryMonitor() { |
| return root; |
| } |
| -MonitorManager::MonitorManager() { |
| +MonitorManager::MonitorManager() : default_device_scale_factor_(1.0f) { |
| + |
|
sadrul
2012/04/30 15:15:49
-newline
|
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + if (command_line.HasSwitch(switches::kDefaultDeviceScaleFactor)) { |
| + double scale_in_double; |
| + base::StringToDouble( |
| + command_line.GetSwitchValueASCII(switches::kDefaultDeviceScaleFactor), |
| + &scale_in_double); |
| + default_device_scale_factor_ = static_cast<float>(scale_in_double); |
| + } |
| } |
| MonitorManager::~MonitorManager() { |