| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/util/fill_layout_manager.h" | 5 #include "athena/util/fill_layout_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 #include "ui/aura/window_property.h" |
| 10 |
| 11 DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ATHENA_EXPORT, bool); |
| 9 | 12 |
| 10 namespace athena { | 13 namespace athena { |
| 11 namespace { | 14 namespace { |
| 12 | 15 |
| 13 // TODO(oshima): Implement real window/layout manager. crbug.com/388362. | 16 // TODO(oshima): Implement real window/layout manager. crbug.com/388362. |
| 14 bool ShouldFill(aura::Window* window) { | 17 bool ShouldFill(aura::Window* window) { |
| 15 return window->type() != ui::wm::WINDOW_TYPE_MENU && | 18 return window->GetProperty(kAlwaysFillWindowKey) || |
| 16 window->type() != ui::wm::WINDOW_TYPE_TOOLTIP && | 19 (window->type() != ui::wm::WINDOW_TYPE_MENU && |
| 17 window->type() != ui::wm::WINDOW_TYPE_POPUP; | 20 window->type() != ui::wm::WINDOW_TYPE_TOOLTIP && |
| 21 window->type() != ui::wm::WINDOW_TYPE_POPUP); |
| 18 } | 22 } |
| 19 | 23 |
| 20 } // namespace | 24 } // namespace |
| 21 | 25 |
| 26 DEFINE_WINDOW_PROPERTY_KEY(bool, kAlwaysFillWindowKey, false); |
| 27 |
| 22 FillLayoutManager::FillLayoutManager(aura::Window* container) | 28 FillLayoutManager::FillLayoutManager(aura::Window* container) |
| 23 : container_(container) { | 29 : container_(container) { |
| 24 DCHECK(container_); | 30 DCHECK(container_); |
| 25 } | 31 } |
| 26 | 32 |
| 27 FillLayoutManager::~FillLayoutManager() { | 33 FillLayoutManager::~FillLayoutManager() { |
| 28 } | 34 } |
| 29 | 35 |
| 30 void FillLayoutManager::OnWindowResized() { | 36 void FillLayoutManager::OnWindowResized() { |
| 31 gfx::Rect full_bounds = gfx::Rect(container_->bounds().size()); | 37 gfx::Rect full_bounds = gfx::Rect(container_->bounds().size()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 50 void FillLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, | 56 void FillLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, |
| 51 bool visible) { | 57 bool visible) { |
| 52 } | 58 } |
| 53 void FillLayoutManager::SetChildBounds(aura::Window* child, | 59 void FillLayoutManager::SetChildBounds(aura::Window* child, |
| 54 const gfx::Rect& requested_bounds) { | 60 const gfx::Rect& requested_bounds) { |
| 55 if (!ShouldFill(child)) | 61 if (!ShouldFill(child)) |
| 56 SetChildBoundsDirect(child, requested_bounds); | 62 SetChildBoundsDirect(child, requested_bounds); |
| 57 } | 63 } |
| 58 | 64 |
| 59 } // namespace athena | 65 } // namespace athena |
| OLD | NEW |