OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/fav_icon_helper.h" | 5 #include "chrome/browser/fav_icon_helper.h" |
6 | 6 |
7 #include "base/gfx/image_operations.h" | |
8 #include "base/gfx/png_decoder.h" | 7 #include "base/gfx/png_decoder.h" |
9 #include "base/gfx/png_encoder.h" | 8 #include "base/gfx/png_encoder.h" |
10 #include "chrome/browser/navigation_entry.h" | 9 #include "chrome/browser/navigation_entry.h" |
11 #include "chrome/browser/navigation_controller.h" | 10 #include "chrome/browser/navigation_controller.h" |
12 #include "chrome/browser/tab_contents_delegate.h" | 11 #include "chrome/browser/tab_contents_delegate.h" |
13 #include "chrome/browser/render_view_host.h" | 12 #include "chrome/browser/render_view_host.h" |
14 #include "chrome/browser/web_contents.h" | 13 #include "chrome/browser/web_contents.h" |
15 #include "chrome/common/gfx/favicon_size.h" | 14 #include "chrome/common/gfx/favicon_size.h" |
| 15 #include "skia/ext/image_operations.h" |
16 | 16 |
17 FavIconHelper::FavIconHelper(WebContents* web_contents) | 17 FavIconHelper::FavIconHelper(WebContents* web_contents) |
18 : web_contents_(web_contents), | 18 : web_contents_(web_contents), |
19 got_fav_icon_url_(false), | 19 got_fav_icon_url_(false), |
20 got_fav_icon_from_history_(false), | 20 got_fav_icon_from_history_(false), |
21 fav_icon_expired_(false) { | 21 fav_icon_expired_(false) { |
22 } | 22 } |
23 | 23 |
24 void FavIconHelper::FetchFavIcon(const GURL& url) { | 24 void FavIconHelper::FetchFavIcon(const GURL& url) { |
25 cancelable_consumer_.CancelAllRequests(); | 25 cancelable_consumer_.CancelAllRequests(); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 DCHECK(download_requests_.find(download_id) == download_requests_.end()); | 250 DCHECK(download_requests_.find(download_id) == download_requests_.end()); |
251 download_requests_[download_id] = | 251 download_requests_[download_id] = |
252 DownloadRequest(entry->url(), entry->favicon().url()); | 252 DownloadRequest(entry->url(), entry->favicon().url()); |
253 } | 253 } |
254 | 254 |
255 SkBitmap FavIconHelper::ConvertToFavIconSize(const SkBitmap& image) { | 255 SkBitmap FavIconHelper::ConvertToFavIconSize(const SkBitmap& image) { |
256 int width = image.width(); | 256 int width = image.width(); |
257 int height = image.height(); | 257 int height = image.height(); |
258 if (width > 0 && height > 0) { | 258 if (width > 0 && height > 0) { |
259 calc_favicon_target_size(&width, &height); | 259 calc_favicon_target_size(&width, &height); |
260 return gfx::ImageOperations::Resize( | 260 return skia::ImageOperations::Resize( |
261 image, gfx::ImageOperations::RESIZE_LANCZOS3, | 261 image, skia::ImageOperations::RESIZE_LANCZOS3, |
262 gfx::Size(width, height)); | 262 gfx::Size(width, height)); |
263 } | 263 } |
264 return image; | 264 return image; |
265 } | 265 } |
266 | 266 |
OLD | NEW |