Chromium Code Reviews| Index: chrome/browser/extensions/bookmark_app_helper.h |
| diff --git a/chrome/browser/extensions/bookmark_app_helper.h b/chrome/browser/extensions/bookmark_app_helper.h |
| index 3a47947d57f8cb3bad0577848dfc237520312300..9c7ec10d81e86c5b3ae857b39dbbc2df9a5ee5be 100644 |
| --- a/chrome/browser/extensions/bookmark_app_helper.h |
| +++ b/chrome/browser/extensions/bookmark_app_helper.h |
| @@ -34,6 +34,15 @@ class Extension; |
| // A helper class for creating bookmark apps from a WebContents. |
| class BookmarkAppHelper : public content::NotificationObserver { |
| public: |
| + struct BitmapAndSource { |
| + BitmapAndSource(); |
| + BitmapAndSource(const GURL& source_url_p, const SkBitmap& bitmap_p); |
| + ~BitmapAndSource(); |
| + |
| + GURL source_url; |
| + SkBitmap bitmap; |
| + }; |
| + |
| typedef base::Callback<void(const Extension*, const WebApplicationInfo&)> |
| CreateBookmarkAppCallback; |
| @@ -56,18 +65,34 @@ class BookmarkAppHelper : public content::NotificationObserver { |
| // |sizes| and resizes it to that size. This returns a map of sizes to bitmaps |
| // which contains only bitmaps of a size in |sizes| and at most one bitmap of |
| // each size. |
| - static std::map<int, SkBitmap> ConstrainBitmapsToSizes( |
| - const std::vector<SkBitmap>& bitmaps, |
| + static std::map<int, BitmapAndSource> ConstrainBitmapsToSizes( |
| + const std::vector<BitmapAndSource>& bitmaps, |
| const std::set<int>& sizes); |
| // Adds a square container icon of |output_size| pixels to |bitmaps| by |
| // drawing the given |letter| into a rounded background of |color|. |
| // Does nothing if an icon of |output_size| already exists in |bitmaps|. |
| - static void GenerateIcon(std::map<int, SkBitmap>* bitmaps, |
| + static void GenerateIcon(std::map<int, BitmapAndSource>* bitmaps, |
| int output_size, |
| SkColor color, |
| char letter); |
| + // Resize icons to the accepted sizes, and generate any that are missing. Does |
| + // not update |web_app_info| except to update |generated_icon_color|. |
| + static std::map<int, BitmapAndSource> ResizeIconsAndGenerateMissing( |
| + std::vector<BitmapAndSource> icons, |
| + WebApplicationInfo* web_app_info); |
| + |
| + // It is important that the linked app information in any extension that |
| + // gets created from sync matches the linked app information that came from |
| + // sync. If there are any changes, they will be synced back to other devices |
| + // and could potentially create a never ending sync cycle. |
| + // This function updates |web_app_info| by copying over the image data of any |
| + // icon from |
|
calamity
2015/04/28 06:56:35
Nit: sentence fragment.
benwells
2015/04/28 08:10:56
Done.
|
| + static void UpdateWebAppIconsWithoutChangingLinks( |
| + std::map<int, BookmarkAppHelper::BitmapAndSource> bitmap_map, |
| + WebApplicationInfo* web_app_info); |
| + |
| // Begins the asynchronous bookmark app creation. |
| void Create(const CreateBookmarkAppCallback& callback); |