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

Unified Diff: ash/system/user/tray_user.cc

Issue 9969068: ash: Animate changes in the uber tray. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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_update.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/user/tray_user.cc
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc
index d50d12ea8bc9511291b512dc146dfafc0d6c6468..0895d3bfacaea69bbeab863febd15b937ce19fcd 100644
--- a/ash/system/user/tray_user.cc
+++ b/ash/system/user/tray_user.cc
@@ -7,6 +7,7 @@
#include "ash/shell.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/tray_constants.h"
+#include "ash/system/tray/tray_item_view.h"
#include "ash/system/tray/tray_views.h"
#include "base/utf_string_conversions.h"
#include "grit/ash_strings.h"
@@ -183,7 +184,7 @@ class UserView : public views::View,
};
// A custom image view with rounded edges.
-class RoundedImageView : public views::View {
+class RoundedImageView : public TrayItemView {
public:
// Constructs a new rounded image view with rounded corners of radius
// |corner_radius|.
@@ -202,19 +203,26 @@ class RoundedImageView : public views::View {
// Try to get the best image quality for the avatar.
resized_ = skia::ImageOperations::Resize(image_,
skia::ImageOperations::RESIZE_BEST, size.width(), size.height());
- PreferredSizeChanged();
- SchedulePaint();
+ if (GetWidget() && visible()) {
+ PreferredSizeChanged();
+ SchedulePaint();
+ }
}
- // Overridden from views::View.
- virtual gfx::Size GetPreferredSize() OVERRIDE {
+ // Overridden from TrayItemView.
+ virtual gfx::Size DesiredSize() OVERRIDE {
return gfx::Size(image_size_.width() + GetInsets().width(),
image_size_.height() + GetInsets().height());
}
+ virtual int GetAnimationDurationMS() OVERRIDE {
+ return 750;
+ }
+
+ // Overridden from views::View.
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
View::OnPaint(canvas);
- gfx::Rect image_bounds(GetPreferredSize());
+ gfx::Rect image_bounds(DesiredSize());
image_bounds.Inset(GetInsets());
const SkScalar kRadius = SkIntToScalar(corner_radius_);
SkPath path;
« no previous file with comments | « ash/system/tray_update.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698