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

Unified Diff: chrome/browser/ui/webui/favicon_source.cc

Issue 835903005: [Favicon] Add new fallback icon rendering flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor by extracting FallbackIconSpecsBuilder. Created 5 years, 11 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/favicon_source.cc
diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc
index c7977999300299d78e100628ef983d61a07ccc8d..415b85b345082eab0480bc03090053be463fe51d 100644
--- a/chrome/browser/ui/webui/favicon_source.cc
+++ b/chrome/browser/ui/webui/favicon_source.cc
@@ -19,6 +19,7 @@
#include "chrome/common/favicon/favicon_url_parser.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/locale_settings.h"
+#include "components/favicon_base/fallback_icon_specs_builder.h"
#include "net/url_request/url_request.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/layout.h"
@@ -82,19 +83,33 @@ void FaviconSource::StartDataRequest(
int desired_size_in_pixel =
std::ceil(parsed.size_in_dip * parsed.device_scale_factor);
- if (parsed.is_icon_url) {
- // TODO(michaelbai): Change GetRawFavicon to support combination of
- // IconType.
- favicon_service->GetRawFavicon(
- url,
- favicon_base::FAVICON,
- desired_size_in_pixel,
+ if (parsed.fallback_specs_builder || parsed.is_icon_url) {
+ favicon_base::FaviconRawBitmapCallback wrapped_callback =
base::Bind(
&FaviconSource::OnFaviconDataAvailable,
base::Unretained(this),
IconRequest(
- callback, url, parsed.size_in_dip, parsed.device_scale_factor)),
- &cancelable_task_tracker_);
+ callback, url, parsed.size_in_dip, parsed.device_scale_factor));
+ if (parsed.fallback_specs_builder) {
pkotwicz 2015/01/19 04:32:02 Can you move the code for parsing the URLs for fal
huangs 2015/01/20 22:20:41 Done.
+ favicon_service->GetRawFallbackFaviconImage(
+ url,
+ icon_types_ == favicon_base::FAVICON ?
+ favicon_base::FAVICON : favicon_base::TOUCH_ICON,
+ desired_size_in_pixel,
+ parsed.fallback_specs_builder->Build(),
+ wrapped_callback,
+ &cancelable_task_tracker_);
+ } else {
+ DCHECK(parsed.is_icon_url);
+ // TODO(michaelbai): Change GetRawFavicon to support combination of
+ // IconType.
+ favicon_service->GetRawFavicon(
+ url,
+ favicon_base::FAVICON,
+ desired_size_in_pixel,
+ wrapped_callback,
+ &cancelable_task_tracker_);
+ }
} else {
// Intercept requests for prepopulated pages.
for (int i = 0; i < history::kPrepopulatedPagesCount; i++) {

Powered by Google App Engine
This is Rietveld 408576698