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

Unified Diff: components/favicon/core/large_icon_service.h

Issue 2784233003: [LargeIconService] Allow decoding of images in the service (Closed)
Patch Set: Minor changes Created 3 years, 9 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/favicon/core/large_icon_service.h
diff --git a/components/favicon/core/large_icon_service.h b/components/favicon/core/large_icon_service.h
index 500e95a2301082a358d77f99d0e7848d37325f31..5cab23b2abc9d90969924c993f6bd03aac75ebc2 100644
--- a/components/favicon/core/large_icon_service.h
+++ b/components/favicon/core/large_icon_service.h
@@ -8,6 +8,7 @@
#include <vector>
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/task/cancelable_task_tracker.h"
#include "components/favicon_base/favicon_callback.h"
#include "components/image_fetcher/core/image_fetcher.h"
@@ -48,12 +49,22 @@ class LargeIconService : public KeyedService {
// - Returns the default fallback icon style.
// For cases 2 and 3, this function returns the style of the fallback icon
// instead of rendering an icon so clients can render the icon themselves.
+ // TODO(jkrcal): Rename to GetLargeIconRawBitmapOrFallbackStyle.
base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle(
- const GURL& page_url,
- int min_source_size_in_pixel,
- int desired_size_in_pixel,
- const favicon_base::LargeIconCallback& callback,
- base::CancelableTaskTracker* tracker);
+ const GURL& page_url,
+ int min_source_size_in_pixel,
+ int desired_size_in_pixel,
+ const favicon_base::LargeIconCallback& callback,
+ base::CancelableTaskTracker* tracker);
+
+ // Behaves the same as GetLargeIconOrFallbackStyle, only returns the large
+ // icon (if available) decoded.
+ base::CancelableTaskTracker::TaskId GetLargeIconImageOrFallbackStyle(
+ const GURL& page_url,
+ int min_source_size_in_pixel,
+ int desired_size_in_pixel,
+ const favicon_base::LargeIconImageCallback& callback,
+ base::CancelableTaskTracker* tracker);
// Fetches the best large icon for the page at |page_url| from a Google
// favicon server and stores the result in the FaviconService database
@@ -76,6 +87,13 @@ class LargeIconService : public KeyedService {
const base::Callback<void(bool success)>& callback);
private:
+ void DecodeRawBitmap(const favicon_base::LargeIconImageCallback& callback,
+ const favicon_base::LargeIconResult& raw_result);
+
+ void DecodingRawBitmapFinished(
+ const favicon_base::LargeIconImageCallback& callback,
+ const gfx::Image& image);
+
FaviconService* favicon_service_;
scoped_refptr<base::TaskRunner> background_task_runner_;
@@ -86,6 +104,10 @@ class LargeIconService : public KeyedService {
std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_;
+ // Weak pointer factory as the requests to large icon service may last longer
+ // than the service itself.
+ base::WeakPtrFactory<LargeIconService> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(LargeIconService);
};
« no previous file with comments | « no previous file | components/favicon/core/large_icon_service.cc » ('j') | components/favicon/core/large_icon_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698