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

Unified Diff: components/enhanced_bookmarks/bookmark_image_service.h

Issue 916783003: Restrict salient image size before storing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: components/enhanced_bookmarks/bookmark_image_service.h
diff --git a/components/enhanced_bookmarks/bookmark_image_service.h b/components/enhanced_bookmarks/bookmark_image_service.h
index 8ec1fa8a86251fc1f9d4c9520e83a8775efd84d4..2075439d728ccf29231aca9eb72f12649dba2798 100644
--- a/components/enhanced_bookmarks/bookmark_image_service.h
+++ b/components/enhanced_bookmarks/bookmark_image_service.h
@@ -84,17 +84,20 @@ class BookmarkImageService : public KeyedService,
// Returns true if the image for the page_url is currently being fetched.
bool IsPageUrlInProgress(const GURL& page_url);
- // Stores the image to local storage. If update_bookmarks is true, relates the
- // corresponding bookmark to image_url.
+ // Resizes the image, stores the new image to local storage. If
+ // update_bookmarks is true, relates the corresponding bookmark to image_url.
void ProcessNewImage(const GURL& page_url,
bool update_bookmarks,
- const gfx::Image& image,
- const GURL& image_url);
+ const GURL& image_url,
+ const gfx::Image& image);
+
+ // Resizes large images to proper size that fits device display. This method
+ // should _not_ run on the UI thread.
+ virtual gfx::Image ResizeImage(gfx::Image image) = 0;
// Sets a new image for a bookmark. If the given page_url is bookmarked and
// the image is retrieved from the image_url, then the image is locally
// stored. If update_bookmark is true the URL is also added to the bookmark.
- // This is the only method subclass needs to implement.
virtual void RetrieveSalientImage(
const GURL& page_url,
const GURL& image_url,
@@ -122,6 +125,12 @@ class BookmarkImageService : public KeyedService,
// Processes the requests that have been waiting on an image.
void ProcessRequests(const GURL& page_url, const ImageRecord& image);
+ // Implements the private UI-thread logics for ProcessNewImage().
+ void ProcessNewImageInternal(const GURL& page_url,
+ bool update_bookmarks,
+ const GURL& image_url,
+ const gfx::Image& image);
+
// Once an image is retrieved this method updates the store with it. Returns
// the newly formed ImageRecord. This is typically called on |pool_|, the
// background sequenced worker pool for this object.

Powered by Google App Engine
This is Rietveld 408576698