| 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_.reset(); |
| 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 favicon_urls_.reset(new std::vector<content::FaviconURL>(candidates)); |
| 187 |
| 185 favicon_handler_->OnUpdateFaviconURL(page_id, candidates); | 188 favicon_handler_->OnUpdateFaviconURL(page_id, candidates); |
| 186 if (touch_icon_handler_.get()) | 189 if (touch_icon_handler_.get()) |
| 187 touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates); | 190 touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates); |
| 188 } | 191 } |
| 189 | 192 |
| 190 void FaviconTabHelper::DidDownloadFavicon( | 193 void FaviconTabHelper::DidDownloadFavicon( |
| 191 int id, | 194 int id, |
| 192 int http_status_code, | 195 int http_status_code, |
| 193 const GURL& image_url, | 196 const GURL& image_url, |
| 194 const std::vector<SkBitmap>& bitmaps, | 197 const std::vector<SkBitmap>& bitmaps, |
| 195 const std::vector<gfx::Size>& original_bitmap_sizes) { | 198 const std::vector<gfx::Size>& original_bitmap_sizes) { |
| 196 | 199 |
| 197 if (bitmaps.empty() && http_status_code == 404) { | 200 if (bitmaps.empty() && http_status_code == 404) { |
| 198 DVLOG(1) << "Failed to Download Favicon:" << image_url; | 201 DVLOG(1) << "Failed to Download Favicon:" << image_url; |
| 199 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 202 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 200 profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); | 203 profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS); |
| 201 if (favicon_service) | 204 if (favicon_service) |
| 202 favicon_service->UnableToDownloadFavicon(image_url); | 205 favicon_service->UnableToDownloadFavicon(image_url); |
| 203 } | 206 } |
| 204 | 207 |
| 205 favicon_handler_->OnDidDownloadFavicon( | 208 favicon_handler_->OnDidDownloadFavicon( |
| 206 id, image_url, bitmaps, original_bitmap_sizes); | 209 id, image_url, bitmaps, original_bitmap_sizes); |
| 207 if (touch_icon_handler_.get()) { | 210 if (touch_icon_handler_.get()) { |
| 208 touch_icon_handler_->OnDidDownloadFavicon( | 211 touch_icon_handler_->OnDidDownloadFavicon( |
| 209 id, image_url, bitmaps, original_bitmap_sizes); | 212 id, image_url, bitmaps, original_bitmap_sizes); |
| 210 } | 213 } |
| 211 } | 214 } |
| OLD | NEW |