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

Unified Diff: ash/system/user/rounded_image_view.h

Issue 210903003: Implemented system tray UI for new account management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge conflicts resolved. Created 6 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/user/config.cc ('k') | ash/system/user/rounded_image_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/user/rounded_image_view.h
diff --git a/ash/system/user/rounded_image_view.h b/ash/system/user/rounded_image_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..5723d3752623420cbb671f7201659b5dd97d16ff
--- /dev/null
+++ b/ash/system/user/rounded_image_view.h
@@ -0,0 +1,55 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SYSTEM_USER_ROUNDED_IMAGE_VIEW_H_
+#define ASH_SYSTEM_USER_ROUNDED_IMAGE_VIEW_H_
+
+#include "base/macros.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/image/image_skia.h"
+#include "ui/views/view.h"
+
+namespace ash {
+namespace tray {
+
+// A custom image view with rounded edges.
+class RoundedImageView : public views::View {
+ public:
+ // Constructs a new rounded image view with rounded corners of radius
+ // |corner_radius|. If |active_user| is set, the icon will be drawn in
+ // full colors - otherwise it will fade into the background.
+ RoundedImageView(int corner_radius, bool active_user);
+ virtual ~RoundedImageView();
+
+ // Set the image that should be displayed. The image contents is copied to the
+ // receiver's image.
+ void SetImage(const gfx::ImageSkia& img, const gfx::Size& size);
+
+ // Set the radii of the corners independently.
+ void SetCornerRadii(int top_left,
+ int top_right,
+ int bottom_right,
+ int bottom_left);
+
+ private:
+ // Overridden from views::View.
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
+
+ gfx::ImageSkia image_;
+ gfx::ImageSkia resized_;
+ gfx::Size image_size_;
+ int corner_radius_[4];
+
+ // True if the given user is the active user and the icon should get
+ // painted as active.
+ bool active_user_;
+
+ DISALLOW_COPY_AND_ASSIGN(RoundedImageView);
+};
+
+} // namespace tray
+} // namespace ash
+
+#endif // ASH_SYSTEM_USER_ROUNDED_IMAGE_VIEW_H_
« no previous file with comments | « ash/system/user/config.cc ('k') | ash/system/user/rounded_image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698