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

Side by Side Diff: components/favicon/core/large_icon_service.h

Issue 2784233003: [LargeIconService] Allow decoding of images in the service (Closed)
Patch Set: Minor changes #2 Created 3 years, 8 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 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 30 matching lines...) Expand all
41 // Case 1. An icon exists whose size is >= |min_source_size_in_pixel|: 41 // Case 1. An icon exists whose size is >= |min_source_size_in_pixel|:
42 // - If |desired_size_in_pixel| == 0: returns icon as is. 42 // - If |desired_size_in_pixel| == 0: returns icon as is.
43 // - Else: returns the icon resized to |desired_size_in_pixel|. 43 // - Else: returns the icon resized to |desired_size_in_pixel|.
44 // Case 2. An icon exists whose size is < |min_source_size_in_pixel|: 44 // Case 2. An icon exists whose size is < |min_source_size_in_pixel|:
45 // - Extracts dominant color of smaller image, returns a fallback icon style 45 // - Extracts dominant color of smaller image, returns a fallback icon style
46 // that has a matching background. 46 // that has a matching background.
47 // Case 3. No icon exists. 47 // Case 3. No icon exists.
48 // - Returns the default fallback icon style. 48 // - Returns the default fallback icon style.
49 // For cases 2 and 3, this function returns the style of the fallback icon 49 // For cases 2 and 3, this function returns the style of the fallback icon
50 // instead of rendering an icon so clients can render the icon themselves. 50 // instead of rendering an icon so clients can render the icon themselves.
51 // TODO(jkrcal): Rename to GetLargeIconRawBitmapOrFallbackStyle.
51 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle( 52 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle(
52 const GURL& page_url, 53 const GURL& page_url,
53 int min_source_size_in_pixel, 54 int min_source_size_in_pixel,
54 int desired_size_in_pixel, 55 int desired_size_in_pixel,
55 const favicon_base::LargeIconCallback& callback, 56 const favicon_base::LargeIconCallback& callback,
56 base::CancelableTaskTracker* tracker); 57 base::CancelableTaskTracker* tracker);
58
59 // Behaves the same as GetLargeIconOrFallbackStyle, only returns the large
60 // icon (if available) decoded.
61 base::CancelableTaskTracker::TaskId GetLargeIconImageOrFallbackStyle(
62 const GURL& page_url,
63 int min_source_size_in_pixel,
64 int desired_size_in_pixel,
65 const favicon_base::LargeIconImageCallback& callback,
66 base::CancelableTaskTracker* tracker);
57 67
58 // Fetches the best large icon for the page at |page_url| from a Google 68 // Fetches the best large icon for the page at |page_url| from a Google
59 // favicon server and stores the result in the FaviconService database 69 // favicon server and stores the result in the FaviconService database
60 // (implemented in HistoryService). The write will be a no-op if the local 70 // (implemented in HistoryService). The write will be a no-op if the local
61 // favicon database contains an icon for |page_url|, so clients are 71 // favicon database contains an icon for |page_url|, so clients are
62 // encouraged to use GetLargeIconOrFallbackStyle() first. 72 // encouraged to use GetLargeIconOrFallbackStyle() first.
63 // 73 //
64 // A minimum size |min_source_size_in_pixel| can be specified as a constraint. 74 // A minimum size |min_source_size_in_pixel| can be specified as a constraint.
65 // 75 //
66 // The callback is triggered when the operation finishes, where |success| 76 // The callback is triggered when the operation finishes, where |success|
(...skipping 18 matching lines...) Expand all
85 std::vector<int> large_icon_types_; 95 std::vector<int> large_icon_types_;
86 96
87 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; 97 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_;
88 98
89 DISALLOW_COPY_AND_ASSIGN(LargeIconService); 99 DISALLOW_COPY_AND_ASSIGN(LargeIconService);
90 }; 100 };
91 101
92 } // namespace favicon 102 } // namespace favicon
93 103
94 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ 104 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
OLDNEW
« 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