Chromium Code Reviews| Index: ui/aura/monitor_manager.cc |
| diff --git a/ui/aura/monitor_manager.cc b/ui/aura/monitor_manager.cc |
| index ee0bf5255a07c8b11d6ab79db3fffeecc9b4c50a..9cb40b803e528ae515840cd7570869d982072801 100644 |
| --- a/ui/aura/monitor_manager.cc |
| +++ b/ui/aura/monitor_manager.cc |
| @@ -6,11 +6,13 @@ |
| #include <stdio.h> |
| +#include "base/logging.h" |
| #include "ui/aura/env.h" |
| -#include "ui/aura/monitor.h" |
| +#include "ui/aura/monitor_aura.h" |
| #include "ui/aura/root_window.h" |
| #include "ui/aura/root_window_host.h" |
| #include "ui/gfx/rect.h" |
| +#include "ui/gfx/monitor_observer.h" |
| namespace aura { |
| namespace { |
| @@ -25,20 +27,28 @@ static const int kDefaultHostWindowHeight = 1024; |
| bool MonitorManager::use_fullscreen_host_window_ = false; |
| // static |
| -Monitor* MonitorManager::CreateMonitorFromSpec(const std::string& spec) { |
| +MonitorAura* MonitorManager::CreateMonitorFromSpec(const std::string& spec) { |
| gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY, |
| kDefaultHostWindowWidth, kDefaultHostWindowHeight); |
| int x = 0, y = 0, width, height; |
| - if (sscanf(spec.c_str(), "%dx%d", &width, &height) == 2) { |
| + float scale = 1.0f; |
| + if (sscanf(spec.c_str(), "%dx%d*%f", &width, &height, &scale) == 3) { |
|
Fady Samuel
2012/04/10 16:58:09
Where is this spec coming from? Are you reading th
oshima
2012/04/10 21:31:46
The value comes from --aura-host-window-size.
I wa
|
| bounds.set_size(gfx::Size(width, height)); |
| + } else if (sscanf(spec.c_str(), "%dx%d", &width, &height) == 2) { |
| + bounds.set_size(gfx::Size(width, height)); |
| + } else if (sscanf(spec.c_str(), "%d+%d-%dx%d*%f", &x, &y, &width, &height, |
| + &scale) |
| + == 5) { |
| + bounds = gfx::Rect(x, y, width, height); |
| } else if (sscanf(spec.c_str(), "%d+%d-%dx%d", &x, &y, &width, &height) |
| == 4) { |
| bounds = gfx::Rect(x, y, width, height); |
| } else if (use_fullscreen_host_window_) { |
| bounds = gfx::Rect(aura::RootWindowHost::GetNativeScreenSize()); |
| } |
| - Monitor* monitor = new Monitor(); |
| + MonitorAura* monitor = new MonitorAura(); |
| monitor->set_bounds(bounds); |
| + monitor->set_device_scale_factor(scale); |
| return monitor; |
| } |
| @@ -58,26 +68,26 @@ MonitorManager::MonitorManager() { |
| MonitorManager::~MonitorManager() { |
| } |
| -void MonitorManager::AddObserver(MonitorObserver* observer) { |
| +void MonitorManager::AddObserver(gfx::MonitorObserver* observer) { |
| observers_.AddObserver(observer); |
| } |
| -void MonitorManager::RemoveObserver(MonitorObserver* observer) { |
| +void MonitorManager::RemoveObserver(gfx::MonitorObserver* observer) { |
| observers_.RemoveObserver(observer); |
| } |
| -void MonitorManager::NotifyBoundsChanged(const Monitor* monitor) { |
| - FOR_EACH_OBSERVER(MonitorObserver, observers_, |
| +void MonitorManager::NotifyBoundsChanged(const gfx::Monitor* monitor) { |
| + FOR_EACH_OBSERVER(gfx::MonitorObserver, observers_, |
| OnMonitorBoundsChanged(monitor)); |
| } |
| -void MonitorManager::NotifyMonitorAdded(Monitor* monitor) { |
| - FOR_EACH_OBSERVER(MonitorObserver, observers_, |
| +void MonitorManager::NotifyMonitorAdded(gfx::Monitor* monitor) { |
| + FOR_EACH_OBSERVER(gfx::MonitorObserver, observers_, |
| OnMonitorAdded(monitor)); |
| } |
| -void MonitorManager::NotifyMonitorRemoved(const Monitor* monitor) { |
| - FOR_EACH_OBSERVER(MonitorObserver, observers_, |
| +void MonitorManager::NotifyMonitorRemoved(const gfx::Monitor* monitor) { |
| + FOR_EACH_OBSERVER(gfx::MonitorObserver, observers_, |
| OnMonitorRemoved(monitor)); |
| } |