| 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/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/favicon/favicon_handler.h" | 8 #include "chrome/browser/favicon/favicon_handler.h" |
| 9 #include "chrome/browser/favicon/favicon_service_factory.h" | 9 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 10 #include "chrome/browser/favicon/favicon_util.h" | 10 #include "chrome/browser/favicon/favicon_util.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 favicon_service->SetFaviconOutOfDateForPage(url); | 168 favicon_service->SetFaviconOutOfDateForPage(url); |
| 169 if (reload_type == NavigationController::RELOAD_IGNORING_CACHE) | 169 if (reload_type == NavigationController::RELOAD_IGNORING_CACHE) |
| 170 favicon_service->ClearUnableToDownloadFavicons(); | 170 favicon_service->ClearUnableToDownloadFavicons(); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 void FaviconTabHelper::DidNavigateMainFrame( | 175 void FaviconTabHelper::DidNavigateMainFrame( |
| 176 const content::LoadCommittedDetails& details, | 176 const content::LoadCommittedDetails& details, |
| 177 const content::FrameNavigateParams& params) { | 177 const content::FrameNavigateParams& params) { |
| 178 favicon_urls_.clear(); |
| 178 // Get the favicon, either from history or request it from the net. | 179 // Get the favicon, either from history or request it from the net. |
| 179 FetchFavicon(details.entry->GetURL()); | 180 FetchFavicon(details.entry->GetURL()); |
| 180 } | 181 } |
| 181 | 182 |
| 182 void FaviconTabHelper::DidUpdateFaviconURL( | 183 void FaviconTabHelper::DidUpdateFaviconURL( |
| 183 int32 page_id, | 184 int32 page_id, |
| 184 const std::vector<content::FaviconURL>& candidates) { | 185 const std::vector<content::FaviconURL>& candidates) { |
| 186 DCHECK(!candidates.empty()); |
| 187 favicon_urls_ = candidates; |
| 188 |
| 185 favicon_handler_->OnUpdateFaviconURL(page_id, candidates); | 189 favicon_handler_->OnUpdateFaviconURL(page_id, candidates); |
| 186 if (touch_icon_handler_.get()) | 190 if (touch_icon_handler_.get()) |
| 187 touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates); | 191 touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates); |
| 188 } | 192 } |
| 189 | 193 |
| 190 void FaviconTabHelper::DidDownloadFavicon( | 194 void FaviconTabHelper::DidDownloadFavicon( |
| 191 int id, | 195 int id, |
| 192 int http_status_code, | 196 int http_status_code, |
| 193 const GURL& image_url, | 197 const GURL& image_url, |
| 194 const std::vector<SkBitmap>& bitmaps, | 198 const std::vector<SkBitmap>& bitmaps, |
| 195 const std::vector<gfx::Size>& original_bitmap_sizes) { | 199 const std::vector<gfx::Size>& original_bitmap_sizes) { |
| 196 | 200 |
| 197 if (bitmaps.empty() && http_status_code == 404) { | 201 if (bitmaps.empty() && http_status_code == 404) { |
| 198 DVLOG(1) << "Failed to Download Favicon:" << image_url; | 202 DVLOG(1) << "Failed to Download Favicon:" << image_url; |
| 199 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 203 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 200 profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); | 204 profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); |
| 201 if (favicon_service) | 205 if (favicon_service) |
| 202 favicon_service->UnableToDownloadFavicon(image_url); | 206 favicon_service->UnableToDownloadFavicon(image_url); |
| 203 } | 207 } |
| 204 | 208 |
| 205 favicon_handler_->OnDidDownloadFavicon( | 209 favicon_handler_->OnDidDownloadFavicon( |
| 206 id, image_url, bitmaps, original_bitmap_sizes); | 210 id, image_url, bitmaps, original_bitmap_sizes); |
| 207 if (touch_icon_handler_.get()) { | 211 if (touch_icon_handler_.get()) { |
| 208 touch_icon_handler_->OnDidDownloadFavicon( | 212 touch_icon_handler_->OnDidDownloadFavicon( |
| 209 id, image_url, bitmaps, original_bitmap_sizes); | 213 id, image_url, bitmaps, original_bitmap_sizes); |
| 210 } | 214 } |
| 211 } | 215 } |
| OLD | NEW |