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

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: use pixel instead of dp 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..0aa385bbc8dbf6449b428044c0d44e981e89f158 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.
+ // 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,
@@ -125,9 +128,9 @@ class BookmarkImageService : public KeyedService,
// 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.
- ImageRecord StoreImage(const gfx::Image& image,
- const GURL& image_url,
- const GURL& page_url);
+ ImageRecord ResizeAndStoreImage(const gfx::Image& image,
+ const GURL& image_url,
+ const GURL& page_url);
// Calls |StoreImage| in the background. This should only be called from the
// main thread.

Powered by Google App Engine
This is Rietveld 408576698