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

Unified Diff: ash/common/wm/dock/docked_window_layout_manager.cc

Issue 2295003002: mash: Remove WmRootWindowControllerObserver. (Closed)
Patch Set: Cleanup. Created 4 years, 4 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
Index: ash/common/wm/dock/docked_window_layout_manager.cc
diff --git a/ash/common/wm/dock/docked_window_layout_manager.cc b/ash/common/wm/dock/docked_window_layout_manager.cc
index 6905634707b437bfcd36d677b68afa1b4206eb26..816535334547f62a470549609f4af1b2b7a4b09b 100644
--- a/ash/common/wm/dock/docked_window_layout_manager.cc
+++ b/ash/common/wm/dock/docked_window_layout_manager.cc
@@ -29,6 +29,7 @@
#include "ui/compositor/paint_recorder.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/display/display.h"
+#include "ui/display/screen.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/views/background.h"
@@ -432,7 +433,7 @@ DockedWindowLayoutManager::DockedWindowLayoutManager(WmWindow* dock_container)
DCHECK(dock_container);
dock_container_->GetShell()->AddShellObserver(this);
dock_container->GetShell()->AddActivationObserver(this);
- root_window_controller_->AddObserver(this);
+ display::Screen::GetScreen()->AddObserver(this);
}
DockedWindowLayoutManager::~DockedWindowLayoutManager() {
@@ -460,7 +461,7 @@ void DockedWindowLayoutManager::Shutdown() {
}
dock_container_->GetShell()->RemoveActivationObserver(this);
dock_container_->GetShell()->RemoveShellObserver(this);
- root_window_controller_->RemoveObserver(this);
+ display::Screen::GetScreen()->RemoveObserver(this);
}
void DockedWindowLayoutManager::AddObserver(
@@ -770,32 +771,16 @@ void DockedWindowLayoutManager::SetChildBounds(
}
////////////////////////////////////////////////////////////////////////////////
-// DockedWindowLayoutManager, WmRootWindowControllerObserver implementation:
+// DockedWindowLayoutManager, display::DisplayObserver implementation:
-void DockedWindowLayoutManager::OnWorkAreaChanged() {
+void DockedWindowLayoutManager::OnDisplayMetricsChanged(
+ const display::Display& display,
+ uint32_t changed_metrics) {
Relayout();
sky 2016/08/31 16:04:30 Should this early out if display id is not the sam
msw 2016/08/31 17:07:32 Done. I did in the prior patch set, but the old co
sky 2016/08/31 17:45:41 The reason the old code didn't need to is because
msw 2016/08/31 17:55:29 AFAICT, that's not true. Each WmRootWindowControll
UpdateDockBounds(DockedWindowLayoutManagerObserver::DISPLAY_INSETS_CHANGED);
MaybeMinimizeChildrenExcept(dragged_window_);
}
-void DockedWindowLayoutManager::OnShelfAlignmentChanged() {
- if (!shelf_ || alignment_ == DOCKED_ALIGNMENT_NONE)
- return;
-
- // Do not allow shelf and dock on the same side. Switch side that
- // the dock is attached to and move all dock windows to that new side.
- ShelfAlignment shelf_alignment = shelf_->GetAlignment();
- if (alignment_ == DOCKED_ALIGNMENT_LEFT &&
- shelf_alignment == SHELF_ALIGNMENT_LEFT) {
- alignment_ = DOCKED_ALIGNMENT_RIGHT;
- } else if (alignment_ == DOCKED_ALIGNMENT_RIGHT &&
- shelf_alignment == SHELF_ALIGNMENT_RIGHT) {
- alignment_ = DOCKED_ALIGNMENT_LEFT;
- }
- Relayout();
- UpdateDockBounds(DockedWindowLayoutManagerObserver::SHELF_ALIGNMENT_CHANGED);
-}
-
/////////////////////////////////////////////////////////////////////////////
// DockedWindowLayoutManager, WindowStateObserver implementation:
@@ -892,6 +877,23 @@ void DockedWindowLayoutManager::OnWindowActivated(WmWindow* gained_active,
// DockedWindowLayoutManager, ShellObserver implementation:
void DockedWindowLayoutManager::OnShelfAlignmentChanged(WmWindow* root_window) {
+ if (!shelf_ || alignment_ == DOCKED_ALIGNMENT_NONE ||
+ root_window != shelf_->GetWindow()->GetRootWindow()) {
+ return;
+ }
+
+ // Do not allow shelf and dock on the same side. Switch side that
+ // the dock is attached to and move all dock windows to that new side.
+ ShelfAlignment shelf_alignment = shelf_->GetAlignment();
+ if (alignment_ == DOCKED_ALIGNMENT_LEFT &&
+ shelf_alignment == SHELF_ALIGNMENT_LEFT) {
+ alignment_ = DOCKED_ALIGNMENT_RIGHT;
+ } else if (alignment_ == DOCKED_ALIGNMENT_RIGHT &&
+ shelf_alignment == SHELF_ALIGNMENT_RIGHT) {
+ alignment_ = DOCKED_ALIGNMENT_LEFT;
+ }
+ Relayout();
+ UpdateDockBounds(DockedWindowLayoutManagerObserver::SHELF_ALIGNMENT_CHANGED);
}
void DockedWindowLayoutManager::OnFullscreenStateChanged(

Powered by Google App Engine
This is Rietveld 408576698