Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1188)

Unified Diff: chrome/browser/extensions/bookmark_app_helper.h

Issue 1066623008: Sync bookmark app icon urls and sizes, and download icons for new apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated sync value conversions Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/app_sync_data.cc ('k') | chrome/browser/extensions/bookmark_app_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b29159ed090b97baab9b9d6d96b70213d6773feb 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,35 @@ 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| with the image data of any icon from
+ // |bitmap_map| that has a URL and size matching that in |web_app_info|, as
+ // well as adding any new images from |bitmap_map| that have no URL.
+ 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);
« no previous file with comments | « chrome/browser/extensions/app_sync_data.cc ('k') | chrome/browser/extensions/bookmark_app_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698