OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class FilePath; | 13 class FilePath; |
14 } | 14 } |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Image; | 17 class Image; |
18 } | 18 } |
19 | 19 |
| 20 class SkBitmap; |
| 21 |
20 namespace profiles { | 22 namespace profiles { |
21 | 23 |
22 // Avatar access. | 24 // Avatar access. |
23 extern const char kGAIAPictureFileName[]; | 25 extern const char kGAIAPictureFileName[]; |
24 extern const char kHighResAvatarFolderName[]; | 26 extern const char kHighResAvatarFolderName[]; |
25 | 27 |
26 // Avatar formatting. | 28 // Avatar formatting. |
27 extern const int kAvatarIconWidth; | 29 extern const int kAvatarIconWidth; |
28 extern const int kAvatarIconHeight; | 30 extern const int kAvatarIconHeight; |
29 extern const SkColor kAvatarTutorialBackgroundColor; | 31 extern const SkColor kAvatarTutorialBackgroundColor; |
(...skipping 26 matching lines...) Expand all Loading... |
56 | 58 |
57 // Returns a URL for the default avatar icon with specified index. | 59 // Returns a URL for the default avatar icon with specified index. |
58 std::string GetDefaultAvatarIconUrl(size_t index); | 60 std::string GetDefaultAvatarIconUrl(size_t index); |
59 | 61 |
60 // Checks if |index| is a valid avatar icon index | 62 // Checks if |index| is a valid avatar icon index |
61 bool IsDefaultAvatarIconIndex(size_t index); | 63 bool IsDefaultAvatarIconIndex(size_t index); |
62 | 64 |
63 // Checks if the given URL points to one of the default avatar icons. If it | 65 // Checks if the given URL points to one of the default avatar icons. If it |
64 // is, returns true and its index through |icon_index|. If not, returns false. | 66 // is, returns true and its index through |icon_index|. If not, returns false. |
65 bool IsDefaultAvatarIconUrl(const std::string& icon_url, size_t *icon_index); | 67 bool IsDefaultAvatarIconUrl(const std::string& icon_url, size_t *icon_index); |
| 68 |
66 // Returns a version of |image| of a specific size. Note that no checks are | 69 // Returns a version of |image| of a specific size. Note that no checks are |
67 // done on the width/height so make sure they're reasonable values; in the | 70 // done on the width/height so make sure they're reasonable values; in the |
68 // range of 16-256 is probably best. | 71 // range of 16-256 is probably best. |
69 gfx::Image GetSizedAvatarIcon(const gfx::Image& image, | 72 gfx::Image GetSizedAvatarIcon(const gfx::Image& image, |
70 bool is_rectangle, | 73 bool is_rectangle, |
71 int width, int height); | 74 int width, int height); |
72 | 75 |
73 // Returns a version of |image| suitable for use in menus. | 76 // Returns a version of |image| suitable for use in menus. |
74 gfx::Image GetAvatarIconForMenu(const gfx::Image& image, | 77 gfx::Image GetAvatarIconForMenu(const gfx::Image& image, |
75 bool is_rectangle); | 78 bool is_rectangle); |
76 | 79 |
77 // Returns a version of |image| suitable for use in WebUI. | 80 // Returns a version of |image| suitable for use in WebUI. |
78 gfx::Image GetAvatarIconForWebUI(const gfx::Image& image, | 81 gfx::Image GetAvatarIconForWebUI(const gfx::Image& image, |
79 bool is_rectangle); | 82 bool is_rectangle); |
80 | 83 |
81 // Returns a version of |image| suitable for use in title bars. The returned | 84 // Returns a version of |image| suitable for use in title bars. The returned |
82 // image is scaled to fit |dst_width| and |dst_height|. | 85 // image is scaled to fit |dst_width| and |dst_height|. |
83 gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image, | 86 gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image, |
84 bool is_rectangle, | 87 bool is_rectangle, |
85 int dst_width, | 88 int dst_width, |
86 int dst_height); | 89 int dst_height); |
87 | 90 |
| 91 // Returns a bitmap with a couple of columns shaved off so it is more square, |
| 92 // so that when resized to a square aspect ratio it looks pretty. |
| 93 SkBitmap GetAvatarIconAsSquare(const SkBitmap& bitmap, int scale_factor); |
| 94 |
88 } // namespace profiles | 95 } // namespace profiles |
89 | 96 |
90 #endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ | 97 #endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ |
OLD | NEW |