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

Unified Diff: ash/monitor/monitor_controller.cc

Issue 9837046: Revert r128507 "Revert r128436 "relanding: disabled workspace_window_resizer test. fixed access-aft… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 f079776a9f6dbb6e17189a66709834dc8447ae1e..397e5abb1f65f2414046aac49b6392d892909922 100644
--- a/ash/monitor/monitor_controller.cc
+++ b/ash/monitor/monitor_controller.cc
@@ -9,7 +9,9 @@
#include "ash/shell.h"
#include "ash/wm/base_layout_manager.h"
#include "ash/wm/root_window_layout_manager.h"
+#include "base/bind.h"
#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"
@@ -21,14 +23,16 @@ namespace internal {
namespace {
void SetupAsSecondaryMonitor(aura::RootWindow* root) {
+ root->SetFocusWhenShown(false);
root->SetLayoutManager(new internal::RootWindowLayoutManager(root));
aura::Window* container = new aura::Window(NULL);
container->SetName("SecondaryMonitorContainer");
container->Init(ui::LAYER_NOT_DRAWN);
root->AddChild(container);
- container->Show();
container->SetLayoutManager(new internal::BaseLayoutManager(root));
CreateSecondaryMonitorWidget(container);
+ container->Show();
+ root->layout_manager()->OnWindowResized();
root->ShowRootWindow();
}
@@ -43,14 +47,27 @@ 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);
STLDeleteContainerPairSecondPointers(
root_windows_.begin(), root_windows_.end());
}
void MonitorController::OnMonitorBoundsChanged(const aura::Monitor* monitor) {
- if (aura::MonitorManager::use_fullscreen_host_window())
- root_windows_[monitor]->SetHostBounds(monitor->bounds());
+ root_windows_[monitor]->SetHostBounds(monitor->bounds());
+}
+
+void MonitorController::OnMonitorAdded(aura::Monitor* monitor) {
+ aura::RootWindow* root = aura::Env::GetInstance()->monitor_manager()->
+ CreateRootWindowForMonitor(monitor);
+ root_windows_[monitor] = root;
+ SetupAsSecondaryMonitor(root);
+}
+
+void MonitorController::OnMonitorRemoved(const aura::Monitor* monitor) {
+ aura::RootWindow* root = root_windows_[monitor];
+ root_windows_.erase(monitor);
+ delete root;
}
void MonitorController::Init() {
@@ -62,6 +79,7 @@ void MonitorController::Init() {
if (i == 0) {
// Primary monitor
root_windows_[key] = Shell::GetRootWindow();
+ Shell::GetRootWindow()->SetHostBounds(monitor->bounds());
} else {
aura::RootWindow* root =
monitor_manager->CreateRootWindowForMonitor(monitor);
« 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