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

Unified Diff: ios/chrome/browser/reading_list/reading_list_distiller_page.mm

Issue 2673003002: [Reading List] Display the redirected URL's favicon. (Closed)
Patch Set: Created 3 years, 10 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: ios/chrome/browser/reading_list/reading_list_distiller_page.mm
diff --git a/ios/chrome/browser/reading_list/reading_list_distiller_page.mm b/ios/chrome/browser/reading_list/reading_list_distiller_page.mm
index baa4012447112b0d6efcc6b5ee36ba5f654625be..c1510de82786246025b4b0dead06eb7a13db8835 100644
--- a/ios/chrome/browser/reading_list/reading_list_distiller_page.mm
+++ b/ios/chrome/browser/reading_list/reading_list_distiller_page.mm
@@ -54,17 +54,23 @@ void ReadingListDistillerPage::DistillPageImpl(const GURL& url,
}
std::unique_ptr<web::WebState> new_web_state =
web_state_dispatcher_->RequestWebState();
- if (new_web_state) {
- favicon::WebFaviconDriver* favicon_driver =
- favicon::WebFaviconDriver::FromWebState(new_web_state.get());
- favicon_driver->FetchFavicon(url);
- }
AttachWebState(std::move(new_web_state));
original_url_ = url;
+ FetchFavicon(url);
DistillerPageIOS::DistillPageImpl(url, script);
}
+void ReadingListDistillerPage::FetchFavicon(const GURL& page_url) {
+ if (!CurrentWebState() || !page_url.is_valid()) {
+ return;
+ }
+ favicon::WebFaviconDriver* favicon_driver =
+ favicon::WebFaviconDriver::FromWebState(CurrentWebState());
+ DCHECK(favicon_driver);
+ favicon_driver->FetchFavicon(page_url);
+}
+
void ReadingListDistillerPage::OnDistillationDone(const GURL& page_url,
const base::Value* value) {
std::unique_ptr<web::WebState> old_web_state = DetachWebState();
@@ -117,6 +123,8 @@ void ReadingListDistillerPage::OnLoadURLDone(
DistillerPageIOS::OnLoadURLDone(load_completion_status);
return;
}
+ FetchFavicon(CurrentWebState()->GetVisibleURL());
+
// Page is loaded but rendering may not be done yet. Give a delay to the page.
base::WeakPtr<ReadingListDistillerPage> weak_this =
weak_ptr_factory_.GetWeakPtr();
@@ -213,6 +221,7 @@ bool ReadingListDistillerPage::HandleGoogleCachedAMPPageJavaScriptResult(
if (!new_gurl.is_valid()) {
return false;
}
+ FetchFavicon(new_gurl);
web::NavigationManager::WebLoadParams params(new_gurl);
CurrentWebState()->GetNavigationManager()->LoadURLWithParams(params);
return true;

Powered by Google App Engine
This is Rietveld 408576698