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