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

Unified Diff: ash/monitor/monitor_controller.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 | « ash/monitor/monitor_controller.h ('k') | ash/monitor/multi_monitor_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/monitor/monitor_controller.cc
diff --git a/ash/monitor/monitor_controller.cc b/ash/monitor/monitor_controller.cc
index 3ebfea4877601869e060c759a113a21eda047e24..145fa67658f2bf4216526d321d7e552fe178344f 100644
--- a/ash/monitor/monitor_controller.cc
+++ b/ash/monitor/monitor_controller.cc
@@ -13,9 +13,9 @@
#include "base/stl_util.h"
#include "base/time.h"
#include "ui/aura/env.h"
-#include "ui/aura/monitor.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
+#include "ui/gfx/monitor.h"
namespace ash {
namespace internal {
@@ -46,38 +46,38 @@ MonitorController::MonitorController() {
MonitorController::~MonitorController() {
aura::Env::GetInstance()->monitor_manager()->RemoveObserver(this);
// Remove the root first.
- aura::Monitor* monitor = Shell::GetRootWindow()->GetProperty(kMonitorKey);
- DCHECK(monitor);
- root_windows_.erase(monitor);
+ int monitor_id = Shell::GetRootWindow()->GetProperty(kMonitorIdKey);
+ DCHECK(monitor_id >= 0);
+ root_windows_.erase(monitor_id);
STLDeleteContainerPairSecondPointers(
root_windows_.begin(), root_windows_.end());
}
-void MonitorController::OnMonitorBoundsChanged(const aura::Monitor* monitor) {
- root_windows_[monitor]->SetHostBounds(monitor->bounds());
+void MonitorController::OnMonitorBoundsChanged(const gfx::Monitor& monitor) {
+ root_windows_[monitor.id()]->SetHostBounds(monitor.bounds());
}
-void MonitorController::OnMonitorAdded(aura::Monitor* monitor) {
+void MonitorController::OnMonitorAdded(const gfx::Monitor& monitor) {
if (root_windows_.empty()) {
- root_windows_[monitor] = Shell::GetRootWindow();
- Shell::GetRootWindow()->SetHostBounds(monitor->bounds());
+ root_windows_[monitor.id()] = Shell::GetRootWindow();
+ Shell::GetRootWindow()->SetHostBounds(monitor.bounds());
return;
}
aura::RootWindow* root = aura::Env::GetInstance()->monitor_manager()->
CreateRootWindowForMonitor(monitor);
- root_windows_[monitor] = root;
+ root_windows_[monitor.id()] = root;
SetupAsSecondaryMonitor(root);
}
-void MonitorController::OnMonitorRemoved(const aura::Monitor* monitor) {
- aura::RootWindow* root = root_windows_[monitor];
+void MonitorController::OnMonitorRemoved(const gfx::Monitor& monitor) {
+ aura::RootWindow* root = root_windows_[monitor.id()];
DCHECK(root);
// Primary monitor should never be removed by MonitorManager.
DCHECK(root != Shell::GetRootWindow());
// Monitor for root window will be deleted when the Primary RootWindow
// is deleted by the Shell.
if (root != Shell::GetRootWindow()) {
- root_windows_.erase(monitor);
+ root_windows_.erase(monitor.id());
delete root;
}
}
@@ -86,16 +86,15 @@ void MonitorController::Init() {
aura::MonitorManager* monitor_manager =
aura::Env::GetInstance()->monitor_manager();
for (size_t i = 0; i < monitor_manager->GetNumMonitors(); ++i) {
- aura::Monitor* monitor = monitor_manager->GetMonitorAt(i);
- const aura::Monitor* key = monitor;
+ const gfx::Monitor& monitor = monitor_manager->GetMonitorAt(i);
if (i == 0) {
// Primary monitor
- root_windows_[key] = Shell::GetRootWindow();
- Shell::GetRootWindow()->SetHostBounds(monitor->bounds());
+ root_windows_[monitor.id()] = Shell::GetRootWindow();
+ Shell::GetRootWindow()->SetHostBounds(monitor.bounds());
} else {
aura::RootWindow* root =
monitor_manager->CreateRootWindowForMonitor(monitor);
- root_windows_[key] = root;
+ root_windows_[monitor.id()] = root;
SetupAsSecondaryMonitor(root);
}
}
« no previous file with comments | « ash/monitor/monitor_controller.h ('k') | ash/monitor/multi_monitor_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698