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

Unified Diff: chrome/browser/shell_integration_linux.cc

Issue 12881003: ShortcutInfo::favicon is now a gfx::ImageFamily instead of gfx::Image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: web_app_mac: Fix compile error (no Mac to test it on so I'm building in the dark). Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/shell_integration_linux.cc
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 2a656fe711e02704e7c9e9ed896b47b173b8a008..d9bbe53c0d66386c090c7b148aba0853bf9ecc3b 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -36,8 +36,7 @@
#include "content/public/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
#include "ui/gfx/codec/png_codec.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/gfx/image/image_skia_rep.h"
+#include "ui/gfx/icon_family.h"
using content::BrowserThread;
@@ -75,7 +74,7 @@ bool LaunchXdgUtility(const std::vector<std::string>& argv, int* exit_code) {
std::string CreateShortcutIcon(
const ShellIntegration::ShortcutInfo& shortcut_info,
const base::FilePath& shortcut_filename) {
- if (shortcut_info.favicon.IsEmpty())
+ if (shortcut_info.favicon.empty())
return std::string();
// TODO(phajdan.jr): Report errors from this function, possibly as infobars.
@@ -87,16 +86,15 @@ std::string CreateShortcutIcon(
shortcut_filename.ReplaceExtension("png"));
std::string icon_name = temp_file_path.BaseName().RemoveExtension().value();
- std::vector<gfx::ImageSkiaRep> image_reps =
- shortcut_info.favicon.ToImageSkia()->image_reps();
- for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin();
- it != image_reps.end(); ++it) {
+ for (gfx::IconFamily::const_iterator it = shortcut_info.favicon.begin();
+ it != shortcut_info.favicon.end(); ++it) {
std::vector<unsigned char> png_data;
- const SkBitmap& bitmap = it->sk_bitmap();
+ int size = it->first;
+ const SkBitmap& bitmap = *it->second.bitmap();
if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data)) {
// If the bitmap could not be encoded to PNG format, skip it.
LOG(WARNING) << "Could not encode icon " << icon_name << ".png at size "
- << bitmap.width() << ".";
+ << size << ".";
continue;
}
int bytes_written = file_util::WriteFile(temp_file_path,
@@ -115,14 +113,14 @@ std::string CreateShortcutIcon(
argv.push_back("user");
argv.push_back("--size");
- argv.push_back(base::IntToString(bitmap.width()));
+ argv.push_back(base::IntToString(size));
argv.push_back(temp_file_path.value());
argv.push_back(icon_name);
int exit_code;
if (!LaunchXdgUtility(argv, &exit_code) || exit_code) {
LOG(WARNING) << "Could not install icon " << icon_name << ".png at size "
- << bitmap.width() << ".";
+ << size << ".";
}
}
return icon_name;

Powered by Google App Engine
This is Rietveld 408576698