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

Side by Side 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 unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ 4 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_
5 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ 5 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "components/bookmarks/browser/bookmark_model_observer.h" 10 #include "components/bookmarks/browser/bookmark_model_observer.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const std::set<GURL>& removed_urls) override; 81 const std::set<GURL>& removed_urls) override;
82 82
83 protected: 83 protected:
84 // Returns true if the image for the page_url is currently being fetched. 84 // Returns true if the image for the page_url is currently being fetched.
85 bool IsPageUrlInProgress(const GURL& page_url); 85 bool IsPageUrlInProgress(const GURL& page_url);
86 86
87 // Stores the image to local storage. If update_bookmarks is true, relates the 87 // Stores the image to local storage. If update_bookmarks is true, relates the
88 // corresponding bookmark to image_url. 88 // corresponding bookmark to image_url.
89 void ProcessNewImage(const GURL& page_url, 89 void ProcessNewImage(const GURL& page_url,
90 bool update_bookmarks, 90 bool update_bookmarks,
91 const gfx::Image& image, 91 const GURL& image_url,
92 const GURL& image_url); 92 const gfx::Image& image);
93 93
94 // Sets a new image for a bookmark. If the given page_url is bookmarked and 94 // Sets a new image for a bookmark. If the given page_url is bookmarked and
95 // the image is retrieved from the image_url, then the image is locally 95 // the image is retrieved from the image_url, then the image is locally
96 // stored. If update_bookmark is true the URL is also added to the bookmark. 96 // stored. If update_bookmark is true the URL is also added to the bookmark.
97 // This is the only method subclass needs to implement. 97 // This is the only method subclass needs to implement.
98 virtual void RetrieveSalientImage( 98 virtual void RetrieveSalientImage(
99 const GURL& page_url, 99 const GURL& page_url,
100 const GURL& image_url, 100 const GURL& image_url,
101 const std::string& referrer, 101 const std::string& referrer,
102 net::URLRequest::ReferrerPolicy referrer_policy, 102 net::URLRequest::ReferrerPolicy referrer_policy,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 // The worker pool to enqueue the requests onto. 177 // The worker pool to enqueue the requests onto.
178 scoped_refptr<base::SequencedWorkerPool> pool_; 178 scoped_refptr<base::SequencedWorkerPool> pool_;
179 DISALLOW_COPY_AND_ASSIGN(BookmarkImageService); 179 DISALLOW_COPY_AND_ASSIGN(BookmarkImageService);
180 }; 180 };
181 181
182 } // namespace enhanced_bookmarks 182 } // namespace enhanced_bookmarks
183 183
184 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ 184 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_
185 185
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698