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" | 9 #include "ui/aura/window_property.h" |
10 | 10 |
| 11 // This is to avoid creating type definitoin for kAlwaysFillWindowKey. |
| 12 DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ATHENA_EXPORT, bool); |
| 13 |
11 namespace athena { | 14 namespace athena { |
12 namespace { | 15 namespace { |
13 | 16 |
14 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(bool, kAlwaysFillWindowKey, false); | 17 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(bool, kAlwaysFillWindowKey, false); |
15 | 18 |
16 // TODO(oshima): Implement real window/layout manager. crbug.com/388362. | 19 // TODO(oshima): Implement real window/layout manager. crbug.com/388362. |
17 bool ShouldFill(aura::Window* window) { | 20 bool ShouldFill(aura::Window* window) { |
18 return window->GetProperty(kAlwaysFillWindowKey) || | 21 return window->GetProperty(kAlwaysFillWindowKey) || |
19 (window->type() != ui::wm::WINDOW_TYPE_MENU && | 22 (window->type() != ui::wm::WINDOW_TYPE_MENU && |
20 window->type() != ui::wm::WINDOW_TYPE_TOOLTIP && | 23 window->type() != ui::wm::WINDOW_TYPE_TOOLTIP && |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 SetChildBoundsDirect(child, gfx::Rect(container_->bounds().size())); | 67 SetChildBoundsDirect(child, gfx::Rect(container_->bounds().size())); |
65 } | 68 } |
66 | 69 |
67 void FillLayoutManager::SetChildBounds(aura::Window* child, | 70 void FillLayoutManager::SetChildBounds(aura::Window* child, |
68 const gfx::Rect& requested_bounds) { | 71 const gfx::Rect& requested_bounds) { |
69 if (!ShouldFill(child)) | 72 if (!ShouldFill(child)) |
70 SetChildBoundsDirect(child, requested_bounds); | 73 SetChildBoundsDirect(child, requested_bounds); |
71 } | 74 } |
72 | 75 |
73 } // namespace athena | 76 } // namespace athena |
OLD | NEW |