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

Unified Diff: chrome/browser/ui/webui/large_icon_source.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: chrome/browser/ui/webui/large_icon_source.h
diff --git a/chrome/browser/ui/webui/large_icon_source.h b/chrome/browser/ui/webui/large_icon_source.h
index 05872d2a1917eb70316a1d4661c5f065cad2d0b7..3cf4f45256cc0cc6ab4f8f17552e6d6cc1cc2088 100644
--- a/chrome/browser/ui/webui/large_icon_source.h
+++ b/chrome/browser/ui/webui/large_icon_source.h
@@ -6,18 +6,16 @@
#define CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_
#include <string>
-#include <vector>
#include "base/memory/scoped_ptr.h"
#include "base/task/cancelable_task_tracker.h"
#include "components/favicon/core/fallback_icon_service.h"
#include "components/favicon_base/favicon_types.h"
#include "content/public/browser/url_data_source.h"
-#include "third_party/skia/include/core/SkColor.h"
namespace favicon {
class FallbackIconService;
-class FaviconService;
+class LargeIconService;
}
// LargeIconSource services explicit chrome:// requests for large icons.
@@ -35,10 +33,10 @@ class FaviconService;
// This requests a 48x48 large icon for http://www.google.com.
class LargeIconSource : public content::URLDataSource {
public:
- // |favicon_service| and |fallback_icon_service| are owned by caller and may
- // be null.
- LargeIconSource(favicon::FaviconService* favicon_service,
- favicon::FallbackIconService* fallback_icon_service);
+ // |fallback_icon_service| and |large_icon_service| are owned by caller and
+ // may be null.
+ LargeIconSource(favicon::FallbackIconService* fallback_icon_service,
+ favicon::LargeIconService* large_icon_service);
~LargeIconSource() override;
@@ -53,34 +51,13 @@ class LargeIconSource : public content::URLDataSource {
bool ShouldReplaceExistingSource() const override;
bool ShouldServiceRequest(const net::URLRequest* request) const override;
- protected:
- struct IconRequest {
- IconRequest();
- IconRequest(const content::URLDataSource::GotDataCallback& callback_in,
- const GURL& path_in,
- int size_in);
- ~IconRequest();
-
- content::URLDataSource::GotDataCallback callback;
- GURL url;
- int size;
- };
-
private:
// Callback for icon data retrieval request.
void OnIconDataAvailable(
huangs 2015/04/21 05:00:28 NIT: OnLargeIconDataAvailable(), also change comme
beaudoin 2015/04/21 15:11:11 Done.
- const IconRequest& request,
- const favicon_base::FaviconRawBitmapResult& bitmap_result);
-
- // Renders and sends a default fallback icon. This is used when there is no
- // known text and/or foreground color to use for the generated icon (it
- // defaults to a light text color on a dark gray background).
- void SendDefaultFallbackIcon(const IconRequest& request);
-
- // Renders and sends a fallback icon using the given colors.
- void SendFallbackIcon(const IconRequest& request,
- SkColor text_color,
- SkColor background_color);
+ const content::URLDataSource::GotDataCallback& callback,
+ const GURL& url,
+ int size,
+ const favicon_base::LargeIconResult& bitmap_result);
// Returns null to trigger "Not Found" response.
void SendNotFoundResponse(
@@ -88,15 +65,9 @@ class LargeIconSource : public content::URLDataSource {
base::CancelableTaskTracker cancelable_task_tracker_;
- favicon::FaviconService* favicon_service_;
-
favicon::FallbackIconService* fallback_icon_service_;
- // A pre-populated list of the types of icon files to consider when looking
- // for the largest matching icon.
- // Note: this is simply an optimization over populating an icon type vector
- // on each request.
- std::vector<int> large_icon_types_;
+ favicon::LargeIconService* large_icon_service_;
DISALLOW_COPY_AND_ASSIGN(LargeIconSource);
};

Powered by Google App Engine
This is Rietveld 408576698