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

Unified Diff: ash/mus/shelf_layout_manager.cc

Issue 2259153002: mash: Port ash_sysui ShelfDelegateMus impl to mojo:ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. 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
« no previous file with comments | « ash/mus/shelf_layout_manager.h ('k') | ash/mus/shelf_layout_manager_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/shelf_layout_manager.cc
diff --git a/ash/mus/shelf_layout_manager.cc b/ash/mus/shelf_layout_manager.cc
deleted file mode 100644
index 030283658900a0fc1fbb772219bd1c2d32fea495..0000000000000000000000000000000000000000
--- a/ash/mus/shelf_layout_manager.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/mus/shelf_layout_manager.h"
-
-#include "ash/mus/property_util.h"
-#include "ash/mus/shelf_layout_manager_delegate.h"
-#include "ash/public/interfaces/ash_window_type.mojom.h"
-#include "services/ui/public/cpp/window.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace ash {
-namespace mus {
-
-ShelfLayoutManager::ShelfLayoutManager(ui::Window* owner,
- ShelfLayoutManagerDelegate* delegate)
- : LayoutManager(owner),
- delegate_(delegate),
- alignment_(mash::shelf::mojom::Alignment::BOTTOM),
- auto_hide_behavior_(mash::shelf::mojom::AutoHideBehavior::NEVER) {
- AddLayoutProperty(ui::mojom::WindowManager::kPreferredSize_Property);
-}
-
-ShelfLayoutManager::~ShelfLayoutManager() {}
-
-ui::Window* ShelfLayoutManager::GetShelfWindow() {
- for (ui::Window* child : owner()->children()) {
- if (GetAshWindowType(child) == mojom::AshWindowType::SHELF)
- return child;
- }
- return nullptr;
-}
-
-void ShelfLayoutManager::SetAlignment(mash::shelf::mojom::Alignment alignment) {
- if (alignment_ == alignment)
- return;
-
- alignment_ = alignment;
- for (ui::Window* window : owner()->children())
- LayoutWindow(window);
-}
-
-void ShelfLayoutManager::SetAutoHideBehavior(
- mash::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.
-
-void ShelfLayoutManager::LayoutWindow(ui::Window* window) {
- if (GetAshWindowType(window) != mojom::AshWindowType::SHELF) {
- // Phantom windows end up in this container, ignore them.
- return;
- }
- gfx::Size size = GetWindowPreferredSize(window);
-
- if (alignment_ == mash::shelf::mojom::Alignment::BOTTOM) {
- const int y = owner()->bounds().height() - size.height();
- size.set_width(owner()->bounds().width());
- window->SetBounds(gfx::Rect(0, y, size.width(), size.height()));
- } else {
- const int x = (alignment_ == mash::shelf::mojom::Alignment::LEFT)
- ? 0
- : (owner()->bounds().width() - size.width());
- size.set_height(owner()->bounds().height());
- window->SetBounds(gfx::Rect(x, 0, size.width(), size.height()));
- }
-}
-
-void ShelfLayoutManager::WindowAdded(ui::Window* window) {
- if (GetAshWindowType(window) == mojom::AshWindowType::SHELF)
- delegate_->OnShelfWindowAvailable();
-}
-
-} // namespace mus
-} // namespace ash
« no previous file with comments | « ash/mus/shelf_layout_manager.h ('k') | ash/mus/shelf_layout_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698