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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 if (entry) | 81 if (entry) |
82 return entry->GetFavicon().valid; | 82 return entry->GetFavicon().valid; |
83 | 83 |
84 entry = controller.GetLastCommittedEntry(); | 84 entry = controller.GetLastCommittedEntry(); |
85 if (entry) | 85 if (entry) |
86 return entry->GetFavicon().valid; | 86 return entry->GetFavicon().valid; |
87 | 87 |
88 return false; | 88 return false; |
89 } | 89 } |
90 | 90 |
91 int ContentFaviconDriver::StartDownload(const GURL& url, int max_image_size) { | 91 int ContentFaviconDriver::DownloadImage(const GURL& url, |
92 int max_image_size, | |
93 ImageDownloadCallback callback) { | |
pkotwicz
2017/02/22 02:37:53
Nit: Reorder this function to match order in .h fi
mastiz
2017/02/23 21:55:53
Done. This however makes the diff and blame layer
| |
92 if (WasUnableToDownloadFavicon(url)) { | 94 if (WasUnableToDownloadFavicon(url)) { |
93 DVLOG(1) << "Skip Failed FavIcon: " << url; | 95 DVLOG(1) << "Skip Failed FavIcon: " << url; |
94 return 0; | 96 return 0; |
95 } | 97 } |
96 | 98 |
97 bool bypass_cache = (bypass_cache_page_url_ == GetActiveURL()); | 99 bool bypass_cache = (bypass_cache_page_url_ == GetActiveURL()); |
98 bypass_cache_page_url_ = GURL(); | 100 bypass_cache_page_url_ = GURL(); |
99 | 101 |
100 return web_contents()->DownloadImage( | 102 return web_contents()->DownloadImage(url, true, max_image_size, bypass_cache, |
101 url, true, max_image_size, bypass_cache, | 103 callback); |
102 base::Bind(&FaviconDriverImpl::DidDownloadFavicon, | |
103 base::Unretained(this))); | |
104 } | 104 } |
105 | 105 |
106 bool ContentFaviconDriver::IsOffTheRecord() { | 106 bool ContentFaviconDriver::IsOffTheRecord() { |
107 DCHECK(web_contents()); | 107 DCHECK(web_contents()); |
108 return web_contents()->GetBrowserContext()->IsOffTheRecord(); | 108 return web_contents()->GetBrowserContext()->IsOffTheRecord(); |
109 } | 109 } |
110 | 110 |
111 GURL ContentFaviconDriver::GetActiveURL() { | 111 GURL ContentFaviconDriver::GetActiveURL() { |
112 content::NavigationEntry* entry = | 112 content::NavigationEntry* entry = |
113 web_contents()->GetController().GetLastCommittedEntry(); | 113 web_contents()->GetController().GetLastCommittedEntry(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 // redownloaded. | 197 // redownloaded. |
198 GURL url = navigation_handle->GetURL(); | 198 GURL url = navigation_handle->GetURL(); |
199 if (url != bypass_cache_page_url_) | 199 if (url != bypass_cache_page_url_) |
200 bypass_cache_page_url_ = GURL(); | 200 bypass_cache_page_url_ = GURL(); |
201 | 201 |
202 // Get the favicon, either from history or request it from the net. | 202 // Get the favicon, either from history or request it from the net. |
203 FetchFavicon(url); | 203 FetchFavicon(url); |
204 } | 204 } |
205 | 205 |
206 } // namespace favicon | 206 } // namespace favicon |
OLD | NEW |