Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 GetLayer(launcher_)->GetAnimator()->StopAnimating(); | 127 GetLayer(launcher_)->GetAnimator()->StopAnimating(); |
| 128 GetLayer(status_)->GetAnimator()->StopAnimating(); | 128 GetLayer(status_)->GetAnimator()->StopAnimating(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void ShelfLayoutManager::CalculateTargetBounds(bool visible, | 131 void ShelfLayoutManager::CalculateTargetBounds(bool visible, |
| 132 TargetBounds* target_bounds) { | 132 TargetBounds* target_bounds) { |
| 133 const gfx::Rect& available_bounds(Shell::GetRootWindow()->bounds()); | 133 const gfx::Rect& available_bounds(Shell::GetRootWindow()->bounds()); |
| 134 int y = available_bounds.bottom() - (visible ? max_height_ : 0); | 134 int y = available_bounds.bottom() - (visible ? max_height_ : 0); |
| 135 gfx::Rect status_bounds(status_->GetWindowScreenBounds()); | 135 gfx::Rect status_bounds(status_->GetWindowScreenBounds()); |
| 136 target_bounds->status_bounds = gfx::Rect( | 136 target_bounds->status_bounds = gfx::Rect( |
| 137 available_bounds.right() - status_bounds.width(), | 137 available_bounds.right() - status_bounds.width() - 10, |
|
Ben Goodger (Google)
2012/03/05 15:51:14
- what?
sadrul
2012/03/05 22:47:16
Using a const kVariable so it's easier to understa
| |
| 138 y + (max_height_ - status_bounds.height()) / 2, | 138 y + (max_height_ - status_bounds.height()) / 2, |
| 139 status_bounds.width(), status_bounds.height()); | 139 status_bounds.width(), status_bounds.height()); |
| 140 gfx::Rect launcher_bounds(launcher_->GetWindowScreenBounds()); | 140 gfx::Rect launcher_bounds(launcher_->GetWindowScreenBounds()); |
| 141 target_bounds->launcher_bounds = gfx::Rect( | 141 target_bounds->launcher_bounds = gfx::Rect( |
| 142 available_bounds.x(), y + (max_height_ - launcher_bounds.height()) / 2, | 142 available_bounds.x(), y + (max_height_ - launcher_bounds.height()) / 2, |
| 143 available_bounds.width(), | 143 available_bounds.width(), |
| 144 launcher_bounds.height()); | 144 launcher_bounds.height()); |
| 145 if (visible) | 145 if (visible) |
| 146 target_bounds->work_area_insets = gfx::Insets(0, 0, max_height_, 0); | 146 target_bounds->work_area_insets = gfx::Insets(0, 0, max_height_, 0); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ShelfLayoutManager::OnImplicitAnimationsCompleted() { | 149 void ShelfLayoutManager::OnImplicitAnimationsCompleted() { |
| 150 TargetBounds target_bounds; | 150 TargetBounds target_bounds; |
| 151 CalculateTargetBounds(visible_, &target_bounds); | 151 CalculateTargetBounds(visible_, &target_bounds); |
| 152 Shell::GetRootWindow()->SetScreenWorkAreaInsets( | 152 Shell::GetRootWindow()->SetScreenWorkAreaInsets( |
| 153 target_bounds.work_area_insets); | 153 target_bounds.work_area_insets); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace internal | 156 } // namespace internal |
| 157 } // namespace ash | 157 } // namespace ash |
| OLD | NEW |