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

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

Issue 2896803002: [LargeIconService] Make check_seen param optional for fetching (Closed)
Patch Set: Comments on unit-test Created 3 years, 7 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
« no previous file with comments | « no previous file | components/favicon/core/large_icon_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // 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
69 // favicon server and stores the result in the FaviconService database 69 // favicon server and stores the result in the FaviconService database
70 // (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
71 // favicon database contains an icon for |page_url|, so clients are 71 // favicon database contains an icon for |page_url|, so clients are
72 // encouraged to use GetLargeIconOrFallbackStyle() first. 72 // encouraged to use GetLargeIconOrFallbackStyle() first.
73 // 73 //
74 // 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.
75 // |desired_size_in_pixel| serves only as a hint to the service, no guarantees 75 // |desired_size_in_pixel| serves only as a hint to the service, no guarantees
76 // on the fetched size are provided. 76 // on the fetched size are provided.
77 // 77 //
78 // Unless you are sure |page_url| is a public URL (known to Google Search),
79 // set |may_page_url_be_private| to true. This slighty increases the chance of
80 // a failure (e.g. if the URL _is_ private) but it makes sure Google servers
81 // do not crawl a private URL as a result of this call.
82 //
78 // The callback is triggered when the operation finishes, where |success| 83 // The callback is triggered when the operation finishes, where |success|
79 // tells whether the fetch actually managed to database a new icon in the 84 // tells whether the fetch actually managed to database a new icon in the
80 // FaviconService. 85 // FaviconService.
81 // 86 //
82 // WARNING: This function will share the |page_url| with a Google server. This 87 // WARNING: This function will share the |page_url| with a Google server. This
83 // Can be used only for urls that are not privacy sensitive or for users that 88 // Can be used only for urls that are not privacy sensitive or for users that
84 // sync their history with Google servers. 89 // sync their history with Google servers.
85 // TODO(jkrcal): It is not clear from the name of this function, that it 90 // TODO(jkrcal): It is not clear from the name of this function, that it
86 // actually adds the icon to the local cache. Maybe "StoreLargeIcon..."? 91 // actually adds the icon to the local cache. Maybe "StoreLargeIcon..."?
87 void GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( 92 void GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache(
88 const GURL& page_url, 93 const GURL& page_url,
89 int min_source_size_in_pixel, 94 int min_source_size_in_pixel,
90 int desired_size_in_pixel, 95 int desired_size_in_pixel,
96 bool may_page_url_be_private,
91 const base::Callback<void(bool success)>& callback); 97 const base::Callback<void(bool success)>& callback);
92 98
93 private: 99 private:
94 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyleImpl( 100 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyleImpl(
95 const GURL& page_url, 101 const GURL& page_url,
96 int min_source_size_in_pixel, 102 int min_source_size_in_pixel,
97 int desired_size_in_pixel, 103 int desired_size_in_pixel,
98 const favicon_base::LargeIconCallback& raw_bitmap_callback, 104 const favicon_base::LargeIconCallback& raw_bitmap_callback,
99 const favicon_base::LargeIconImageCallback& image_callback, 105 const favicon_base::LargeIconImageCallback& image_callback,
100 base::CancelableTaskTracker* tracker); 106 base::CancelableTaskTracker* tracker);
101 107
102 FaviconService* favicon_service_; 108 FaviconService* favicon_service_;
103 scoped_refptr<base::TaskRunner> background_task_runner_; 109 scoped_refptr<base::TaskRunner> background_task_runner_;
104 110
105 // A pre-populated list of icon types to consider when looking for large 111 // A pre-populated list of icon types to consider when looking for large
106 // icons. This is an optimization over populating an icon type vector on each 112 // icons. This is an optimization over populating an icon type vector on each
107 // request. 113 // request.
108 std::vector<int> large_icon_types_; 114 std::vector<int> large_icon_types_;
109 115
110 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; 116 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_;
111 117
112 DISALLOW_COPY_AND_ASSIGN(LargeIconService); 118 DISALLOW_COPY_AND_ASSIGN(LargeIconService);
113 }; 119 };
114 120
115 } // namespace favicon 121 } // namespace favicon
116 122
117 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ 123 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698