Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: ash/system/tray/tray_item_view.cc

Issue 13925006: Declares GetHeightForWidth() for those who need it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/tray/tray_item_view.h ('k') | ash/system/user/tray_user.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 size.set_height(kTrayIconHeight); 83 size.set_height(kTrayIconHeight);
84 else 84 else
85 size.set_width(kTrayIconWidth); 85 size.set_width(kTrayIconWidth);
86 if (!animation_.get() || !animation_->is_animating()) 86 if (!animation_.get() || !animation_->is_animating())
87 return size; 87 return size;
88 size.set_width(std::max(1, 88 size.set_width(std::max(1,
89 static_cast<int>(size.width() * animation_->GetCurrentValue()))); 89 static_cast<int>(size.width() * animation_->GetCurrentValue())));
90 return size; 90 return size;
91 } 91 }
92 92
93 int TrayItemView::GetHeightForWidth(int width) {
94 return GetPreferredSize().height();
95 }
96
93 void TrayItemView::ChildPreferredSizeChanged(views::View* child) { 97 void TrayItemView::ChildPreferredSizeChanged(views::View* child) {
94 PreferredSizeChanged(); 98 PreferredSizeChanged();
95 } 99 }
96 100
97 void TrayItemView::AnimationProgressed(const ui::Animation* animation) { 101 void TrayItemView::AnimationProgressed(const ui::Animation* animation) {
98 gfx::Transform transform; 102 gfx::Transform transform;
99 transform.Translate(0, animation->CurrentValueBetween( 103 transform.Translate(0, animation->CurrentValueBetween(
100 static_cast<double>(height()) / 2, 0.)); 104 static_cast<double>(height()) / 2, 0.));
101 transform.Scale(animation->GetCurrentValue(), 105 transform.Scale(animation->GetCurrentValue(),
102 animation->GetCurrentValue()); 106 animation->GetCurrentValue());
103 layer()->SetTransform(transform); 107 layer()->SetTransform(transform);
104 PreferredSizeChanged(); 108 PreferredSizeChanged();
105 } 109 }
106 110
107 void TrayItemView::AnimationEnded(const ui::Animation* animation) { 111 void TrayItemView::AnimationEnded(const ui::Animation* animation) {
108 if (animation->GetCurrentValue() < 0.1) 112 if (animation->GetCurrentValue() < 0.1)
109 views::View::SetVisible(false); 113 views::View::SetVisible(false);
110 } 114 }
111 115
112 void TrayItemView::AnimationCanceled(const ui::Animation* animation) { 116 void TrayItemView::AnimationCanceled(const ui::Animation* animation) {
113 AnimationEnded(animation); 117 AnimationEnded(animation);
114 } 118 }
115 119
116 } // namespace internal 120 } // namespace internal
117 } // namespace ash 121 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_item_view.h ('k') | ash/system/user/tray_user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698