| 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/importer/importer.h" | 5 #include "chrome/browser/importer/importer.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 webkit_glue::ImageDecoder decoder(gfx::Size(kFavIconSize, kFavIconSize)); | 376 webkit_glue::ImageDecoder decoder(gfx::Size(kFavIconSize, kFavIconSize)); |
| 377 SkBitmap decoded = decoder.Decode(src_data, src_len); | 377 SkBitmap decoded = decoder.Decode(src_data, src_len); |
| 378 if (decoded.empty()) | 378 if (decoded.empty()) |
| 379 return false; // Unable to decode. | 379 return false; // Unable to decode. |
| 380 | 380 |
| 381 if (decoded.width() != kFavIconSize || decoded.height() != kFavIconSize) { | 381 if (decoded.width() != kFavIconSize || decoded.height() != kFavIconSize) { |
| 382 // The bitmap is not the correct size, re-sample. | 382 // The bitmap is not the correct size, re-sample. |
| 383 int new_width = decoded.width(); | 383 int new_width = decoded.width(); |
| 384 int new_height = decoded.height(); | 384 int new_height = decoded.height(); |
| 385 calc_favicon_target_size(&new_width, &new_height); | 385 calc_favicon_target_size(&new_width, &new_height); |
| 386 decoded = gfx::ImageOperations::Resize( | 386 decoded = skia::ImageOperations::Resize( |
| 387 decoded, gfx::ImageOperations::RESIZE_LANCZOS3, | 387 decoded, skia::ImageOperations::RESIZE_LANCZOS3, new_width, new_height); |
| 388 gfx::Size(new_width, new_height)); | |
| 389 } | 388 } |
| 390 | 389 |
| 391 // Encode our bitmap as a PNG. | 390 // Encode our bitmap as a PNG. |
| 392 SkAutoLockPixels decoded_lock(decoded); | 391 SkAutoLockPixels decoded_lock(decoded); |
| 393 PNGEncoder::Encode(reinterpret_cast<unsigned char*>(decoded.getPixels()), | 392 PNGEncoder::Encode(reinterpret_cast<unsigned char*>(decoded.getPixels()), |
| 394 PNGEncoder::FORMAT_BGRA, decoded.width(), | 393 PNGEncoder::FORMAT_BGRA, decoded.width(), |
| 395 decoded.height(), decoded.width() * 4, false, png_data); | 394 decoded.height(), decoded.width() * 4, false, png_data); |
| 396 return true; | 395 return true; |
| 397 } | 396 } |
| 398 | 397 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 ProfileInfo* google_toolbar = new ProfileInfo(); | 707 ProfileInfo* google_toolbar = new ProfileInfo(); |
| 709 google_toolbar->browser_type = GOOGLE_TOOLBAR5; | 708 google_toolbar->browser_type = GOOGLE_TOOLBAR5; |
| 710 google_toolbar->description = l10n_util::GetString( | 709 google_toolbar->description = l10n_util::GetString( |
| 711 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); | 710 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); |
| 712 google_toolbar->source_path.clear(); | 711 google_toolbar->source_path.clear(); |
| 713 google_toolbar->app_path.clear(); | 712 google_toolbar->app_path.clear(); |
| 714 google_toolbar->services_supported = FAVORITES; | 713 google_toolbar->services_supported = FAVORITES; |
| 715 source_profiles_.push_back(google_toolbar); | 714 source_profiles_.push_back(google_toolbar); |
| 716 } | 715 } |
| 717 } | 716 } |
| OLD | NEW |