Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/favicon/favicon_tab_helper.h" | 5 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/favicon/favicon_handler.h" | 7 #include "chrome/browser/favicon/favicon_handler.h" |
| 8 #include "chrome/browser/favicon/favicon_service_factory.h" | 8 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 9 #include "chrome/browser/favicon/favicon_util.h" | 9 #include "chrome/browser/favicon/favicon_util.h" |
| 10 #include "chrome/browser/favicon/select_favicon_frames.h" | 10 #include "chrome/browser/favicon/select_favicon_frames.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 169 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 170 profile_, Profile::IMPLICIT_ACCESS); | 170 profile_, Profile::IMPLICIT_ACCESS); |
| 171 if (favicon_service) | 171 if (favicon_service) |
| 172 favicon_service->SetFaviconOutOfDateForPage(url); | 172 favicon_service->SetFaviconOutOfDateForPage(url); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 void FaviconTabHelper::DidNavigateMainFrame( | 176 void FaviconTabHelper::DidNavigateMainFrame( |
| 177 const content::LoadCommittedDetails& details, | 177 const content::LoadCommittedDetails& details, |
| 178 const content::FrameNavigateParams& params) { | 178 const content::FrameNavigateParams& params) { |
| 179 | |
| 180 // When navigating to a different host, clear the favicon. | |
| 181 if (details.previous_url.host() != details.entry->GetURL().host()) { | |
|
pkotwicz
2012/09/29 23:54:38
The favicon should actually always be cleared. (Yo
| |
| 182 FaviconStatus default_favicon; | |
| 183 details.entry->GetFavicon() = default_favicon; | |
|
msw
2012/09/21 21:46:54
nit: I think you can just do details.entry->GetFav
| |
| 184 } | |
| 185 | |
| 179 // Get the favicon, either from history or request it from the net. | 186 // Get the favicon, either from history or request it from the net. |
| 180 FetchFavicon(details.entry->GetURL()); | 187 FetchFavicon(details.entry->GetURL()); |
| 181 } | 188 } |
| 182 | 189 |
| 183 bool FaviconTabHelper::OnMessageReceived(const IPC::Message& message) { | 190 bool FaviconTabHelper::OnMessageReceived(const IPC::Message& message) { |
| 184 bool message_handled = false; // Allow other handlers to receive these. | 191 bool message_handled = false; // Allow other handlers to receive these. |
| 185 IPC_BEGIN_MESSAGE_MAP(FaviconTabHelper, message) | 192 IPC_BEGIN_MESSAGE_MAP(FaviconTabHelper, message) |
| 186 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) | 193 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) |
| 187 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 194 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
| 188 IPC_MESSAGE_UNHANDLED(message_handled = false) | 195 IPC_MESSAGE_UNHANDLED(message_handled = false) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 203 scale_factors = ui::GetSupportedScaleFactors(); | 210 scale_factors = ui::GetSupportedScaleFactors(); |
| 204 gfx::Image favicon(SelectFaviconFrames( | 211 gfx::Image favicon(SelectFaviconFrames( |
| 205 bitmaps, scale_factors, requested_size, &score)); | 212 bitmaps, scale_factors, requested_size, &score)); |
| 206 favicon_handler_->OnDidDownloadFavicon( | 213 favicon_handler_->OnDidDownloadFavicon( |
| 207 id, image_url, errored, favicon, score); | 214 id, image_url, errored, favicon, score); |
| 208 if (touch_icon_handler_.get()) { | 215 if (touch_icon_handler_.get()) { |
| 209 touch_icon_handler_->OnDidDownloadFavicon( | 216 touch_icon_handler_->OnDidDownloadFavicon( |
| 210 id, image_url, errored, favicon, score); | 217 id, image_url, errored, favicon, score); |
| 211 } | 218 } |
| 212 } | 219 } |
| OLD | NEW |