| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |