Chromium Code Reviews| Index: components/favicon/content/content_favicon_driver.cc |
| diff --git a/components/favicon/content/content_favicon_driver.cc b/components/favicon/content/content_favicon_driver.cc |
| index dfc40d4e1ba75caf75c19cf0614131ea9f78cc6e..199eadab27a3182901d003c8e048100be1292aad 100644 |
| --- a/components/favicon/content/content_favicon_driver.cc |
| +++ b/components/favicon/content/content_favicon_driver.cc |
| @@ -14,6 +14,7 @@ |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/navigation_details.h" |
| #include "content/public/browser/navigation_entry.h" |
| +#include "content/public/browser/navigation_handle.h" |
| #include "content/public/common/favicon_url.h" |
| #include "ui/gfx/image/image.h" |
| @@ -162,20 +163,29 @@ void ContentFaviconDriver::DidUpdateFaviconURL( |
| FaviconURLsFromContentFaviconURLs(candidates)); |
| } |
| -void ContentFaviconDriver::DidStartNavigationToPendingEntry( |
| - const GURL& url, |
| - content::ReloadType reload_type) { |
| +void ContentFaviconDriver::DidStartNavigation( |
|
Charlie Reis
2017/01/23 18:30:08
Note: This will get called more often than before,
jam
2017/01/23 19:05:02
This shouldn't make a difference because the funct
Charlie Reis
2017/01/23 19:53:30
Yes, looks like you're right.
|
| + content::NavigationHandle* navigation_handle) { |
| + if (!navigation_handle->IsInMainFrame()) |
| + return; |
| + |
| + content::ReloadType reload_type = navigation_handle->GetReloadType(); |
| if (reload_type == content::ReloadType::NONE || IsOffTheRecord()) |
| return; |
| - bypass_cache_page_url_ = url; |
| + bypass_cache_page_url_ = navigation_handle->GetURL(); |
| SetFaviconOutOfDateForPage( |
| - url, reload_type == content::ReloadType::BYPASSING_CACHE); |
| + navigation_handle->GetURL(), |
| + reload_type == content::ReloadType::BYPASSING_CACHE); |
| } |
| -void ContentFaviconDriver::DidNavigateMainFrame( |
| - const content::LoadCommittedDetails& details, |
| - const content::FrameNavigateParams& params) { |
| +void ContentFaviconDriver::DidFinishNavigation( |
| + content::NavigationHandle* navigation_handle) { |
| + if (!navigation_handle->IsInMainFrame() || |
| + !navigation_handle->HasCommitted() || |
| + navigation_handle->IsErrorPage()) { |
| + return; |
| + } |
| + |
| favicon_urls_.clear(); |
| // Wait till the user navigates to a new URL to start checking the cache |
| @@ -185,7 +195,7 @@ void ContentFaviconDriver::DidNavigateMainFrame( |
| // favicon. In particular, a page may do an in-page navigation before |
| // FaviconHandler has the time to determine that the favicon needs to be |
| // redownloaded. |
| - GURL url = details.entry->GetURL(); |
| + GURL url = navigation_handle->GetURL(); |
| if (url != bypass_cache_page_url_) |
| bypass_cache_page_url_ = GURL(); |