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

Unified Diff: ash/system/tray/tray_item_view.cc

Issue 1877543002: Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update and cleanup tests. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/tray/tray_image_item.cc ('k') | ash/system/tray/tray_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tray_item_view.cc
diff --git a/ash/system/tray/tray_item_view.cc b/ash/system/tray/tray_item_view.cc
index a1a749aed7805eb5357d46b1895838ef0ac47a1f..829360f5d1ea29842119bd8c672e0474d5968df6 100644
--- a/ash/system/tray/tray_item_view.cc
+++ b/ash/system/tray/tray_item_view.cc
@@ -5,6 +5,7 @@
#include "ash/system/tray/tray_item_view.h"
#include "ash/shelf/shelf_types.h"
+#include "ash/shelf/shelf_util.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_item.h"
#include "ui/compositor/layer.h"
@@ -85,13 +86,13 @@ int TrayItemView::GetAnimationDurationMS() {
gfx::Size TrayItemView::GetPreferredSize() const {
gfx::Size size = DesiredSize();
- if (owner()->system_tray()->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM)
+ if (IsHorizontalAlignment(owner()->system_tray()->shelf_alignment()))
size.set_height(kTrayIconHeight);
else
size.set_width(kTrayIconWidth);
if (!animation_.get() || !animation_->is_animating())
return size;
- if (owner()->system_tray()->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) {
+ if (IsHorizontalAlignment(owner()->system_tray()->shelf_alignment())) {
size.set_width(std::max(1,
static_cast<int>(size.width() * animation_->GetCurrentValue())));
} else {
@@ -111,7 +112,7 @@ void TrayItemView::ChildPreferredSizeChanged(views::View* child) {
void TrayItemView::AnimationProgressed(const gfx::Animation* animation) {
gfx::Transform transform;
- if (owner()->system_tray()->shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) {
+ if (IsHorizontalAlignment(owner()->system_tray()->shelf_alignment())) {
transform.Translate(0, animation->CurrentValueBetween(
static_cast<double>(height()) / 2, 0.));
} else {
« no previous file with comments | « ash/system/tray/tray_image_item.cc ('k') | ash/system/tray/tray_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698