| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/system/tray/throbber_view.h" | 5 #include "ash/system/tray/throbber_view.h" |
| 6 | 6 |
| 7 #include "ash/system/tray/tray_constants.h" | 7 #include "ash/system/tray/tray_constants.h" |
| 8 #include "grit/ash_resources.h" | 8 #include "grit/ash_resources.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 AddChildView(throbber_); | 49 AddChildView(throbber_); |
| 50 | 50 |
| 51 SetPaintToLayer(true); | 51 SetPaintToLayer(true); |
| 52 layer()->SetFillsBoundsOpaquely(false); | 52 layer()->SetFillsBoundsOpaquely(false); |
| 53 layer()->SetOpacity(0.0); | 53 layer()->SetOpacity(0.0); |
| 54 } | 54 } |
| 55 | 55 |
| 56 ThrobberView::~ThrobberView() { | 56 ThrobberView::~ThrobberView() { |
| 57 } | 57 } |
| 58 | 58 |
| 59 gfx::Size ThrobberView::GetPreferredSize() { | 59 gfx::Size ThrobberView::GetPreferredSize() const { |
| 60 return gfx::Size(ash::kTrayPopupItemHeight, ash::kTrayPopupItemHeight); | 60 return gfx::Size(ash::kTrayPopupItemHeight, ash::kTrayPopupItemHeight); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ThrobberView::Layout() { | 63 void ThrobberView::Layout() { |
| 64 View* child = child_at(0); | 64 View* child = child_at(0); |
| 65 gfx::Size ps = child->GetPreferredSize(); | 65 gfx::Size ps = child->GetPreferredSize(); |
| 66 child->SetBounds((width() - ps.width()) / 2, | 66 child->SetBounds((width() - ps.width()) / 2, |
| 67 (height() - ps.height()) / 2, | 67 (height() - ps.height()) / 2, |
| 68 ps.width(), ps.height()); | 68 ps.width(), ps.height()); |
| 69 SizeToPreferredSize(); | 69 SizeToPreferredSize(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 98 layer()->GetAnimator()->StopAnimating(); | 98 layer()->GetAnimator()->StopAnimating(); |
| 99 | 99 |
| 100 ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator()); | 100 ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator()); |
| 101 animation.SetTransitionDuration( | 101 animation.SetTransitionDuration( |
| 102 base::TimeDelta::FromMilliseconds(kThrobberAnimationDurationMs)); | 102 base::TimeDelta::FromMilliseconds(kThrobberAnimationDurationMs)); |
| 103 | 103 |
| 104 layer()->SetOpacity(start_throbber ? 1.0 : 0.0); | 104 layer()->SetOpacity(start_throbber ? 1.0 : 0.0); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace ash | 107 } // namespace ash |
| OLD | NEW |