| 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_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 virtual ~BookmarkAppHelper(); | 44 virtual ~BookmarkAppHelper(); |
| 45 | 45 |
| 46 // This finds the closest not-smaller bitmap in |bitmaps| for each size in | 46 // This finds the closest not-smaller bitmap in |bitmaps| for each size in |
| 47 // |sizes| and resizes it to that size. This returns a map of sizes to bitmaps | 47 // |sizes| and resizes it to that size. This returns a map of sizes to bitmaps |
| 48 // which contains only bitmaps of a size in |sizes| and at most one bitmap of | 48 // which contains only bitmaps of a size in |sizes| and at most one bitmap of |
| 49 // each size. | 49 // each size. |
| 50 static std::map<int, SkBitmap> ConstrainBitmapsToSizes( | 50 static std::map<int, SkBitmap> ConstrainBitmapsToSizes( |
| 51 const std::vector<SkBitmap>& bitmaps, | 51 const std::vector<SkBitmap>& bitmaps, |
| 52 const std::set<int>& sizes); | 52 const std::set<int>& sizes); |
| 53 | 53 |
| 54 // Gets the letter that will be painted on the generated icon. |
| 55 static char GetIconLetterForGeneratedIcon(const GURL& url); |
| 56 |
| 57 // Gets the color that will be used for the icon's background. |
| 58 static SkColor GetIconColorForGeneratedIcon(const SkBitmap& base_icon); |
| 59 |
| 54 // Adds a square container icon of |output_size| pixels to |bitmaps| by | 60 // Adds a square container icon of |output_size| pixels to |bitmaps| by |
| 55 // drawing the given |letter| into a rounded background of |color|. | 61 // drawing the given |letter| into a rounded background of |color|. |
| 56 // Does nothing if an icon of |output_size| already exists in |bitmaps|. | 62 // Does nothing if an icon of |output_size| already exists in |bitmaps|. |
| 57 static void GenerateIcon(std::map<int, SkBitmap>* bitmaps, | 63 static void GenerateIcon(std::map<int, SkBitmap>* bitmaps, |
| 58 int output_size, | 64 int output_size, |
| 59 SkColor color, | 65 SkColor color, |
| 60 char letter); | 66 char letter); |
| 61 | 67 |
| 62 // Begins the asynchronous bookmark app creation. | 68 // Begins the asynchronous bookmark app creation. |
| 63 void Create(const CreateBookmarkAppCallback& callback); | 69 void Create(const CreateBookmarkAppCallback& callback); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 content::BrowserContext* browser_context, | 109 content::BrowserContext* browser_context, |
| 104 const extensions::Extension* extension, | 110 const extensions::Extension* extension, |
| 105 const base::Callback<void(const WebApplicationInfo&)> callback); | 111 const base::Callback<void(const WebApplicationInfo&)> callback); |
| 106 | 112 |
| 107 // Returns whether the given |url| is a valid bookmark app url. | 113 // Returns whether the given |url| is a valid bookmark app url. |
| 108 bool IsValidBookmarkAppUrl(const GURL& url); | 114 bool IsValidBookmarkAppUrl(const GURL& url); |
| 109 | 115 |
| 110 } // namespace extensions | 116 } // namespace extensions |
| 111 | 117 |
| 112 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 118 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
| OLD | NEW |