| 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_handler.h" | 5 #include "chrome/browser/favicon/favicon_handler.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 // If the URL has changed out from under us (as will happen with redirects) | 339 // If the URL has changed out from under us (as will happen with redirects) |
| 340 // return NULL. | 340 // return NULL. |
| 341 return NULL; | 341 return NULL; |
| 342 } | 342 } |
| 343 | 343 |
| 344 int FaviconHandler::DownloadFavicon(const GURL& image_url, int image_size) { | 344 int FaviconHandler::DownloadFavicon(const GURL& image_url, int image_size) { |
| 345 if (!image_url.is_valid()) { | 345 if (!image_url.is_valid()) { |
| 346 NOTREACHED(); | 346 NOTREACHED(); |
| 347 return 0; | 347 return 0; |
| 348 } | 348 } |
| 349 static int next_id = 1; | 349 int id = delegate_->StartDownload(image_url, image_size); |
| 350 int id = next_id++; | |
| 351 delegate_->StartDownload(id, image_url, image_size); | |
| 352 return id; | 350 return id; |
| 353 } | 351 } |
| 354 | 352 |
| 355 void FaviconHandler::UpdateFaviconMappingAndFetch( | 353 void FaviconHandler::UpdateFaviconMappingAndFetch( |
| 356 const GURL& page_url, | 354 const GURL& page_url, |
| 357 const GURL& icon_url, | 355 const GURL& icon_url, |
| 358 history::IconType icon_type, | 356 history::IconType icon_type, |
| 359 CancelableRequestConsumerBase* consumer, | 357 CancelableRequestConsumerBase* consumer, |
| 360 const FaviconService::FaviconDataCallback& callback) { | 358 const FaviconService::FaviconDataCallback& callback) { |
| 361 GetFaviconService()->UpdateFaviconMappingAndFetch(page_url, icon_url, | 359 GetFaviconService()->UpdateFaviconMappingAndFetch(page_url, icon_url, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 int height = bitmap.height(); | 532 int height = bitmap.height(); |
| 535 if (width > 0 && height > 0) { | 533 if (width > 0 && height > 0) { |
| 536 gfx::CalculateFaviconTargetSize(&width, &height); | 534 gfx::CalculateFaviconTargetSize(&width, &height); |
| 537 return gfx::Image(skia::ImageOperations::Resize( | 535 return gfx::Image(skia::ImageOperations::Resize( |
| 538 bitmap, skia::ImageOperations::RESIZE_LANCZOS3, | 536 bitmap, skia::ImageOperations::RESIZE_LANCZOS3, |
| 539 width, height)); | 537 width, height)); |
| 540 } | 538 } |
| 541 | 539 |
| 542 return image; | 540 return image; |
| 543 } | 541 } |
| OLD | NEW |