Commit bcfd13f9 authored by Mathieu Perreault's avatar Mathieu Perreault Committed by Commit Bot

[New Tab Page] Add server icons as a source to NTP icons

Priority is now:
- Local favicons
- Server favicons
- Letter fallback (circle + drawn letter)

Bug: 856852
Change-Id: I45d5daae4ee3734a12018c01307c32c2e4047a59
Reviewed-on: https://chromium-review.googlesource.com/1116869
Commit-Queue: Mathieu Perreault <mathp@chromium.org>
Reviewed-by: default avatarThiemo Nagel <tnagel@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572199}
parent 01c959ca
This diff is collapsed.
......@@ -5,20 +5,28 @@
#ifndef CHROME_BROWSER_SEARCH_NTP_ICON_SOURCE_H_
#define CHROME_BROWSER_SEARCH_NTP_ICON_SOURCE_H_
#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/task/cancelable_task_tracker.h"
#include "components/image_fetcher/core/image_fetcher.h"
#include "components/image_fetcher/core/image_fetcher_types.h"
#include "content/public/browser/url_data_source.h"
class GURL;
class Profile;
class SkBitmap;
namespace favicon_base {
struct FaviconRawBitmapResult;
}
namespace gfx {
class Image;
}
// NTP Icon Source is the gateway between network-level chrome: requests for
// NTP icons and the various backends that may serve them.
class NtpIconSource : public content::URLDataSource {
......@@ -40,12 +48,26 @@ class NtpIconSource : public content::URLDataSource {
private:
struct NtpIconRequest;
void OnFaviconDataAvailable(
void OnLocalFaviconAvailable(
const NtpIconRequest& request,
const favicon_base::FaviconRawBitmapResult& bitmap_result);
// Returns whether |url| is in the set of server suggestions.
bool IsRequestedUrlInServerSuggestions(const GURL& url);
void RequestServerFavicon(const NtpIconRequest& request);
void OnServerFaviconAvailable(const NtpIconRequest& request,
const std::string& id,
const gfx::Image& fetched_image,
const image_fetcher::RequestMetadata& metadata);
// Will call |request.callback| with the rendered icon. |bitmap| can be empty,
// in which case the returned icon is a fallback circle with a letter drawn
// into it.
void ReturnRenderedIconForRequest(const NtpIconRequest& request,
const SkBitmap& bitmap);
base::CancelableTaskTracker cancelable_task_tracker_;
Profile* profile_;
std::unique_ptr<image_fetcher::ImageFetcher> const image_fetcher_;
base::WeakPtrFactory<NtpIconSource> weak_ptr_factory_;
......
......@@ -148,6 +148,7 @@ Refer to README.md for content description and update process.
<item id="network_time_component" hash_code="46188932" type="0" content_hash_code="28051857" os_list="linux,windows" file_path="components/network_time/network_time_tracker.cc"/>
<item id="notification_image_reporter" hash_code="70126372" type="0" content_hash_code="29754543" os_list="linux,windows" file_path="chrome/browser/safe_browsing/notification_image_reporter.cc"/>
<item id="ntp_contextual_suggestions_fetch" hash_code="95711309" type="0" content_hash_code="107035434" os_list="linux,windows" file_path="components/ntp_snippets/contextual/contextual_suggestions_fetch.cc"/>
<item id="ntp_icon_source" hash_code="29197139" type="0" content_hash_code="16399294" os_list="linux,windows" file_path="chrome/browser/search/ntp_icon_source.cc"/>
<item id="ntp_snippets_fetch" hash_code="15418154" type="0" content_hash_code="10078959" os_list="linux,windows" file_path="components/ntp_snippets/remote/json_request.cc"/>
<item id="oauth2_access_token_fetcher" hash_code="27915688" type="0" content_hash_code="33501872" os_list="linux,windows" file_path="google_apis/gaia/oauth2_access_token_fetcher_impl.cc"/>
<item id="oauth2_api_call_flow" hash_code="29188932" type="2" content_hash_code="108831236" os_list="linux,windows" policy_fields="-1" file_path="google_apis/gaia/oauth2_api_call_flow.cc"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment