OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/toplevel_layout_manager.h" | 5 #include "ui/aura_shell/toplevel_layout_manager.h" |
6 | 6 |
7 #include "ui/aura/client/aura_constants.h" | 7 #include "ui/aura/client/aura_constants.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/aura_shell/property_util.h" | 9 #include "ui/aura_shell/property_util.h" |
10 #include "ui/aura_shell/shelf_layout_manager.h" | 10 #include "ui/aura_shell/shelf_layout_manager.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 UpdateShelfVisibility(); | 41 UpdateShelfVisibility(); |
42 } | 42 } |
43 | 43 |
44 void ToplevelLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, | 44 void ToplevelLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, |
45 bool visibile) { | 45 bool visibile) { |
46 UpdateShelfVisibility(); | 46 UpdateShelfVisibility(); |
47 } | 47 } |
48 | 48 |
49 void ToplevelLayoutManager::SetChildBounds(aura::Window* child, | 49 void ToplevelLayoutManager::SetChildBounds(aura::Window* child, |
50 const gfx::Rect& requested_bounds) { | 50 const gfx::Rect& requested_bounds) { |
51 SetChildBoundsDirect(child, requested_bounds); | 51 const static int kTitleHeight = 12; |
| 52 gfx::Rect child_bounds(requested_bounds); |
| 53 gfx::Rect work_area = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); |
| 54 if (child_bounds.y() < 0) |
| 55 child_bounds.set_y(0); |
| 56 else if (child_bounds.y() + kTitleHeight > work_area.bottom()) |
| 57 child_bounds.set_y(work_area.bottom() - kTitleHeight); |
| 58 SetChildBoundsDirect(child, child_bounds); |
52 } | 59 } |
53 | 60 |
54 void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window, | 61 void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window, |
55 const char* name, | 62 const char* name, |
56 void* old) { | 63 void* old) { |
57 if (name == aura::kShowStateKey) | 64 if (name == aura::kShowStateKey) |
58 WindowStateChanged(window); | 65 WindowStateChanged(window); |
59 } | 66 } |
60 | 67 |
61 void ToplevelLayoutManager::WindowStateChanged(aura::Window* window) { | 68 void ToplevelLayoutManager::WindowStateChanged(aura::Window* window) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 ui::SHOW_STATE_FULLSCREEN) { | 103 ui::SHOW_STATE_FULLSCREEN) { |
97 has_fullscreen_window = true; | 104 has_fullscreen_window = true; |
98 break; | 105 break; |
99 } | 106 } |
100 } | 107 } |
101 shelf_->SetVisible(!has_fullscreen_window); | 108 shelf_->SetVisible(!has_fullscreen_window); |
102 } | 109 } |
103 | 110 |
104 } // namespace internal | 111 } // namespace internal |
105 } // namespace aura_shell | 112 } // namespace aura_shell |
OLD | NEW |