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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class FilePath; | 15 class FilePath; |
16 } | 16 } |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 class Image; | 19 class Image; |
20 } | 20 } |
21 | 21 |
| 22 class GURL; |
22 class SkBitmap; | 23 class SkBitmap; |
23 | 24 |
24 namespace profiles { | 25 namespace profiles { |
25 | 26 |
26 // Avatar access. | 27 // Avatar access. |
27 extern const char kGAIAPictureFileName[]; | 28 extern const char kGAIAPictureFileName[]; |
28 extern const char kHighResAvatarFolderName[]; | 29 extern const char kHighResAvatarFolderName[]; |
29 | 30 |
30 // Avatar formatting. | 31 // Avatar formatting. |
31 extern const int kAvatarIconWidth; | 32 extern const int kAvatarIconWidth; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Returns a URL for the default avatar icon with specified index. | 87 // Returns a URL for the default avatar icon with specified index. |
87 std::string GetDefaultAvatarIconUrl(size_t index); | 88 std::string GetDefaultAvatarIconUrl(size_t index); |
88 | 89 |
89 // Checks if |index| is a valid avatar icon index | 90 // Checks if |index| is a valid avatar icon index |
90 bool IsDefaultAvatarIconIndex(size_t index); | 91 bool IsDefaultAvatarIconIndex(size_t index); |
91 | 92 |
92 // Checks if the given URL points to one of the default avatar icons. If it | 93 // Checks if the given URL points to one of the default avatar icons. If it |
93 // is, returns true and its index through |icon_index|. If not, returns false. | 94 // is, returns true and its index through |icon_index|. If not, returns false. |
94 bool IsDefaultAvatarIconUrl(const std::string& icon_url, size_t *icon_index); | 95 bool IsDefaultAvatarIconUrl(const std::string& icon_url, size_t *icon_index); |
95 | 96 |
| 97 // Given an image URL this function builds a new URL set to |thumbnail_size|. |
| 98 // For example, if |thumbnail_size| was set to 256 and |old_url| was either: |
| 99 // https://example.com/--Abc/AAAAAAAAAAI/AAAAAAAAACQ/Efg/photo.jpg |
| 100 // or |
| 101 // https://example.com/--Abc/AAAAAAAAAAI/AAAAAAAAACQ/Efg/s64-c/photo.jpg |
| 102 // then return value in |new_url| would be: |
| 103 // https://example.com/--Abc/AAAAAAAAAAI/AAAAAAAAACQ/Efg/s256-c/photo.jpg |
| 104 bool GetImageURLWithThumbnailSize( |
| 105 const GURL& old_url, int thumbnail_size, GURL* new_url); |
| 106 |
96 } // namespace profiles | 107 } // namespace profiles |
97 | 108 |
98 #endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ | 109 #endif // CHROME_BROWSER_PROFILES_PROFILE_AVATAR_ICON_UTIL_H_ |
OLD | NEW |