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

Unified Diff: components/favicon/ios/web_favicon_driver.mm

Issue 2691933004: Avoid cyclic dependency FaviconHandler<-->FaviconDriverImpl (Closed)
Patch Set: Addressed more comments. 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
« no previous file with comments | « components/favicon/ios/web_favicon_driver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/ios/web_favicon_driver.mm
diff --git a/components/favicon/ios/web_favicon_driver.mm b/components/favicon/ios/web_favicon_driver.mm
index cf5185f2f817f1ab7ef0cdbffceccb3c7255825a..9e1b7e3dc00e51c30d9be6a3f8228c1d4bd30a8b 100644
--- a/components/favicon/ios/web_favicon_driver.mm
+++ b/components/favicon/ios/web_favicon_driver.mm
@@ -61,7 +61,15 @@ bool WebFaviconDriver::FaviconIsValid() const {
return item ? item->GetFavicon().valid : false;
}
-int WebFaviconDriver::StartDownload(const GURL& url, int max_image_size) {
+GURL WebFaviconDriver::GetActiveURL() {
+ web::NavigationItem* item =
+ web_state()->GetNavigationManager()->GetVisibleItem();
+ return item ? item->GetURL() : GURL();
+}
+
+int WebFaviconDriver::DownloadImage(const GURL& url,
+ int max_image_size,
+ ImageDownloadCallback callback) {
if (WasUnableToDownloadFavicon(url)) {
DVLOG(1) << "Skip Failed FavIcon: " << url;
return 0;
@@ -70,8 +78,6 @@ int WebFaviconDriver::StartDownload(const GURL& url, int max_image_size) {
static int downloaded_image_count = 0;
int local_download_id = ++downloaded_image_count;
- ImageDownloadCallback local_image_callback = base::Bind(
- &FaviconDriverImpl::DidDownloadFavicon, base::Unretained(this));
GURL local_url(url);
image_fetcher::IOSImageDataFetcherCallback local_callback =
@@ -88,8 +94,8 @@ int WebFaviconDriver::StartDownload(const GURL& url, int max_image_size) {
sizes.push_back(gfx::Size(frame.width(), frame.height()));
}
}
- local_image_callback.Run(local_download_id, metadata.response_code,
- local_url, frames, sizes);
+ callback.Run(local_download_id, metadata.response_code, local_url,
+ frames, sizes);
};
image_fetcher_.FetchImageDataWebpDecoded(url, local_callback);
@@ -101,12 +107,6 @@ bool WebFaviconDriver::IsOffTheRecord() {
return web_state()->GetBrowserState()->IsOffTheRecord();
}
-GURL WebFaviconDriver::GetActiveURL() {
- web::NavigationItem* item =
- web_state()->GetNavigationManager()->GetVisibleItem();
- return item ? item->GetURL() : GURL();
-}
-
void WebFaviconDriver::OnFaviconUpdated(
const GURL& page_url,
FaviconDriverObserver::NotificationIconType notification_icon_type,
« no previous file with comments | « components/favicon/ios/web_favicon_driver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698