| 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 const static int kTitleHeight = 12; | 51 SetChildBoundsDirect(child, requested_bounds); |
| 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); | |
| 59 } | 52 } |
| 60 | 53 |
| 61 void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window, | 54 void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window, |
| 62 const char* name, | 55 const char* name, |
| 63 void* old) { | 56 void* old) { |
| 64 if (name == aura::kShowStateKey) | 57 if (name == aura::kShowStateKey) |
| 65 WindowStateChanged(window); | 58 WindowStateChanged(window); |
| 66 } | 59 } |
| 67 | 60 |
| 68 void ToplevelLayoutManager::WindowStateChanged(aura::Window* window) { | 61 void ToplevelLayoutManager::WindowStateChanged(aura::Window* window) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ui::SHOW_STATE_FULLSCREEN) { | 96 ui::SHOW_STATE_FULLSCREEN) { |
| 104 has_fullscreen_window = true; | 97 has_fullscreen_window = true; |
| 105 break; | 98 break; |
| 106 } | 99 } |
| 107 } | 100 } |
| 108 shelf_->SetVisible(!has_fullscreen_window); | 101 shelf_->SetVisible(!has_fullscreen_window); |
| 109 } | 102 } |
| 110 | 103 |
| 111 } // namespace internal | 104 } // namespace internal |
| 112 } // namespace aura_shell | 105 } // namespace aura_shell |
| OLD | NEW |