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/public/cpp/shelf_types.h" | 7 #include "ash/public/cpp/shelf_types.h" |
8 #include "ash/shelf/wm_shelf.h" | 8 #include "ash/shelf/wm_shelf.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 animation_->Show(); | 76 animation_->Show(); |
77 AnimationProgressed(animation_.get()); | 77 AnimationProgressed(animation_.get()); |
78 views::View::SetVisible(true); | 78 views::View::SetVisible(true); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 int TrayItemView::GetAnimationDurationMS() { | 82 int TrayItemView::GetAnimationDurationMS() { |
83 return kTrayItemAnimationDurationMS; | 83 return kTrayItemAnimationDurationMS; |
84 } | 84 } |
85 | 85 |
86 gfx::Size TrayItemView::GetPreferredSize() const { | 86 gfx::Size TrayItemView::CalculatePreferredSize() const { |
87 DCHECK_EQ(1, child_count()); | 87 DCHECK_EQ(1, child_count()); |
88 gfx::Size inner_size = views::View::GetPreferredSize(); | 88 gfx::Size inner_size = views::View::GetPreferredSize(); |
89 if (image_view_) | 89 if (image_view_) |
90 inner_size = gfx::Size(kTrayIconSize, kTrayIconSize); | 90 inner_size = gfx::Size(kTrayIconSize, kTrayIconSize); |
91 gfx::Rect rect(inner_size); | 91 gfx::Rect rect(inner_size); |
92 rect.Inset(gfx::Insets(-kTrayImageItemPadding)); | 92 rect.Inset(gfx::Insets(-kTrayImageItemPadding)); |
93 gfx::Size size = rect.size(); | 93 gfx::Size size = rect.size(); |
94 if (!animation_.get() || !animation_->is_animating()) | 94 if (!animation_.get() || !animation_->is_animating()) |
95 return size; | 95 return size; |
96 if (owner()->system_tray()->shelf()->IsHorizontalAlignment()) { | 96 if (owner()->system_tray()->shelf()->IsHorizontalAlignment()) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 void TrayItemView::AnimationEnded(const gfx::Animation* animation) { | 129 void TrayItemView::AnimationEnded(const gfx::Animation* animation) { |
130 if (animation->GetCurrentValue() < 0.1) | 130 if (animation->GetCurrentValue() < 0.1) |
131 views::View::SetVisible(false); | 131 views::View::SetVisible(false); |
132 } | 132 } |
133 | 133 |
134 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) { | 134 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) { |
135 AnimationEnded(animation); | 135 AnimationEnded(animation); |
136 } | 136 } |
137 | 137 |
138 } // namespace ash | 138 } // namespace ash |
OLD | NEW |