diff options
-rw-r--r-- | gfx/icon_util.cc | 12 | ||||
-rw-r--r-- | gfx/icon_util.h | 3 | ||||
-rw-r--r-- | gfx/icon_util_unittest.cc | 2 |
3 files changed, 5 insertions, 12 deletions
diff --git a/gfx/icon_util.cc b/gfx/icon_util.cc index 35aa230..6a4e51c 100644 --- a/gfx/icon_util.cc +++ b/gfx/icon_util.cc @@ -187,7 +187,7 @@ SkBitmap* IconUtil::CreateSkBitmapFromHICON(HICON icon, const gfx::Size& s) { } bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, - const std::wstring& icon_file_name) { + const FilePath& icon_path) { // Only 32 bit ARGB bitmaps are supported. We also make sure the bitmap has // been properly initialized. SkAutoLockPixels bitmap_lock(bitmap); @@ -197,8 +197,8 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, return false; // We start by creating the file. - ScopedHandle icon_file(::CreateFile(icon_file_name.c_str(), GENERIC_WRITE, 0, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); + ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(), + GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); if (icon_file.Get() == INVALID_HANDLE_VALUE) return false; @@ -248,17 +248,13 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, ::CloseHandle(icon_file.Take()); delete [] buffer; if (delete_file) { - bool success = file_util::Delete(icon_file_name, false); + bool success = file_util::Delete(icon_path, false); DCHECK(success); } return !delete_file; } -bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, - const FilePath& icon_path) { - return CreateIconFileFromSkBitmap(bitmap, icon_path.ToWStringHack()); -} bool IconUtil::PixelsHaveAlpha(const uint32* pixels, size_t num_pixels) { for (const uint32* end = pixels + num_pixels; pixels != end; ++pixels) { if ((*pixels & 0xff000000) != 0) diff --git a/gfx/icon_util.h b/gfx/icon_util.h index 80c81f6..19d0a5f 100644 --- a/gfx/icon_util.h +++ b/gfx/icon_util.h @@ -78,9 +78,6 @@ class IconUtil { // the desired .ico file. // // The function returns true on success and false otherwise. - // TODO(tfarina): Deprecated version of the FilePath version below. - static bool CreateIconFileFromSkBitmap(const SkBitmap& bitmap, - const std::wstring& icon_file_name); static bool CreateIconFileFromSkBitmap(const SkBitmap& bitmap, const FilePath& icon_path); diff --git a/gfx/icon_util_unittest.cc b/gfx/icon_util_unittest.cc index 996dac4..43eca49 100644 --- a/gfx/icon_util_unittest.cc +++ b/gfx/icon_util_unittest.cc @@ -113,7 +113,7 @@ TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { scoped_ptr<SkBitmap> bitmap; FilePath valid_icon_filename = test_data_directory_.AppendASCII( kSmallIconName); - std::wstring invalid_icon_filename(L"C:\\<>?.ico"); + FilePath invalid_icon_filename(FILE_PATH_LITERAL("C:\\<>?.ico")); // Wrong bitmap format. bitmap.reset(new SkBitmap); |