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

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

Issue 2465403002: Some more fixes to cros system tray icons (esp. screen tray items) (Closed)
Patch Set: Created 4 years, 1 month 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 gfx::Size size; 85 gfx::Size size;
86 DCHECK_EQ(1, child_count());
tdanderson 2016/11/01 20:25:08 Can you please add documentation somewhere in tray
Evan Stade 2016/11/01 23:45:17 Done.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698