| 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/common/system/tray/tray_item_view.h" | 5 #include "ash/common/system/tray/tray_item_view.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/shelf/wm_shelf_util.h" | 8 #include "ash/common/shelf/wm_shelf_util.h" |
| 9 #include "ash/common/system/tray/system_tray.h" | 9 #include "ash/common/system/tray/system_tray.h" |
| 10 #include "ash/common/system/tray/system_tray_item.h" | 10 #include "ash/common/system/tray/system_tray_item.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 AnimationProgressed(animation_.get()); | 75 AnimationProgressed(animation_.get()); |
| 76 views::View::SetVisible(true); | 76 views::View::SetVisible(true); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 int TrayItemView::GetAnimationDurationMS() { | 80 int TrayItemView::GetAnimationDurationMS() { |
| 81 return kTrayItemAnimationDurationMS; | 81 return kTrayItemAnimationDurationMS; |
| 82 } | 82 } |
| 83 | 83 |
| 84 gfx::Size TrayItemView::GetPreferredSize() const { | 84 gfx::Size TrayItemView::GetPreferredSize() const { |
| 85 DCHECK_EQ(1, child_count()); |
| 85 gfx::Size size; | 86 gfx::Size size; |
| 86 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { | 87 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { |
| 87 gfx::Size inner_size = views::View::GetPreferredSize(); | 88 gfx::Size inner_size = views::View::GetPreferredSize(); |
| 88 if (image_view_ && child_count() == 1) | 89 if (image_view_) |
| 89 inner_size = gfx::Size(kTrayIconSize, kTrayIconSize); | 90 inner_size = gfx::Size(kTrayIconSize, kTrayIconSize); |
| 90 gfx::Rect rect(inner_size); | 91 gfx::Rect rect(inner_size); |
| 91 rect.Inset(gfx::Insets(-GetTrayConstant(TRAY_IMAGE_ITEM_PADDING))); | 92 rect.Inset(gfx::Insets(-GetTrayConstant(TRAY_IMAGE_ITEM_PADDING))); |
| 92 size = rect.size(); | 93 size = rect.size(); |
| 93 } else { | 94 } else { |
| 94 size = views::View::GetPreferredSize(); | 95 size = views::View::GetPreferredSize(); |
| 95 if (IsHorizontalAlignment(owner()->system_tray()->shelf_alignment())) | 96 if (IsHorizontalAlignment(owner()->system_tray()->shelf_alignment())) |
| 96 size.set_height(kTrayIconHeight); | 97 size.set_height(kTrayIconHeight); |
| 97 else | 98 else |
| 98 size.set_width(kTrayIconWidth); | 99 size.set_width(kTrayIconWidth); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void TrayItemView::AnimationEnded(const gfx::Animation* animation) { | 136 void TrayItemView::AnimationEnded(const gfx::Animation* animation) { |
| 136 if (animation->GetCurrentValue() < 0.1) | 137 if (animation->GetCurrentValue() < 0.1) |
| 137 views::View::SetVisible(false); | 138 views::View::SetVisible(false); |
| 138 } | 139 } |
| 139 | 140 |
| 140 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) { | 141 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) { |
| 141 AnimationEnded(animation); | 142 AnimationEnded(animation); |
| 142 } | 143 } |
| 143 | 144 |
| 144 } // namespace ash | 145 } // namespace ash |
| OLD | NEW |