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

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

Issue 1092873002: [Icons NTP] Refactor large_icon_source to extract the logic shared between desktop and Android to f… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
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
new file mode 100644
index 0000000000000000000000000000000000000000..a75e33251e39d5fba708dd5c25153718db8a5a99
--- /dev/null
+++ b/components/favicon/core/large_icon_service.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
+#define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
+
+#include <vector>
+
+#include "base/task/cancelable_task_tracker.h"
+#include "components/favicon_base/favicon_callback.h"
+#include "components/keyed_service/core/keyed_service.h"
+
+class GURL;
+
+namespace favicon_base {
+struct FaviconRawBitmapResult;
+}
+
+namespace favicon {
+
+class FaviconService;
+
+// The large icon service provides methods to access large icons. It relies on
+// the favicon service.
+class LargeIconService : public KeyedService {
+ public:
+ LargeIconService(FaviconService* favicon_service);
+
+ ~LargeIconService() override;
+
+ // Requests the best large icon for the page at |page_url| given the requested
+ // |desired_size_in_pixel|. If no good large icon can be found, returns the
+ // fallback style to use, for which the background is set to the dominant
+ // color of a smaller icon when one is available.
+ base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle(
+ const GURL& page_url,
+ int desired_size_in_pixel,
+ const favicon_base::LargeIconCallback& callback,
+ base::CancelableTaskTracker* tracker);
+
+ private:
+ // Intermediate callback for GetLargeIconOrFallbackStyle(). Ensures the large
+ // icon is the desired size, if not compute the icon fallback style and use it
+ // to invoke |callback|.
huangs 2015/04/21 05:00:28 I noticed that the "ensure the large icon is the d
beaudoin 2015/04/21 15:11:11 Added TODO in large_icon_service.cc. Let's discuss
+ void RunLargeIconCallback(
+ const favicon_base::LargeIconCallback& callback,
+ int desired_size_in_pixel,
+ const favicon_base::FaviconRawBitmapResult& bitmap_result);
+
+ FaviconService* favicon_service_;
+
+ // A pre-populated list of the types of icon files to consider when looking
+ // for large icons. Note: this is simply an optimization over populating an
+ // icon type vector on each request.
+ std::vector<int> large_icon_types_;
+
+ DISALLOW_COPY_AND_ASSIGN(LargeIconService);
+};
+
+} // namespace favicon
+
+#endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698