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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (!entry) | 157 if (!entry) |
158 return; | 158 return; |
159 | 159 |
160 favicon_urls_ = candidates; | 160 favicon_urls_ = candidates; |
161 OnUpdateFaviconURL(entry->GetURL(), | 161 OnUpdateFaviconURL(entry->GetURL(), |
162 FaviconURLsFromContentFaviconURLs(candidates)); | 162 FaviconURLsFromContentFaviconURLs(candidates)); |
163 } | 163 } |
164 | 164 |
165 void ContentFaviconDriver::DidStartNavigationToPendingEntry( | 165 void ContentFaviconDriver::DidStartNavigationToPendingEntry( |
166 const GURL& url, | 166 const GURL& url, |
167 content::NavigationController::ReloadType reload_type) { | 167 content::ReloadType reload_type) { |
168 if (reload_type == content::NavigationController::NO_RELOAD || | 168 if (reload_type == content::ReloadType::NONE || IsOffTheRecord()) |
169 IsOffTheRecord()) | |
170 return; | 169 return; |
171 | 170 |
172 bypass_cache_page_url_ = url; | 171 bypass_cache_page_url_ = url; |
173 SetFaviconOutOfDateForPage( | 172 SetFaviconOutOfDateForPage( |
174 url, | 173 url, reload_type == content::ReloadType::BYPASSING_CACHE); |
175 reload_type == content::NavigationController::RELOAD_BYPASSING_CACHE); | |
176 } | 174 } |
177 | 175 |
178 void ContentFaviconDriver::DidNavigateMainFrame( | 176 void ContentFaviconDriver::DidNavigateMainFrame( |
179 const content::LoadCommittedDetails& details, | 177 const content::LoadCommittedDetails& details, |
180 const content::FrameNavigateParams& params) { | 178 const content::FrameNavigateParams& params) { |
181 favicon_urls_.clear(); | 179 favicon_urls_.clear(); |
182 | 180 |
183 // Wait till the user navigates to a new URL to start checking the cache | 181 // Wait till the user navigates to a new URL to start checking the cache |
184 // again. The cache may be ignored for non-reload navigations (e.g. | 182 // again. The cache may be ignored for non-reload navigations (e.g. |
185 // history.replace() in-page navigation). This is allowed to increase the | 183 // history.replace() in-page navigation). This is allowed to increase the |
186 // likelihood that "reloading a page ignoring the cache" redownloads the | 184 // likelihood that "reloading a page ignoring the cache" redownloads the |
187 // favicon. In particular, a page may do an in-page navigation before | 185 // favicon. In particular, a page may do an in-page navigation before |
188 // FaviconHandler has the time to determine that the favicon needs to be | 186 // FaviconHandler has the time to determine that the favicon needs to be |
189 // redownloaded. | 187 // redownloaded. |
190 GURL url = details.entry->GetURL(); | 188 GURL url = details.entry->GetURL(); |
191 if (url != bypass_cache_page_url_) | 189 if (url != bypass_cache_page_url_) |
192 bypass_cache_page_url_ = GURL(); | 190 bypass_cache_page_url_ = GURL(); |
193 | 191 |
194 // Get the favicon, either from history or request it from the net. | 192 // Get the favicon, either from history or request it from the net. |
195 FetchFavicon(url); | 193 FetchFavicon(url); |
196 } | 194 } |
197 | 195 |
198 } // namespace favicon | 196 } // namespace favicon |
OLD | NEW |