| 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/shelf_layout_controller.h" | 5 #include "ui/aura_shell/shelf_layout_controller.h" |
| 6 | 6 |
| 7 #include "ui/aura/desktop.h" | 7 #include "ui/aura/desktop.h" |
| 8 #include "ui/aura/screen_aura.h" | 8 #include "ui/aura/screen_aura.h" |
| 9 #include "ui/gfx/compositor/layer.h" | 9 #include "ui/gfx/compositor/layer.h" |
| 10 #include "ui/gfx/compositor/layer_animator.h" | 10 #include "ui/gfx/compositor/layer_animator.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 max_height_(-1), | 28 max_height_(-1), |
| 29 launcher_(launcher), | 29 launcher_(launcher), |
| 30 status_(status) { | 30 status_(status) { |
| 31 gfx::Rect launcher_bounds = launcher->GetWindowScreenBounds(); | 31 gfx::Rect launcher_bounds = launcher->GetWindowScreenBounds(); |
| 32 gfx::Rect status_bounds = status->GetWindowScreenBounds(); | 32 gfx::Rect status_bounds = status->GetWindowScreenBounds(); |
| 33 max_height_ = std::max(launcher_bounds.height(), status_bounds.height()); | 33 max_height_ = std::max(launcher_bounds.height(), status_bounds.height()); |
| 34 GetLayer(launcher)->GetAnimator()->AddObserver(this); | 34 GetLayer(launcher)->GetAnimator()->AddObserver(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 ShelfLayoutController::~ShelfLayoutController() { | 37 ShelfLayoutController::~ShelfLayoutController() { |
| 38 GetLayer(launcher_)->GetAnimator()->RemoveObserver(this); | 38 // Do not try to remove observer from layer as the Launcher is |
| 39 // already deleted. |
| 39 } | 40 } |
| 40 | 41 |
| 41 void ShelfLayoutController::LayoutShelf() { | 42 void ShelfLayoutController::LayoutShelf() { |
| 42 StopAnimating(); | 43 StopAnimating(); |
| 43 TargetBounds target_bounds; | 44 TargetBounds target_bounds; |
| 44 float target_opacity = visible_ ? 1.0f : 0.0f; | 45 float target_opacity = visible_ ? 1.0f : 0.0f; |
| 45 CalculateTargetBounds(visible_, &target_bounds); | 46 CalculateTargetBounds(visible_, &target_bounds); |
| 46 GetLayer(launcher_)->SetOpacity(target_opacity); | 47 GetLayer(launcher_)->SetOpacity(target_opacity); |
| 47 GetLayer(status_)->SetOpacity(target_opacity); | 48 GetLayer(status_)->SetOpacity(target_opacity); |
| 48 launcher_->SetBounds(target_bounds.launcher_bounds); | 49 launcher_->SetBounds(target_bounds.launcher_bounds); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 animating_ = false; | 110 animating_ = false; |
| 110 visible_ = !visible_; | 111 visible_ = !visible_; |
| 111 TargetBounds target_bounds; | 112 TargetBounds target_bounds; |
| 112 CalculateTargetBounds(visible_, &target_bounds); | 113 CalculateTargetBounds(visible_, &target_bounds); |
| 113 aura::Desktop::GetInstance()->screen()->set_work_area_insets( | 114 aura::Desktop::GetInstance()->screen()->set_work_area_insets( |
| 114 target_bounds.work_area_insets); | 115 target_bounds.work_area_insets); |
| 115 } | 116 } |
| 116 | 117 |
| 117 } // internal | 118 } // internal |
| 118 } // aura_shell | 119 } // aura_shell |
| OLD | NEW |