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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 FaviconDriverImpl::NotifyFaviconUpdated(icon_url_changed); | 154 FaviconDriverImpl::NotifyFaviconUpdated(icon_url_changed); |
155 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); | 155 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); |
156 } | 156 } |
157 | 157 |
158 void ContentFaviconDriver::DidUpdateFaviconURL( | 158 void ContentFaviconDriver::DidUpdateFaviconURL( |
159 const std::vector<content::FaviconURL>& candidates) { | 159 const std::vector<content::FaviconURL>& candidates) { |
160 DCHECK(!candidates.empty()); | 160 DCHECK(!candidates.empty()); |
161 | 161 |
162 // Ignore the update if there is no last committed navigation entry. This can | 162 // Ignore the update if there is no last committed navigation entry. This can |
163 // occur when loading an initially blank page. | 163 // occur when loading an initially blank page. |
164 if (!web_contents()->GetController().GetLastCommittedEntry()) | 164 content::NavigationEntry* entry = |
| 165 web_contents()->GetController().GetLastCommittedEntry(); |
| 166 if (!entry) |
165 return; | 167 return; |
166 | 168 |
167 favicon_urls_ = candidates; | 169 favicon_urls_ = candidates; |
168 OnUpdateFaviconURL(FaviconURLsFromContentFaviconURLs(candidates)); | 170 OnUpdateFaviconURL(entry->GetURL(), |
| 171 FaviconURLsFromContentFaviconURLs(candidates)); |
169 } | 172 } |
170 | 173 |
171 void ContentFaviconDriver::DidStartNavigationToPendingEntry( | 174 void ContentFaviconDriver::DidStartNavigationToPendingEntry( |
172 const GURL& url, | 175 const GURL& url, |
173 content::NavigationController::ReloadType reload_type) { | 176 content::NavigationController::ReloadType reload_type) { |
174 if (reload_type == content::NavigationController::NO_RELOAD || | 177 if (reload_type == content::NavigationController::NO_RELOAD || |
175 IsOffTheRecord()) | 178 IsOffTheRecord()) |
176 return; | 179 return; |
177 | 180 |
178 bypass_cache_page_url_ = url; | 181 bypass_cache_page_url_ = url; |
(...skipping 15 matching lines...) Expand all Loading... |
194 // redownloaded. | 197 // redownloaded. |
195 GURL url = details.entry->GetURL(); | 198 GURL url = details.entry->GetURL(); |
196 if (url != bypass_cache_page_url_) | 199 if (url != bypass_cache_page_url_) |
197 bypass_cache_page_url_ = GURL(); | 200 bypass_cache_page_url_ = GURL(); |
198 | 201 |
199 // 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. |
200 FetchFavicon(url); | 203 FetchFavicon(url); |
201 } | 204 } |
202 | 205 |
203 } // namespace favicon | 206 } // namespace favicon |
OLD | NEW |