Index: ios/web/web_state/ui/crw_web_controller.mm |
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm |
index daba52a1871c7d98c800ef12efd9cc37c4478fbd..2f5fa82090f3f646a6f9a6753ad48d134d5ebd40 100644 |
--- a/ios/web/web_state/ui/crw_web_controller.mm |
+++ b/ios/web/web_state/ui/crw_web_controller.mm |
@@ -2807,32 +2807,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
DLOG(WARNING) << "JS message parameter not found: favicons"; |
return NO; |
} |
+ |
std::vector<web::FaviconURL> urls; |
- for (size_t fav_idx = 0; fav_idx != favicons->GetSize(); ++fav_idx) { |
- base::DictionaryValue* favicon = nullptr; |
- if (!favicons->GetDictionary(fav_idx, &favicon)) |
- return NO; |
- std::string href; |
- std::string rel; |
- if (!favicon->GetString("href", &href)) { |
- DLOG(WARNING) << "JS message parameter not found: href"; |
- return NO; |
- } |
- if (!favicon->GetString("rel", &rel)) { |
- DLOG(WARNING) << "JS message parameter not found: rel"; |
- return NO; |
- } |
- web::FaviconURL::IconType icon_type = web::FaviconURL::FAVICON; |
- if (rel == "apple-touch-icon") |
- icon_type = web::FaviconURL::TOUCH_ICON; |
- else if (rel == "apple-touch-icon-precomposed") |
- icon_type = web::FaviconURL::TOUCH_PRECOMPOSED_ICON; |
- urls.push_back( |
- web::FaviconURL(GURL(href), icon_type, std::vector<gfx::Size>())); |
- } |
- if (!urls.empty()) |
+ bool extraction_result = ExtractFaviconURL(favicons, urls); |
+ |
+ if (extraction_result && !urls.empty()) |
_webStateImpl->OnFaviconUrlUpdated(urls); |
- return YES; |
+ return extraction_result; |
} |
- (BOOL)handleDocumentSubmitMessage:(base::DictionaryValue*)message |