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 "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
10 | 10 |
11 namespace profiles { | 11 namespace profiles { |
12 | 12 |
13 // Avatar access. | 13 // Avatar access. |
14 extern const char kGAIAPictureFileName[]; | 14 extern const char kGAIAPictureFileName[]; |
15 extern const char kHighResAvatarFolderName[]; | 15 extern const char kHighResAvatarFolderName[]; |
16 | 16 |
17 // Avatar formatting. | 17 // Avatar formatting. |
18 extern const int kAvatarIconWidth; | 18 extern const int kAvatarIconWidth; |
19 extern const int kAvatarIconHeight; | 19 extern const int kAvatarIconHeight; |
20 extern const int kAvatarIconPadding; | 20 extern const int kAvatarIconPadding; |
21 extern const SkColor kAvatarTutorialBackgroundColor; | 21 extern const SkColor kAvatarTutorialBackgroundColor; |
22 extern const SkColor kAvatarTutorialContentTextColor; | 22 extern const SkColor kAvatarTutorialContentTextColor; |
| 23 extern const SkColor kAvatarBubbleAccountsBackgroundColor; |
| 24 extern const SkColor kAvatarBubbleButtonHighlightColor; |
23 | 25 |
24 // Gets the number of default avatar icons that exist. | 26 // Gets the number of default avatar icons that exist. |
25 size_t GetDefaultAvatarIconCount(); | 27 size_t GetDefaultAvatarIconCount(); |
26 | 28 |
27 // Gets the number of generic avatar icons that exist. | 29 // Gets the number of generic avatar icons that exist. |
28 size_t GetGenericAvatarIconCount(); | 30 size_t GetGenericAvatarIconCount(); |
29 | 31 |
30 // Gets the resource ID of the default avatar icon at |index|. | 32 // Gets the resource ID of the default avatar icon at |index|. |
31 int GetDefaultAvatarIconResourceIDAtIndex(size_t index); | 33 int GetDefaultAvatarIconResourceIDAtIndex(size_t index); |
32 | 34 |
33 // Gets the resource filename of the default avatar icon at |index|. | 35 // Gets the resource filename of the default avatar icon at |index|. |
34 const char* GetDefaultAvatarIconFileNameAtIndex(size_t index); | 36 const char* GetDefaultAvatarIconFileNameAtIndex(size_t index); |
35 | 37 |
36 // Returns a URL for the default avatar icon with specified index. | 38 // Returns a URL for the default avatar icon with specified index. |
37 std::string GetDefaultAvatarIconUrl(size_t index); | 39 std::string GetDefaultAvatarIconUrl(size_t index); |
38 | 40 |
39 // Checks if |index| is a valid avatar icon index | 41 // Checks if |index| is a valid avatar icon index |
40 bool IsDefaultAvatarIconIndex(size_t index); | 42 bool IsDefaultAvatarIconIndex(size_t index); |
41 | 43 |
42 // Checks if the given URL points to one of the default avatar icons. If it | 44 // Checks if the given URL points to one of the default avatar icons. If it |
43 // is, returns true and its index through |icon_index|. If not, returns false. | 45 // is, returns true and its index through |icon_index|. If not, returns false. |
44 bool IsDefaultAvatarIconUrl(const std::string& icon_url, size_t *icon_index); | 46 bool IsDefaultAvatarIconUrl(const std::string& icon_url, size_t *icon_index); |
45 // Returns a version of |image| of a specific size and with a grey border. | 47 // Returns a version of |image| of a specific size. Note that no checks are |
46 // Note that no checks are done on the width/height so make sure they're | 48 // done on the width/height so make sure they're reasonable values; in the |
47 // reasonable values; in the range of 16-256 is probably best. | 49 // range of 16-256 is probably best. |
48 gfx::Image GetSizedAvatarIconWithBorder(const gfx::Image& image, | 50 gfx::Image GetSizedAvatarIcon(const gfx::Image& image, |
49 bool is_rectangle, | 51 bool is_rectangle, |
50 int width, int height); | 52 int width, int height); |
51 | 53 |
52 // Returns a version of |image| suitable for use in menus. | 54 // Returns a version of |image| suitable for use in menus. |
53 gfx::Image GetAvatarIconForMenu(const gfx::Image& image, | 55 gfx::Image GetAvatarIconForMenu(const gfx::Image& image, |
54 bool is_rectangle); | 56 bool is_rectangle); |
55 | 57 |
56 // Returns a version of |image| suitable for use in WebUI. | 58 // Returns a version of |image| suitable for use in WebUI. |
57 gfx::Image GetAvatarIconForWebUI(const gfx::Image& image, | 59 gfx::Image GetAvatarIconForWebUI(const gfx::Image& image, |
58 bool is_rectangle); | 60 bool is_rectangle); |
59 | 61 |
60 // Returns a version of |image| suitable for use in title bars. The returned | 62 // Returns a version of |image| suitable for use in title bars. The returned |
61 // image is scaled to fit |dst_width| and |dst_height|. | 63 // image is scaled to fit |dst_width| and |dst_height|. |
62 gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image, | 64 gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image, |
63 bool is_rectangle, | 65 bool is_rectangle, |
64 int dst_width, | 66 int dst_width, |
65 int dst_height); | 67 int dst_height); |
66 | 68 |
67 } // namespace profiles | 69 } // namespace profiles |
68 | 70 |
69 #endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ | 71 #endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ |
OLD | NEW |