Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Side by Side Diff: chrome/browser/importer/importer.cc

Issue 6672065: Support touch icon in FaviconHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reset candidates when FaviconURL is updated Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/importer/importer.h" 5 #include "chrome/browser/importer/importer.h"
6 6
7 #include "chrome/browser/importer/importer_bridge.h" 7 #include "chrome/browser/importer/importer_bridge.h"
8 #include "chrome/browser/importer/importer_data_types.h" 8 #include "chrome/browser/importer/importer_data_types.h"
9 #include "skia/ext/image_operations.h" 9 #include "skia/ext/image_operations.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 21 matching lines...) Expand all
32 // Decode the favicon using WebKit's image decoder. 32 // Decode the favicon using WebKit's image decoder.
33 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); 33 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize));
34 SkBitmap decoded = decoder.Decode(src_data, src_len); 34 SkBitmap decoded = decoder.Decode(src_data, src_len);
35 if (decoded.empty()) 35 if (decoded.empty())
36 return false; // Unable to decode. 36 return false; // Unable to decode.
37 37
38 if (decoded.width() != kFaviconSize || decoded.height() != kFaviconSize) { 38 if (decoded.width() != kFaviconSize || decoded.height() != kFaviconSize) {
39 // The bitmap is not the correct size, re-sample. 39 // The bitmap is not the correct size, re-sample.
40 int new_width = decoded.width(); 40 int new_width = decoded.width();
41 int new_height = decoded.height(); 41 int new_height = decoded.height();
42 calc_favicon_target_size(&new_width, &new_height); 42 calc_favicon_target_size(kFaviconSize, &new_width, &new_height);
43 decoded = skia::ImageOperations::Resize( 43 decoded = skia::ImageOperations::Resize(
44 decoded, skia::ImageOperations::RESIZE_LANCZOS3, new_width, new_height); 44 decoded, skia::ImageOperations::RESIZE_LANCZOS3, new_width, new_height);
45 } 45 }
46 46
47 // Encode our bitmap as a PNG. 47 // Encode our bitmap as a PNG.
48 gfx::PNGCodec::EncodeBGRASkBitmap(decoded, false, png_data); 48 gfx::PNGCodec::EncodeBGRASkBitmap(decoded, false, png_data);
49 return true; 49 return true;
50 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698