Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: ui/aura/monitor_manager.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/monitor_manager.h ('k') | ui/aura/monitor_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/monitor_manager.cc
diff --git a/ui/aura/monitor_manager.cc b/ui/aura/monitor_manager.cc
index c884c6ddf1a0b3d77fcf61d612695968e1d6362e..8cf70bc8e5b8bdf66ca381fa42d7f8e456659e5d 100644
--- a/ui/aura/monitor_manager.cc
+++ b/ui/aura/monitor_manager.cc
@@ -8,9 +8,10 @@
#include "base/logging.h"
#include "ui/aura/env.h"
-#include "ui/aura/monitor.h"
+#include "ui/aura/monitor_observer.h"
#include "ui/aura/root_window.h"
#include "ui/aura/root_window_host.h"
+#include "ui/gfx/monitor.h"
#include "ui/gfx/rect.h"
namespace aura {
@@ -26,7 +27,8 @@ static const int kDefaultHostWindowHeight = 1024;
bool MonitorManager::use_fullscreen_host_window_ = false;
// static
-Monitor* MonitorManager::CreateMonitorFromSpec(const std::string& spec) {
+gfx::Monitor MonitorManager::CreateMonitorFromSpec(const std::string& spec) {
+ static int synthesized_monitor_id = 1000;
gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY,
kDefaultHostWindowWidth, kDefaultHostWindowHeight);
int x = 0, y = 0, width, height;
@@ -39,9 +41,8 @@ Monitor* MonitorManager::CreateMonitorFromSpec(const std::string& spec) {
} else if (use_fullscreen_host_window_) {
bounds = gfx::Rect(aura::RootWindowHost::GetNativeScreenSize());
}
- Monitor* monitor = new Monitor();
- monitor->set_bounds(bounds);
- monitor->set_device_scale_factor(scale);
+ gfx::Monitor monitor(synthesized_monitor_id++, bounds);
+ monitor.set_device_scale_factor(scale);
DVLOG(1) << "Monitor bounds=" << bounds.ToString() << ", scale=" << scale;
return monitor;
}
@@ -70,17 +71,17 @@ void MonitorManager::RemoveObserver(MonitorObserver* observer) {
observers_.RemoveObserver(observer);
}
-void MonitorManager::NotifyBoundsChanged(const Monitor* monitor) {
+void MonitorManager::NotifyBoundsChanged(const gfx::Monitor& monitor) {
FOR_EACH_OBSERVER(MonitorObserver, observers_,
OnMonitorBoundsChanged(monitor));
}
-void MonitorManager::NotifyMonitorAdded(Monitor* monitor) {
+void MonitorManager::NotifyMonitorAdded(const gfx::Monitor& monitor) {
FOR_EACH_OBSERVER(MonitorObserver, observers_,
OnMonitorAdded(monitor));
}
-void MonitorManager::NotifyMonitorRemoved(const Monitor* monitor) {
+void MonitorManager::NotifyMonitorRemoved(const gfx::Monitor& monitor) {
FOR_EACH_OBSERVER(MonitorObserver, observers_,
OnMonitorRemoved(monitor));
}
« no previous file with comments | « ui/aura/monitor_manager.h ('k') | ui/aura/monitor_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698