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/history/history.h" | 10 #include "chrome/browser/history/history.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 166 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
167 profile_, Profile::IMPLICIT_ACCESS); | 167 profile_, Profile::IMPLICIT_ACCESS); |
168 if (favicon_service) | 168 if (favicon_service) |
169 favicon_service->SetFaviconOutOfDateForPage(url); | 169 favicon_service->SetFaviconOutOfDateForPage(url); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void FaviconTabHelper::DidNavigateMainFrame( | 173 void FaviconTabHelper::DidNavigateMainFrame( |
174 const content::LoadCommittedDetails& details, | 174 const content::LoadCommittedDetails& details, |
175 const content::FrameNavigateParams& params) { | 175 const content::FrameNavigateParams& params) { |
| 176 |
| 177 // The NavigationEntry may be reused from the previously navigated page in |
| 178 // the case of a client redirect. Clear the favicon as it should never be |
| 179 // carried over from the previous page. |
| 180 details.entry->GetFavicon() = FaviconStatus(); |
| 181 |
176 // Get the favicon, either from history or request it from the net. | 182 // Get the favicon, either from history or request it from the net. |
177 FetchFavicon(details.entry->GetURL()); | 183 FetchFavicon(details.entry->GetURL()); |
178 } | 184 } |
179 | 185 |
180 bool FaviconTabHelper::OnMessageReceived(const IPC::Message& message) { | 186 bool FaviconTabHelper::OnMessageReceived(const IPC::Message& message) { |
181 bool message_handled = false; // Allow other handlers to receive these. | 187 bool message_handled = false; // Allow other handlers to receive these. |
182 IPC_BEGIN_MESSAGE_MAP(FaviconTabHelper, message) | 188 IPC_BEGIN_MESSAGE_MAP(FaviconTabHelper, message) |
183 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) | 189 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) |
184 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 190 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
185 IPC_MESSAGE_UNHANDLED(message_handled = false) | 191 IPC_MESSAGE_UNHANDLED(message_handled = false) |
186 IPC_END_MESSAGE_MAP() | 192 IPC_END_MESSAGE_MAP() |
187 return message_handled; | 193 return message_handled; |
188 } | 194 } |
189 | 195 |
190 void FaviconTabHelper::OnDidDownloadFavicon( | 196 void FaviconTabHelper::OnDidDownloadFavicon( |
191 int id, | 197 int id, |
192 const GURL& image_url, | 198 const GURL& image_url, |
193 bool errored, | 199 bool errored, |
194 int requested_size, | 200 int requested_size, |
195 const std::vector<SkBitmap>& bitmaps) { | 201 const std::vector<SkBitmap>& bitmaps) { |
196 favicon_handler_->OnDidDownloadFavicon( | 202 favicon_handler_->OnDidDownloadFavicon( |
197 id, image_url, errored, requested_size, bitmaps); | 203 id, image_url, errored, requested_size, bitmaps); |
198 if (touch_icon_handler_.get()) { | 204 if (touch_icon_handler_.get()) { |
199 touch_icon_handler_->OnDidDownloadFavicon( | 205 touch_icon_handler_->OnDidDownloadFavicon( |
200 id, image_url, errored, requested_size, bitmaps); | 206 id, image_url, errored, requested_size, bitmaps); |
201 } | 207 } |
202 } | 208 } |
OLD | NEW |