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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (decoded.width() != kFavIconSize || decoded.height() != kFavIconSize) { | 382 if (decoded.width() != kFavIconSize || decoded.height() != kFavIconSize) { |
383 // The bitmap is not the correct size, re-sample. | 383 // The bitmap is not the correct size, re-sample. |
384 int new_width = decoded.width(); | 384 int new_width = decoded.width(); |
385 int new_height = decoded.height(); | 385 int new_height = decoded.height(); |
386 calc_favicon_target_size(&new_width, &new_height); | 386 calc_favicon_target_size(&new_width, &new_height); |
387 decoded = skia::ImageOperations::Resize( | 387 decoded = skia::ImageOperations::Resize( |
388 decoded, skia::ImageOperations::RESIZE_LANCZOS3, new_width, new_height); | 388 decoded, skia::ImageOperations::RESIZE_LANCZOS3, new_width, new_height); |
389 } | 389 } |
390 | 390 |
391 // Encode our bitmap as a PNG. | 391 // Encode our bitmap as a PNG. |
392 SkAutoLockPixels decoded_lock(decoded); | 392 PNGEncoder::EncodeBGRASkBitmap(decoded, false, png_data); |
393 PNGEncoder::Encode(reinterpret_cast<unsigned char*>(decoded.getPixels()), | |
394 PNGEncoder::FORMAT_BGRA, decoded.width(), | |
395 decoded.height(), decoded.width() * 4, false, png_data); | |
396 return true; | 393 return true; |
397 } | 394 } |
398 | 395 |
399 // ImporterHost. | 396 // ImporterHost. |
400 | 397 |
401 ImporterHost::ImporterHost() | 398 ImporterHost::ImporterHost() |
402 : observer_(NULL), | 399 : observer_(NULL), |
403 task_(NULL), | 400 task_(NULL), |
404 importer_(NULL), | 401 importer_(NULL), |
405 file_loop_(g_browser_process->file_thread()->message_loop()), | 402 file_loop_(g_browser_process->file_thread()->message_loop()), |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 ProfileInfo* google_toolbar = new ProfileInfo(); | 705 ProfileInfo* google_toolbar = new ProfileInfo(); |
709 google_toolbar->browser_type = GOOGLE_TOOLBAR5; | 706 google_toolbar->browser_type = GOOGLE_TOOLBAR5; |
710 google_toolbar->description = l10n_util::GetString( | 707 google_toolbar->description = l10n_util::GetString( |
711 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); | 708 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); |
712 google_toolbar->source_path.clear(); | 709 google_toolbar->source_path.clear(); |
713 google_toolbar->app_path.clear(); | 710 google_toolbar->app_path.clear(); |
714 google_toolbar->services_supported = FAVORITES; | 711 google_toolbar->services_supported = FAVORITES; |
715 source_profiles_.push_back(google_toolbar); | 712 source_profiles_.push_back(google_toolbar); |
716 } | 713 } |
717 } | 714 } |
OLD | NEW |