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

Side by Side Diff: components/favicon/content/content_favicon_driver.cc

Issue 2728893004: Move WasUnableToDownload logic to FaviconHandler (Closed)
Patch Set: Reverted accidental changes. Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/favicon/content/content_favicon_driver_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/favicon/content/content_favicon_driver.h" 5 #include "components/favicon/content/content_favicon_driver.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/favicon/content/favicon_url_util.h" 8 #include "components/favicon/content/favicon_url_util.h"
9 #include "components/favicon/core/favicon_service.h" 9 #include "components/favicon/core/favicon_service.h"
10 #include "components/favicon/core/favicon_url.h" 10 #include "components/favicon/core/favicon_url.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 : content::WebContentsObserver(web_contents), 102 : content::WebContentsObserver(web_contents),
103 FaviconDriverImpl(favicon_service, history_service, bookmark_model) { 103 FaviconDriverImpl(favicon_service, history_service, bookmark_model) {
104 } 104 }
105 105
106 ContentFaviconDriver::~ContentFaviconDriver() { 106 ContentFaviconDriver::~ContentFaviconDriver() {
107 } 107 }
108 108
109 int ContentFaviconDriver::DownloadImage(const GURL& url, 109 int ContentFaviconDriver::DownloadImage(const GURL& url,
110 int max_image_size, 110 int max_image_size,
111 ImageDownloadCallback callback) { 111 ImageDownloadCallback callback) {
112 if (WasUnableToDownloadFavicon(url)) {
113 DVLOG(1) << "Skip Failed FavIcon: " << url;
114 return 0;
115 }
116
117 bool bypass_cache = (bypass_cache_page_url_ == GetActiveURL()); 112 bool bypass_cache = (bypass_cache_page_url_ == GetActiveURL());
118 bypass_cache_page_url_ = GURL(); 113 bypass_cache_page_url_ = GURL();
119 114
120 return web_contents()->DownloadImage(url, true, max_image_size, bypass_cache, 115 return web_contents()->DownloadImage(url, true, max_image_size, bypass_cache,
121 callback); 116 callback);
122 } 117 }
123 118
124 bool ContentFaviconDriver::IsOffTheRecord() { 119 bool ContentFaviconDriver::IsOffTheRecord() {
125 DCHECK(web_contents()); 120 DCHECK(web_contents());
126 return web_contents()->GetBrowserContext()->IsOffTheRecord(); 121 return web_contents()->GetBrowserContext()->IsOffTheRecord();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // redownloaded. 192 // redownloaded.
198 GURL url = navigation_handle->GetURL(); 193 GURL url = navigation_handle->GetURL();
199 if (url != bypass_cache_page_url_) 194 if (url != bypass_cache_page_url_)
200 bypass_cache_page_url_ = GURL(); 195 bypass_cache_page_url_ = GURL();
201 196
202 // Get the favicon, either from history or request it from the net. 197 // Get the favicon, either from history or request it from the net.
203 FetchFavicon(url); 198 FetchFavicon(url);
204 } 199 }
205 200
206 } // namespace favicon 201 } // namespace favicon
OLDNEW
« no previous file with comments | « no previous file | components/favicon/content/content_favicon_driver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698