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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (UrlMatches(url, url_) && icon_type == history::FAVICON) { | 214 if (UrlMatches(url, url_) && icon_type == history::FAVICON) { |
215 NavigationEntry* entry = GetEntry(); | 215 NavigationEntry* entry = GetEntry(); |
216 if (entry) { | 216 if (entry) { |
217 entry->GetFavicon().url = image_url; | 217 entry->GetFavicon().url = image_url; |
218 UpdateFavicon(entry, &sized_image); | 218 UpdateFavicon(entry, &sized_image); |
219 } | 219 } |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 void FaviconHandler::UpdateFavicon(NavigationEntry* entry, | 223 void FaviconHandler::UpdateFavicon(NavigationEntry* entry, |
224 scoped_refptr<RefCountedMemory> data) { | 224 scoped_refptr<base::RefCountedMemory> data) { |
225 scoped_ptr<gfx::Image> image(gfx::ImageFromPNGEncodedData(data->front(), | 225 scoped_ptr<gfx::Image> image(gfx::ImageFromPNGEncodedData(data->front(), |
226 data->size())); | 226 data->size())); |
227 UpdateFavicon(entry, image.get()); | 227 UpdateFavicon(entry, image.get()); |
228 } | 228 } |
229 | 229 |
230 void FaviconHandler::UpdateFavicon(NavigationEntry* entry, | 230 void FaviconHandler::UpdateFavicon(NavigationEntry* entry, |
231 const gfx::Image* image) { | 231 const gfx::Image* image) { |
232 // No matter what happens, we need to mark the favicon as being set. | 232 // No matter what happens, we need to mark the favicon as being set. |
233 entry->GetFavicon().valid = true; | 233 entry->GetFavicon().valid = true; |
234 | 234 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 int height = bitmap.height(); | 534 int height = bitmap.height(); |
535 if (width > 0 && height > 0) { | 535 if (width > 0 && height > 0) { |
536 gfx::CalculateFaviconTargetSize(&width, &height); | 536 gfx::CalculateFaviconTargetSize(&width, &height); |
537 return gfx::Image(skia::ImageOperations::Resize( | 537 return gfx::Image(skia::ImageOperations::Resize( |
538 bitmap, skia::ImageOperations::RESIZE_LANCZOS3, | 538 bitmap, skia::ImageOperations::RESIZE_LANCZOS3, |
539 width, height)); | 539 width, height)); |
540 } | 540 } |
541 | 541 |
542 return image; | 542 return image; |
543 } | 543 } |
OLD | NEW |