FaviconTabHelper::FaviconTabHelper(WebContents* web_contents)
: content::WebContentsObserver(web_contents),
- profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())),
- should_fetch_icons_(true) {
+ profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) {
favicon_handler_.reset(new FaviconHandler(profile_, this,
FaviconHandler::FAVICON));
if (chrome::kEnableTouchIcon)
}
void FaviconTabHelper::FetchFavicon(const GURL& url) {
- if (!should_fetch_icons_)
- return;
-
favicon_handler_->FetchFavicon(url);
if (touch_icon_handler_.get())
touch_icon_handler_->FetchFavicon(url);
return true;
GURL url = web_contents()->GetURL();
- if (url.SchemeIs(chrome::kChromeUIScheme) &&
+ if (url.SchemeIs(content::kChromeUIScheme) &&
url.host() == chrome::kChromeUINewTabHost) {
return false;
}
web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB);
}
-void FaviconTabHelper::NavigateToPendingEntry(
+void FaviconTabHelper::DidStartNavigationToPendingEntry(
const GURL& url,
NavigationController::ReloadType reload_type) {
if (reload_type != NavigationController::NO_RELOAD &&
void FaviconTabHelper::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
+ favicon_urls_.clear();
// Get the favicon, either from history or request it from the net.
FetchFavicon(details.entry->GetURL());
}
void FaviconTabHelper::DidUpdateFaviconURL(
int32 page_id,
const std::vector<content::FaviconURL>& candidates) {
+ DCHECK(!candidates.empty());
+ favicon_urls_ = candidates;
+
favicon_handler_->OnUpdateFaviconURL(page_id, candidates);
if (touch_icon_handler_.get())
touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates);