| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mash/wm/status_layout_manager.h" | 5 #include "mash/wm/status_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/public/interfaces/ash_window_type.mojom.h" |
| 7 #include "components/mus/public/cpp/window.h" | 8 #include "components/mus/public/cpp/window.h" |
| 8 #include "mash/wm/property_util.h" | 9 #include "mash/wm/property_util.h" |
| 9 #include "mash/wm/public/interfaces/ash_window_type.mojom.h" | |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| 11 | 11 |
| 12 namespace mash { | 12 namespace mash { |
| 13 namespace wm { | 13 namespace wm { |
| 14 | 14 |
| 15 StatusLayoutManager::StatusLayoutManager(mus::Window* owner) | 15 StatusLayoutManager::StatusLayoutManager(mus::Window* owner) |
| 16 : LayoutManager(owner), | 16 : LayoutManager(owner), |
| 17 alignment_(mash::shelf::mojom::Alignment::BOTTOM), | 17 alignment_(mash::shelf::mojom::Alignment::BOTTOM), |
| 18 auto_hide_behavior_(mash::shelf::mojom::AutoHideBehavior::NEVER) { | 18 auto_hide_behavior_(mash::shelf::mojom::AutoHideBehavior::NEVER) { |
| 19 AddLayoutProperty(mus::mojom::WindowManager::kPreferredSize_Property); | 19 AddLayoutProperty(mus::mojom::WindowManager::kPreferredSize_Property); |
| 20 } | 20 } |
| 21 | 21 |
| 22 StatusLayoutManager::~StatusLayoutManager() {} | 22 StatusLayoutManager::~StatusLayoutManager() {} |
| 23 | 23 |
| 24 // We explicitly don't make assertions about the number of children in this | 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 | 25 // layout as the number of children can vary when the application providing the |
| 26 // status area restarts. | 26 // status area restarts. |
| 27 | 27 |
| 28 void StatusLayoutManager::LayoutWindow(mus::Window* window) { | 28 void StatusLayoutManager::LayoutWindow(mus::Window* window) { |
| 29 if (GetAshWindowType(window) != mojom::AshWindowType::STATUS_AREA) { | 29 if (GetAshWindowType(window) != ash::mojom::AshWindowType::STATUS_AREA) { |
| 30 // TODO(jamescook): Layout for notifications and other windows. | 30 // TODO(jamescook): Layout for notifications and other windows. |
| 31 NOTIMPLEMENTED() << "Non-status-area window needs layout."; | 31 NOTIMPLEMENTED() << "Non-status-area window needs layout."; |
| 32 return; | 32 return; |
| 33 } | 33 } |
| 34 gfx::Size size = GetWindowPreferredSize(window); | 34 gfx::Size size = GetWindowPreferredSize(window); |
| 35 if (alignment_ == mash::shelf::mojom::Alignment::BOTTOM) { | 35 if (alignment_ == mash::shelf::mojom::Alignment::BOTTOM) { |
| 36 const int y = owner()->bounds().height() - size.height(); | 36 const int y = owner()->bounds().height() - size.height(); |
| 37 // TODO(msw): Place the status area widget on the left for RTL UIs. | 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, | 38 window->SetBounds(gfx::Rect(owner()->bounds().width() - size.width(), y, |
| 39 size.width(), size.height())); | 39 size.width(), size.height())); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 60 mash::shelf::mojom::AutoHideBehavior auto_hide) { | 60 mash::shelf::mojom::AutoHideBehavior auto_hide) { |
| 61 if (auto_hide_behavior_ == auto_hide) | 61 if (auto_hide_behavior_ == auto_hide) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 auto_hide_behavior_ = auto_hide; | 64 auto_hide_behavior_ = auto_hide; |
| 65 NOTIMPLEMENTED(); | 65 NOTIMPLEMENTED(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace wm | 68 } // namespace wm |
| 69 } // namespace mash | 69 } // namespace mash |
| OLD | NEW |