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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 void ContentFaviconDriver::NotifyFaviconUpdated(bool icon_url_changed) { | 153 void ContentFaviconDriver::NotifyFaviconUpdated(bool icon_url_changed) { |
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 | |
163 // occur when loading an initially blank page. | |
164 content::NavigationEntry* entry = | 162 content::NavigationEntry* entry = |
165 web_contents()->GetController().GetLastCommittedEntry(); | 163 web_contents()->GetController().GetLastCommittedEntry(); |
166 if (!entry) | |
167 return; | |
168 | |
169 favicon_urls_ = candidates; | 164 favicon_urls_ = candidates; |
170 OnUpdateFaviconURL(entry->GetURL(), | 165 OnUpdateFaviconURL(entry->GetURL(), |
171 FaviconURLsFromContentFaviconURLs(candidates)); | 166 FaviconURLsFromContentFaviconURLs(candidates)); |
172 } | 167 } |
173 | 168 |
174 void ContentFaviconDriver::DidStartNavigationToPendingEntry( | 169 void ContentFaviconDriver::DidStartNavigationToPendingEntry( |
175 const GURL& url, | 170 const GURL& url, |
176 content::NavigationController::ReloadType reload_type) { | 171 content::NavigationController::ReloadType reload_type) { |
177 if (reload_type == content::NavigationController::NO_RELOAD || | 172 if (reload_type == content::NavigationController::NO_RELOAD || |
178 IsOffTheRecord()) | 173 IsOffTheRecord()) |
(...skipping 18 matching lines...) Expand all Loading... |
197 // redownloaded. | 192 // redownloaded. |
198 GURL url = details.entry->GetURL(); | 193 GURL url = details.entry->GetURL(); |
199 if (url != bypass_cache_page_url_) | 194 if (url != bypass_cache_page_url_) |
200 bypass_cache_page_url_ = GURL(); | 195 bypass_cache_page_url_ = GURL(); |
201 | 196 |
202 // Get the favicon, either from history or request it from the net. | 197 // Get the favicon, either from history or request it from the net. |
203 FetchFavicon(url); | 198 FetchFavicon(url); |
204 } | 199 } |
205 | 200 |
206 } // namespace favicon | 201 } // namespace favicon |
OLD | NEW |