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

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

Issue 2721363002: Extend LargeIconService to fetch missing favicons from a Google server (Closed)
Patch Set: Add fallback_opts=TYPE 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
« no previous file with comments | « components/favicon/core/favicon_service_impl.cc ('k') | components/favicon/core/large_icon_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..500e95a2301082a358d77f99d0e7848d37325f31 100644
--- a/components/favicon/core/large_icon_service.h
+++ b/components/favicon/core/large_icon_service.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/task/cancelable_task_tracker.h"
#include "components/favicon_base/favicon_callback.h"
+#include "components/image_fetcher/core/image_fetcher.h"
#include "components/keyed_service/core/keyed_service.h"
class GURL;
@@ -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,6 +55,26 @@ 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 and stores the result in the FaviconService database
+ // (implemented in HistoryService). The write will be a no-op if the local
+ // favicon database contains an icon for |page_url|, so clients are
+ // encouraged to use GetLargeIconOrFallbackStyle() first.
+ //
+ // A minimum size |min_source_size_in_pixel| can be specified as a constraint.
+ //
+ // The callback is triggered when the operation finishes, where |success|
+ // tells whether the fetch actually managed to database a new icon in the
+ // FaviconService.
+ //
+ // 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.
+ void GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache(
+ const GURL& page_url,
+ int min_source_size_in_pixel,
+ const base::Callback<void(bool success)>& callback);
+
private:
FaviconService* favicon_service_;
scoped_refptr<base::TaskRunner> background_task_runner_;
@@ -58,6 +84,8 @@ class LargeIconService : public KeyedService {
// request.
std::vector<int> large_icon_types_;
+ std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_;
+
DISALLOW_COPY_AND_ASSIGN(LargeIconService);
};
« no previous file with comments | « components/favicon/core/favicon_service_impl.cc ('k') | components/favicon/core/large_icon_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698