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

Unified Diff: mash/wm/shelf_layout_manager.cc

Issue 2010473003: Wires up shelf to panel and dock layoutmanagers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 4 years, 7 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: mash/wm/shelf_layout_manager.cc
diff --git a/mash/wm/shelf_layout_manager.cc b/mash/wm/shelf_layout_manager.cc
index 7e07f58f26a8848f9a1adb5ec9c60ec832f56d1c..01a990af8e9b03d764dc46115ec46e63f1071e06 100644
--- a/mash/wm/shelf_layout_manager.cc
+++ b/mash/wm/shelf_layout_manager.cc
@@ -7,13 +7,16 @@
#include "components/mus/public/cpp/window.h"
#include "mash/wm/property_util.h"
#include "mash/wm/public/interfaces/ash_window_type.mojom.h"
+#include "mash/wm/shelf_layout_manager_delegate.h"
#include "ui/gfx/geometry/rect.h"
namespace mash {
namespace wm {
-ShelfLayoutManager::ShelfLayoutManager(mus::Window* owner)
+ShelfLayoutManager::ShelfLayoutManager(mus::Window* owner,
+ ShelfLayoutManagerDelegate* delegate)
: LayoutManager(owner),
+ delegate_(delegate),
alignment_(shelf::mojom::Alignment::BOTTOM),
auto_hide_behavior_(shelf::mojom::AutoHideBehavior::NEVER) {
AddLayoutProperty(mus::mojom::WindowManager::kPreferredSize_Property);
@@ -29,6 +32,24 @@ mus::Window* ShelfLayoutManager::GetShelfWindow() {
return nullptr;
}
+void ShelfLayoutManager::SetAlignment(shelf::mojom::Alignment alignment) {
+ if (alignment_ == alignment)
+ return;
+
+ alignment_ = alignment;
+ for (mus::Window* window : owner()->children())
+ LayoutWindow(window);
+}
+
+void ShelfLayoutManager::SetAutoHideBehavior(
+ shelf::mojom::AutoHideBehavior auto_hide) {
+ if (auto_hide_behavior_ == auto_hide)
+ return;
+
+ auto_hide_behavior_ = auto_hide;
+ NOTIMPLEMENTED();
+}
+
// We explicitly don't make assertions about the number of children in this
// layout as the number of children can vary when the application providing the
// shelf restarts.
@@ -53,22 +74,9 @@ void ShelfLayoutManager::LayoutWindow(mus::Window* window) {
}
}
-void ShelfLayoutManager::SetAlignment(shelf::mojom::Alignment alignment) {
- if (alignment_ == alignment)
- return;
-
- alignment_ = alignment;
- for (mus::Window* window : owner()->children())
- LayoutWindow(window);
-}
-
-void ShelfLayoutManager::SetAutoHideBehavior(
- shelf::mojom::AutoHideBehavior auto_hide) {
- if (auto_hide_behavior_ == auto_hide)
- return;
-
- auto_hide_behavior_ = auto_hide;
- NOTIMPLEMENTED();
+void ShelfLayoutManager::WindowAdded(mus::Window* window) {
+ if (GetAshWindowType(window) == mojom::AshWindowType::SHELF)
+ delegate_->OnShelfWindowAvailable();
}
} // namespace wm

Powered by Google App Engine
This is Rietveld 408576698