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

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

Issue 2709903004: Consolidate some more ash tray constants. (Closed)
Patch Set: rebase/review Created 3 years, 9 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
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/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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 gfx::Size TrayItemView::GetPreferredSize() const { 89 gfx::Size TrayItemView::GetPreferredSize() const {
90 DCHECK_EQ(1, child_count()); 90 DCHECK_EQ(1, child_count());
91 gfx::Size size; 91 gfx::Size size;
92 if (UseMd()) { 92 if (UseMd()) {
93 gfx::Size inner_size = views::View::GetPreferredSize(); 93 gfx::Size inner_size = views::View::GetPreferredSize();
94 if (image_view_) 94 if (image_view_)
95 inner_size = gfx::Size(kTrayIconSize, kTrayIconSize); 95 inner_size = gfx::Size(kTrayIconSize, kTrayIconSize);
96 gfx::Rect rect(inner_size); 96 gfx::Rect rect(inner_size);
97 rect.Inset(gfx::Insets(-GetTrayConstant(TRAY_IMAGE_ITEM_PADDING))); 97 rect.Inset(gfx::Insets(-kTrayImageItemPadding));
98 size = rect.size(); 98 size = rect.size();
99 } else { 99 } else {
100 size = views::View::GetPreferredSize(); 100 size = views::View::GetPreferredSize();
101 if (IsHorizontalAlignment(owner()->system_tray()->shelf_alignment())) 101 if (IsHorizontalAlignment(owner()->system_tray()->shelf_alignment()))
102 size.set_height(kTrayIconHeight); 102 size.set_height(kTrayIconHeight);
103 else 103 else
104 size.set_width(kTrayIconWidth); 104 size.set_width(kTrayIconWidth);
105 } 105 }
106 if (!animation_.get() || !animation_->is_animating()) 106 if (!animation_.get() || !animation_->is_animating())
107 return size; 107 return size;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void TrayItemView::AnimationEnded(const gfx::Animation* animation) { 141 void TrayItemView::AnimationEnded(const gfx::Animation* animation) {
142 if (animation->GetCurrentValue() < 0.1) 142 if (animation->GetCurrentValue() < 0.1)
143 views::View::SetVisible(false); 143 views::View::SetVisible(false);
144 } 144 }
145 145
146 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) { 146 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) {
147 AnimationEnded(animation); 147 AnimationEnded(animation);
148 } 148 }
149 149
150 } // namespace ash 150 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_constants.cc ('k') | ash/common/system/tray/tray_popup_header_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698