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

Unified Diff: ash/wm/aura/wm_shelf_aura.cc

Issue 1929023002: Refactors WindowResizers to use ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: ash/wm/aura/wm_shelf_aura.cc
diff --git a/ash/wm/aura/wm_shelf_aura.cc b/ash/wm/aura/wm_shelf_aura.cc
index f4145861ccc9d048b9af6e2be712d79fe558a9ae..a9048a1bfc6899cb10021c0ad9e45b924500e082 100644
--- a/ash/wm/aura/wm_shelf_aura.cc
+++ b/ash/wm/aura/wm_shelf_aura.cc
@@ -6,6 +6,7 @@
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager.h"
+#include "ash/wm/aura/wm_window_aura.h"
#include "ash/wm/common/shelf/wm_shelf_observer.h"
#include "ash/wm/common/wm_window.h"
#include "ui/views/widget/widget.h"
@@ -16,22 +17,29 @@ namespace wm {
WmShelfAura::WmShelfAura(Shelf* shelf)
: shelf_(shelf), shelf_layout_manager_(shelf->shelf_layout_manager()) {
shelf_layout_manager_->AddObserver(this);
+ shelf_->AddIconObserver(this);
}
WmShelfAura::~WmShelfAura() {
+ shelf_->RemoveIconObserver(this);
if (shelf_layout_manager_)
shelf_layout_manager_->RemoveObserver(this);
}
+// static
+Shelf* WmShelfAura::GetShelf(WmShelf* shelf) {
+ return static_cast<WmShelfAura*>(shelf)->shelf_;
+}
+
WmWindow* WmShelfAura::GetWindow() {
return WmWindow::Get(shelf_->shelf_widget());
}
-ShelfAlignment WmShelfAura::GetAlignment() {
+ShelfAlignment WmShelfAura::GetAlignment() const {
return shelf_->alignment();
}
-ShelfBackgroundType WmShelfAura::GetBackgroundType() {
+ShelfBackgroundType WmShelfAura::GetBackgroundType() const {
return shelf_->shelf_widget()->GetBackgroundType();
}
@@ -39,6 +47,21 @@ void WmShelfAura::UpdateVisibilityState() {
shelf_->shelf_layout_manager()->UpdateVisibilityState();
}
+ShelfVisibilityState WmShelfAura::GetVisibilityState() const {
+ return shelf_layout_manager_ ? shelf_layout_manager_->visibility_state()
+ : SHELF_HIDDEN;
+}
+
+void WmShelfAura::UpdateIconPositionForWindow(WmWindow* window) {
+ shelf_->UpdateIconPositionForWindow(WmWindowAura::GetAuraWindow(window));
+}
+
+gfx::Rect WmShelfAura::GetScreenBoundsOfItemIconForWindow(
+ wm::WmWindow* window) {
+ return shelf_->GetScreenBoundsOfItemIconForWindow(
+ WmWindowAura::GetAuraWindow(window));
+}
+
void WmShelfAura::AddObserver(WmShelfObserver* observer) {
observers_.AddObserver(observer);
}
@@ -59,5 +82,14 @@ void WmShelfAura::OnBackgroundUpdated(
OnBackgroundUpdated(background_type, change_type));
}
+void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) {
+ FOR_EACH_OBSERVER(WmShelfObserver, observers_,
+ WillChangeVisibilityState(new_state));
+}
+
+void WmShelfAura::OnShelfIconPositionsChanged() {
+ FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged());
+}
+
} // namespace wm
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698