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

Side by Side Diff: mash/wm/status_layout_manager.cc

Issue 2029883002: Moves mash/wm into ash/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_static_assert
Patch Set: move comment Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « mash/wm/status_layout_manager.h ('k') | mash/wm/test/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mash/wm/status_layout_manager.h"
6
7 #include "ash/public/interfaces/ash_window_type.mojom.h"
8 #include "components/mus/public/cpp/window.h"
9 #include "mash/wm/property_util.h"
10 #include "ui/gfx/geometry/rect.h"
11
12 namespace mash {
13 namespace wm {
14
15 StatusLayoutManager::StatusLayoutManager(mus::Window* owner)
16 : LayoutManager(owner),
17 alignment_(mash::shelf::mojom::Alignment::BOTTOM),
18 auto_hide_behavior_(mash::shelf::mojom::AutoHideBehavior::NEVER) {
19 AddLayoutProperty(mus::mojom::WindowManager::kPreferredSize_Property);
20 }
21
22 StatusLayoutManager::~StatusLayoutManager() {}
23
24 // We explicitly don't make assertions about the number of children in this
25 // layout as the number of children can vary when the application providing the
26 // status area restarts.
27
28 void StatusLayoutManager::LayoutWindow(mus::Window* window) {
29 if (GetAshWindowType(window) != ash::mojom::AshWindowType::STATUS_AREA) {
30 // TODO(jamescook): Layout for notifications and other windows.
31 NOTIMPLEMENTED() << "Non-status-area window needs layout.";
32 return;
33 }
34 gfx::Size size = GetWindowPreferredSize(window);
35 if (alignment_ == mash::shelf::mojom::Alignment::BOTTOM) {
36 const int y = owner()->bounds().height() - size.height();
37 // TODO(msw): Place the status area widget on the left for RTL UIs.
38 window->SetBounds(gfx::Rect(owner()->bounds().width() - size.width(), y,
39 size.width(), size.height()));
40 } else {
41 const int x = (alignment_ == mash::shelf::mojom::Alignment::LEFT)
42 ? 0
43 : (owner()->bounds().width() - size.width());
44 window->SetBounds(gfx::Rect(x, owner()->bounds().height() - size.height(),
45 size.width(), size.height()));
46 }
47 }
48
49 void StatusLayoutManager::SetAlignment(
50 mash::shelf::mojom::Alignment alignment) {
51 if (alignment_ == alignment)
52 return;
53
54 alignment_ = alignment;
55 for (mus::Window* window : owner()->children())
56 LayoutWindow(window);
57 }
58
59 void StatusLayoutManager::SetAutoHideBehavior(
60 mash::shelf::mojom::AutoHideBehavior auto_hide) {
61 if (auto_hide_behavior_ == auto_hide)
62 return;
63
64 auto_hide_behavior_ = auto_hide;
65 NOTIMPLEMENTED();
66 }
67
68 } // namespace wm
69 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/status_layout_manager.h ('k') | mash/wm/test/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698