| 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/system/tray/tray_item_view.h" | 5 #include "ash/system/tray/tray_item_view.h" |
| 6 | 6 |
| 7 #include "ash/shelf/shelf_types.h" | 7 #include "ash/shelf/shelf_types.h" |
| 8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "ash/system/tray/system_tray_item.h" | 9 #include "ash/system/tray/system_tray_item.h" |
| 10 #include "ui/base/animation/slide_animation.h" | 10 #include "ui/base/animation/slide_animation.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 image_view_ = new views::ImageView; | 44 image_view_ = new views::ImageView; |
| 45 AddChildView(image_view_); | 45 AddChildView(image_view_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void TrayItemView::SetVisible(bool set_visible) { | 48 void TrayItemView::SetVisible(bool set_visible) { |
| 49 if (!GetWidget()) { | 49 if (!GetWidget()) { |
| 50 views::View::SetVisible(set_visible); | 50 views::View::SetVisible(set_visible); |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 | 53 |
| 54 if (!animation_.get()) { | 54 if (!animation_) { |
| 55 animation_.reset(new ui::SlideAnimation(this)); | 55 animation_.reset(new ui::SlideAnimation(this)); |
| 56 animation_->SetSlideDuration(GetAnimationDurationMS()); | 56 animation_->SetSlideDuration(GetAnimationDurationMS()); |
| 57 animation_->SetTweenType(ui::Tween::LINEAR); | 57 animation_->SetTweenType(ui::Tween::LINEAR); |
| 58 animation_->Reset(visible() ? 1.0 : 0.0); | 58 animation_->Reset(visible() ? 1.0 : 0.0); |
| 59 } | 59 } |
| 60 | 60 |
| 61 if (!set_visible) { | 61 if (!set_visible) { |
| 62 animation_->Hide(); | 62 animation_->Hide(); |
| 63 AnimationProgressed(animation_.get()); | 63 AnimationProgressed(animation_.get()); |
| 64 } else { | 64 } else { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (animation->GetCurrentValue() < 0.1) | 112 if (animation->GetCurrentValue() < 0.1) |
| 113 views::View::SetVisible(false); | 113 views::View::SetVisible(false); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void TrayItemView::AnimationCanceled(const ui::Animation* animation) { | 116 void TrayItemView::AnimationCanceled(const ui::Animation* animation) { |
| 117 AnimationEnded(animation); | 117 AnimationEnded(animation); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace internal | 120 } // namespace internal |
| 121 } // namespace ash | 121 } // namespace ash |
| OLD | NEW |