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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/launcher/launcher.h" | 9 #include "ash/launcher/launcher.h" |
10 #include "ash/screen_ash.h" | 10 #include "ash/screen_ash.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 launcher_->SetAlignment(alignment); | 199 launcher_->SetAlignment(alignment); |
200 StatusAreaWidget* status_area_widget = | 200 StatusAreaWidget* status_area_widget = |
201 Shell::GetInstance()->status_area_widget(); | 201 Shell::GetInstance()->status_area_widget(); |
202 if (status_area_widget) | 202 if (status_area_widget) |
203 Shell::GetInstance()->status_area_widget()->SetShelfAlignment(alignment); | 203 Shell::GetInstance()->status_area_widget()->SetShelfAlignment(alignment); |
204 LayoutShelf(); | 204 LayoutShelf(); |
205 return true; | 205 return true; |
206 } | 206 } |
207 | 207 |
208 gfx::Rect ShelfLayoutManager::GetIdealBounds() { | 208 gfx::Rect ShelfLayoutManager::GetIdealBounds() { |
209 // TODO: this is wrong. Figure out what monitor shelf is on and everything | 209 // TODO: this is wrong. Figure out what display shelf is on and everything |
210 // should be based on it. | 210 // should be based on it. |
211 gfx::Rect bounds( | 211 gfx::Rect bounds( |
212 gfx::Screen::GetDisplayNearestWindow(status_->GetNativeView()).bounds()); | 212 gfx::Screen::GetDisplayNearestWindow(status_->GetNativeView()).bounds()); |
213 int width = 0, height = 0; | 213 int width = 0, height = 0; |
214 GetShelfSize(&width, &height); | 214 GetShelfSize(&width, &height); |
215 switch (alignment_) { | 215 switch (alignment_) { |
216 case SHELF_ALIGNMENT_BOTTOM: | 216 case SHELF_ALIGNMENT_BOTTOM: |
217 return gfx::Rect(bounds.x(), bounds.bottom() - height, | 217 return gfx::Rect(bounds.x(), bounds.bottom() - height, |
218 bounds.width(), height); | 218 bounds.width(), height); |
219 case SHELF_ALIGNMENT_LEFT: | 219 case SHELF_ALIGNMENT_LEFT: |
(...skipping 12 matching lines...) Expand all Loading... |
232 TargetBounds target_bounds; | 232 TargetBounds target_bounds; |
233 CalculateTargetBounds(state_, &target_bounds); | 233 CalculateTargetBounds(state_, &target_bounds); |
234 if (launcher_widget()) { | 234 if (launcher_widget()) { |
235 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); | 235 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); |
236 | 236 |
237 launcher_widget()->SetBounds(target_bounds.launcher_bounds); | 237 launcher_widget()->SetBounds(target_bounds.launcher_bounds); |
238 launcher_->SetStatusSize(target_bounds.status_bounds.size()); | 238 launcher_->SetStatusSize(target_bounds.status_bounds.size()); |
239 } | 239 } |
240 GetLayer(status_)->SetOpacity(target_bounds.opacity); | 240 GetLayer(status_)->SetOpacity(target_bounds.opacity); |
241 status_->SetBounds(target_bounds.status_bounds); | 241 status_->SetBounds(target_bounds.status_bounds); |
242 Shell::GetInstance()->SetMonitorWorkAreaInsets( | 242 Shell::GetInstance()->SetDisplayWorkAreaInsets( |
243 Shell::GetPrimaryRootWindow(), | 243 Shell::GetPrimaryRootWindow(), |
244 target_bounds.work_area_insets); | 244 target_bounds.work_area_insets); |
245 UpdateHitTestBounds(); | 245 UpdateHitTestBounds(); |
246 } | 246 } |
247 | 247 |
248 void ShelfLayoutManager::UpdateVisibilityState() { | 248 void ShelfLayoutManager::UpdateVisibilityState() { |
249 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 249 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
250 if (delegate && delegate->IsScreenLocked()) { | 250 if (delegate && delegate->IsScreenLocked()) { |
251 SetState(VISIBLE); | 251 SetState(VISIBLE); |
252 } else { | 252 } else { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 GetLayer(launcher_widget())->SetBounds(target_bounds.launcher_bounds); | 377 GetLayer(launcher_widget())->SetBounds(target_bounds.launcher_bounds); |
378 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); | 378 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); |
379 } | 379 } |
380 ui::ScopedLayerAnimationSettings status_animation_setter( | 380 ui::ScopedLayerAnimationSettings status_animation_setter( |
381 GetLayer(status_)->GetAnimator()); | 381 GetLayer(status_)->GetAnimator()); |
382 status_animation_setter.SetTransitionDuration( | 382 status_animation_setter.SetTransitionDuration( |
383 base::TimeDelta::FromMilliseconds(130)); | 383 base::TimeDelta::FromMilliseconds(130)); |
384 status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); | 384 status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); |
385 GetLayer(status_)->SetBounds(target_bounds.status_bounds); | 385 GetLayer(status_)->SetBounds(target_bounds.status_bounds); |
386 GetLayer(status_)->SetOpacity(target_bounds.opacity); | 386 GetLayer(status_)->SetOpacity(target_bounds.opacity); |
387 Shell::GetInstance()->SetMonitorWorkAreaInsets( | 387 Shell::GetInstance()->SetDisplayWorkAreaInsets( |
388 Shell::GetPrimaryRootWindow(), | 388 Shell::GetPrimaryRootWindow(), |
389 target_bounds.work_area_insets); | 389 target_bounds.work_area_insets); |
390 UpdateHitTestBounds(); | 390 UpdateHitTestBounds(); |
391 UpdateShelfBackground(change_type); | 391 UpdateShelfBackground(change_type); |
392 } | 392 } |
393 | 393 |
394 void ShelfLayoutManager::StopAnimating() { | 394 void ShelfLayoutManager::StopAnimating() { |
395 if (launcher_widget()) | 395 if (launcher_widget()) |
396 GetLayer(launcher_widget())->GetAnimator()->StopAnimating(); | 396 GetLayer(launcher_widget())->GetAnimator()->StopAnimating(); |
397 GetLayer(status_)->GetAnimator()->StopAnimating(); | 397 GetLayer(status_)->GetAnimator()->StopAnimating(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 574 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
575 if (state.visibility_state == VISIBLE) | 575 if (state.visibility_state == VISIBLE) |
576 return size; | 576 return size; |
577 if (state.visibility_state == AUTO_HIDE) | 577 if (state.visibility_state == AUTO_HIDE) |
578 return kAutoHideSize; | 578 return kAutoHideSize; |
579 return 0; | 579 return 0; |
580 } | 580 } |
581 | 581 |
582 } // namespace internal | 582 } // namespace internal |
583 } // namespace ash | 583 } // namespace ash |
OLD | NEW |