Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
| 5 #ifndef COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ | 5 #ifndef COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ |
| 6 #define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ | 6 #define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 // the favicon service. | 31 // the favicon service. |
| 32 class LargeIconService : public KeyedService { | 32 class LargeIconService : public KeyedService { |
| 33 public: | 33 public: |
| 34 LargeIconService( | 34 LargeIconService( |
| 35 FaviconService* favicon_service, | 35 FaviconService* favicon_service, |
| 36 const scoped_refptr<base::TaskRunner>& background_task_runner, | 36 const scoped_refptr<base::TaskRunner>& background_task_runner, |
| 37 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher); | 37 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher); |
| 38 ~LargeIconService() override; | 38 ~LargeIconService() override; |
| 39 | 39 |
| 40 // Requests the best large icon for the page at |page_url|. | 40 // Requests the best large icon for the page at |page_url|. |
| 41 // Case 1. An icon exists whose size is >= |min_source_size_in_pixel|: | 41 // Case 1. An icon exists whose size is >= MAX(|min_source_size_in_pixel|, |
| 42 // |desired_size_in_pixel|): | |
| 42 // - If |desired_size_in_pixel| == 0: returns icon as is. | 43 // - If |desired_size_in_pixel| == 0: returns icon as is. |
| 43 // - Else: returns the icon resized to |desired_size_in_pixel|. | 44 // - Else: returns the icon resized to |desired_size_in_pixel|. |
| 44 // Case 2. An icon exists whose size is < |min_source_size_in_pixel|: | 45 // Case 2. An icon exists whose size is >= |min_source_size_in_pixel| and < |
| 46 // |desired_size_in_pixel|: | |
| 47 // - Same as 1 with the biggest icon. | |
| 48 // Case 4. An icon exists whose size is < |min_source_size_in_pixel|: | |
|
jkrcal
2017/05/18 12:33:55
Where is Case 3?
| |
| 45 // - Extracts dominant color of smaller image, returns a fallback icon style | 49 // - Extracts dominant color of smaller image, returns a fallback icon style |
| 46 // that has a matching background. | 50 // that has a matching background. |
| 47 // Case 3. No icon exists. | 51 // Case 5. No icon exists. |
| 48 // - Returns the default fallback icon style. | 52 // - Returns the default fallback icon style. |
| 49 // For cases 2 and 3, this function returns the style of the fallback icon | 53 // For cases 4 and 5, this function returns the style of the fallback icon |
| 50 // instead of rendering an icon so clients can render the icon themselves. | 54 // instead of rendering an icon so clients can render the icon themselves. |
| 51 // TODO(jkrcal): Rename to GetLargeIconRawBitmapOrFallbackStyle. | 55 // TODO(jkrcal): Rename to GetLargeIconRawBitmapOrFallbackStyle. |
| 52 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle( | 56 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle( |
| 53 const GURL& page_url, | 57 const GURL& page_url, |
| 54 int min_source_size_in_pixel, | 58 int min_source_size_in_pixel, |
| 55 int desired_size_in_pixel, | 59 int desired_size_in_pixel, |
| 56 const favicon_base::LargeIconCallback& callback, | 60 const favicon_base::LargeIconCallback& callback, |
| 57 base::CancelableTaskTracker* tracker); | 61 base::CancelableTaskTracker* tracker); |
| 58 | 62 |
| 59 // Behaves the same as GetLargeIconOrFallbackStyle(), only returns the large | 63 // Behaves the same as GetLargeIconOrFallbackStyle(), only returns the large |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 std::vector<int> large_icon_types_; | 112 std::vector<int> large_icon_types_; |
| 109 | 113 |
| 110 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; | 114 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; |
| 111 | 115 |
| 112 DISALLOW_COPY_AND_ASSIGN(LargeIconService); | 116 DISALLOW_COPY_AND_ASSIGN(LargeIconService); |
| 113 }; | 117 }; |
| 114 | 118 |
| 115 } // namespace favicon | 119 } // namespace favicon |
| 116 | 120 |
| 117 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ | 121 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ |
| OLD | NEW |