| 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 73a2698448c9182cb2ac43fd9e7103ba14ad49f2..23d5cf8f1dd3dcd5f9ac1592aa2a8845900988e7 100644
|
| --- a/components/favicon/core/large_icon_service.h
|
| +++ b/components/favicon/core/large_icon_service.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
|
| #define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
|
|
|
| +#include <string>
|
| #include <vector>
|
|
|
| #include "base/macros.h"
|
| @@ -18,6 +19,10 @@ namespace base {
|
| class TaskRunner;
|
| }
|
|
|
| +namespace image_fetcher {
|
| +class ImageFetcher;
|
| +}
|
| +
|
| namespace favicon {
|
|
|
| class FaviconService;
|
| @@ -28,7 +33,8 @@ class LargeIconService : public KeyedService {
|
| public:
|
| LargeIconService(
|
| FaviconService* favicon_service,
|
| - const scoped_refptr<base::TaskRunner>& background_task_runner);
|
| + const scoped_refptr<base::TaskRunner>& background_task_runner,
|
| + std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher);
|
| ~LargeIconService() override;
|
|
|
| // Requests the best large icon for the page at |page_url|.
|
| @@ -49,14 +55,34 @@ class LargeIconService : public KeyedService {
|
| const favicon_base::LargeIconCallback& callback,
|
| base::CancelableTaskTracker* tracker);
|
|
|
| + // Fetches the best large icon for the page at |page_url| from a Google
|
| + // favicon server. Similarly to |GetLargeIconOrFallbackStyle|.
|
| + // Case 1. An icon is fetched whose size is >= |min_source_size_in_pixel|:
|
| + // - If |desired_size_in_pixel| == 0: returns icon as is.
|
| + // - Else: returns the icon resized to |desired_size_in_pixel|.
|
| + // Case 2. An icon is fetched whose size is < |min_source_size_in_pixel|:
|
| + // - Extracts dominant color of smaller image, returns a fallback icon style
|
| + // that has a matching background.
|
| + // Case 3. No icon exists.
|
| + // - 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.
|
| + // WARNING: This function will share the |page_url| with a Google server. This
|
| + // Can be used only for urls that are not privacy sensitive or for users that
|
| + // sync their history with Google servers.
|
| + base::CancelableTaskTracker::TaskId
|
| + GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache(
|
| + const GURL& page_url,
|
| + int min_source_size_in_pixel,
|
| + int desired_size_in_pixel,
|
| + const favicon_base::LargeIconCallback& callback,
|
| + base::CancelableTaskTracker* tracker);
|
| +
|
| private:
|
| FaviconService* favicon_service_;
|
| scoped_refptr<base::TaskRunner> background_task_runner_;
|
|
|
| - // A pre-populated list of icon types to consider when looking for large
|
| - // icons. This is an optimization over populating an icon type vector on each
|
| - // request.
|
| - std::vector<int> large_icon_types_;
|
| + std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(LargeIconService);
|
| };
|
|
|