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

Side by Side Diff: ash/common/system/user/rounded_image_view.h

Issue 2732813002: chromeos: Move files in //ash/common to //ash, part 1 (Closed)
Patch Set: rebase 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
« no previous file with comments | « ash/common/system/user/login_status.cc ('k') | ash/common/system/user/rounded_image_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ASH_COMMON_SYSTEM_USER_ROUNDED_IMAGE_VIEW_H_
6 #define ASH_COMMON_SYSTEM_USER_ROUNDED_IMAGE_VIEW_H_
7
8 #include "base/macros.h"
9 #include "ui/gfx/geometry/size.h"
10 #include "ui/gfx/image/image_skia.h"
11 #include "ui/views/view.h"
12
13 namespace ash {
14 namespace tray {
15
16 // A custom image view with rounded edges.
17 class RoundedImageView : public views::View {
18 public:
19 // Constructs a new rounded image view with rounded corners of radius
20 // |corner_radius|.
21 explicit RoundedImageView(int corner_radius);
22 ~RoundedImageView() override;
23
24 // Set the image that should be displayed. The image contents is copied to the
25 // receiver's image.
26 void SetImage(const gfx::ImageSkia& img, const gfx::Size& size);
27
28 // Set the radii of the corners independently.
29 void SetCornerRadii(int top_left,
30 int top_right,
31 int bottom_right,
32 int bottom_left);
33
34 // Overridden from views::View.
35 gfx::Size GetPreferredSize() const override;
36 void OnPaint(gfx::Canvas* canvas) override;
37
38 private:
39 gfx::ImageSkia image_;
40 gfx::ImageSkia resized_;
41 gfx::Size image_size_;
42 int corner_radius_[4];
43
44 DISALLOW_COPY_AND_ASSIGN(RoundedImageView);
45 };
46
47 } // namespace tray
48 } // namespace ash
49
50 #endif // ASH_COMMON_SYSTEM_USER_ROUNDED_IMAGE_VIEW_H_
OLDNEW
« no previous file with comments | « ash/common/system/user/login_status.cc ('k') | ash/common/system/user/rounded_image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698