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