| 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/shelf_layout_manager.h" | 5 #include "mash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "components/mus/public/cpp/window.h" | 7 #include "components/mus/public/cpp/window.h" |
| 8 #include "mash/wm/property_util.h" | 8 #include "mash/wm/property_util.h" |
| 9 #include "mash/wm/public/interfaces/ash_window_type.mojom.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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 return nullptr; | 29 return nullptr; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // We explicitly don't make assertions about the number of children in this | 32 // We explicitly don't make assertions about the number of children in this |
| 33 // layout as the number of children can vary when the application providing the | 33 // layout as the number of children can vary when the application providing the |
| 34 // shelf restarts. | 34 // shelf restarts. |
| 35 | 35 |
| 36 void ShelfLayoutManager::LayoutWindow(mus::Window* window) { | 36 void ShelfLayoutManager::LayoutWindow(mus::Window* window) { |
| 37 if (GetAshWindowType(window) != mojom::AshWindowType::SHELF) { | 37 if (GetAshWindowType(window) != mojom::AshWindowType::SHELF) { |
| 38 NOTREACHED() << "Unknown window in USER_SHELF container."; | 38 // Phantom windows end up in this container, ignore them. |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 gfx::Size size = GetWindowPreferredSize(window); | 41 gfx::Size size = GetWindowPreferredSize(window); |
| 42 | 42 |
| 43 if (alignment_ == shelf::mojom::Alignment::BOTTOM) { | 43 if (alignment_ == shelf::mojom::Alignment::BOTTOM) { |
| 44 const int y = owner()->bounds().height() - size.height(); | 44 const int y = owner()->bounds().height() - size.height(); |
| 45 size.set_width(owner()->bounds().width()); | 45 size.set_width(owner()->bounds().width()); |
| 46 window->SetBounds(gfx::Rect(0, y, size.width(), size.height())); | 46 window->SetBounds(gfx::Rect(0, y, size.width(), size.height())); |
| 47 } else { | 47 } else { |
| 48 const int x = (alignment_ == shelf::mojom::Alignment::LEFT) | 48 const int x = (alignment_ == shelf::mojom::Alignment::LEFT) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 shelf::mojom::AutoHideBehavior auto_hide) { | 66 shelf::mojom::AutoHideBehavior auto_hide) { |
| 67 if (auto_hide_behavior_ == auto_hide) | 67 if (auto_hide_behavior_ == auto_hide) |
| 68 return; | 68 return; |
| 69 | 69 |
| 70 auto_hide_behavior_ = auto_hide; | 70 auto_hide_behavior_ = auto_hide; |
| 71 NOTIMPLEMENTED(); | 71 NOTIMPLEMENTED(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace wm | 74 } // namespace wm |
| 75 } // namespace mash | 75 } // namespace mash |
| OLD | NEW |